-
Notifications
You must be signed in to change notification settings - Fork 34
Clear captcha everytime it reruns and also add pip install guide for linux #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Clear captcha textbox if user enters wrong captcha
WalkthroughThis pull request introduces a new section in the installation documentation for users setting up a Python environment using pip. It provides step-by-step instructions for creating and activating a virtual environment and installing dependencies. Additionally, a minor change is made in the captcha handling code by adding an empty placeholder before capturing user input, without altering the existing verification logic. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant C as CaptchaControl Function
participant UI as UI Framework
U->>C: Call captcha_control()
C->>UI: Create empty placeholder (st.empty())
C->>UI: Render captcha input (st.text_input)
U->>UI: Enter captcha text
UI->>C: Submit input for validation
C->>UI: Validate captcha and display result
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docs/installation.md (1)
20-27: Clarify and Consistently Format Virtual Environment InstructionsThe added Linux instructions are useful, but there are a couple of points for improvement:
- Consistency: The command to create a virtual environment uses a placeholder (
<myenvpath>), but the activation command is hardcoded assource .venv/bin/activate. Consider either using the same placeholder in both steps (e.g.,source <myenvpath>/bin/activate) or clarifying that users should name their environment.venv.- Phrasing: The note “if you get the error : externally managed environment” has an awkward spacing around the colon. Rephrasing it to something like “if you encounter the ‘externally managed environment’ error” would improve clarity.
🧰 Tools
🪛 LanguageTool
[grammar] ~20-~20: The correct preposition appears to be “on”.
Context: ...pip install -r requirements.txt` Note: In Linux, if you get the error : externall...(IN_WINDOWS)
src/common/captcha_.py (1)
237-238: Improve Usage of the Empty Placeholder for Captcha InputLine 237 adds an empty placeholder with
st.empty(), but it is immediately overwritten on line 238 by callingc1.text_input(...). If the goal is to ensure that the captcha text input is cleared on reruns, consider using the placeholder to render the text input. For example:- c1, c2 = st.columns([70, 30]) - capta2_text = st.empty() - capta2_text = c1.text_input("Enter captcha text", max_chars=5) + c1, c2 = st.columns([70, 30]) + capta2_text_placeholder = st.empty() + capta2_text = capta2_text_placeholder.text_input("Enter captcha text", max_chars=5)This change makes sure that the input widget is tied to the placeholder, allowing you to clear or update it as needed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/installation.md(1 hunks)src/common/captcha_.py(1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/installation.md
[grammar] ~20-~20: The correct preposition appears to be “on”.
Context: ...pip install -r requirements.txt` Note: In Linux, if you get the error : externall...
(IN_WINDOWS)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/installation.md (1)
20-30: Refine Linux Installation Guide InstructionsThe new Linux instructions clearly address the "externally managed environment" error by outlining the steps to create and activate a virtual environment. There are a couple of points to consider for clarity and consistency:
- Grammar improvement: Consider changing “Note: In Linux, if you get the error : externally managed environment, follow this:” to something like:
-*Note*: In Linux, if you get the error : externally managed environment, follow this: +*Note*: On Linux, if you encounter the error "externally managed environment", follow these steps:- Virtual environment path consistency: The command uses a placeholder
<myenvpath>(python3 -m venv <myenvpath>) but later the activation command hardcodes.venv(source .venv/bin/activate). For clarity, consider either:
- Using a consistent folder name (e.g., replace
<myenvpath>with.venvin both commands), or- Instructing users to replace
<myenvpath>in both the creation and activation commands.
For example:or, if you prefer keeping-`python3 -m venv <myenvpath>` -`source .venv/bin/activate` +`python3 -m venv .venv` +`source .venv/bin/activate`<myenvpath>as a placeholder:-`source .venv/bin/activate` +`source <myenvpath>/bin/activate`🧰 Tools
🪛 LanguageTool
[grammar] ~20-~20: The correct preposition appears to be “on”.
Context: ...p install -r requirements.txt` Note: In Linux, if you get the error : externall...(IN_WINDOWS)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/installation.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/installation.md
[grammar] ~20-~20: The correct preposition appears to be “on”.
Context: ...p install -r requirements.txt` Note: In Linux, if you get the error : externall...
(IN_WINDOWS)
jcharkow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just minor changes with the documentation
docs/installation.md
Outdated
| *Note*: In Linux, if you get the error : externally managed environment, follow this: | ||
|
|
||
| Create a virtual environment | ||
| `python3 -m venv <myenvpath>` | ||
|
|
||
| Activate the virtual environment | ||
| `source .venv/bin/activate` | ||
|
|
||
| Run the command (make sure you are in the directory where requirements.txt is): | ||
| `pip install -r requirements.txt` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition, to be consistent with the other documentation please add a header. E.g. "### via pip in a new virtual python environment "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcharkow I have placed the guide for new Python environment above the existing one for clarity
|
LGTM! Thank you for the contribution! |
I have done two things:
The first issue was that everytime a user enters a wrong captcha, he needs to manually clear the captcha. Instead, what I have done is to clear the captcha everytime the user enters a wrong captcha.
The second is that in pip install, specifically in Linux, one gets the error: externally managed environment. For that issue, I have provided a guide on how to create a virtual environment and then install the requirements.
Summary by CodeRabbit