Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The copy button on install copies an extensive comman including env activation #26948

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

Closed
MuhammadNizamani opened this issue Jul 31, 2023 · 10 comments · Fixed by #27052
Closed

Comments

@MuhammadNizamani
Copy link

Describe the issue linked to the documentation

https://scikit-learn.org/stable/install.html

Above link will lead you to the sklearn downlanding for link .
when you link copy link button it will copy
python3 -m venv sklearn-venvpython -m venv sklearn-venvpython -m venv sklearn-venvsource sklearn-venv/bin/activatesource sklearn-venv/bin/activatesklearn-venv\Scripts\activatepip install -U scikit-learnpip install -U scikit-learnpip install -U scikit-learnpip3 install -U scikit-learnconda create -n sklearn-env -c conda-forge scikit-learnconda activate sklearn-env

instead of pip3 install -U scikit-learn

if this is the issue so please issue i want to create a pull request for it and tell in which file this issue reside
Thanks

Suggest a potential alternative/fix

By resoving above issue

@adrinjalali adrinjalali changed the title There is issue in documantion The copy button on install copies an extensive comman including env activation Jul 31, 2023
@adrinjalali adrinjalali removed the Needs Triage Issue requires triage label Jul 31, 2023
@adrinjalali
Copy link
Member

cc @ArturoAmorQ

@MuhammadNizamani
Copy link
Author

@adrinjalali can you tell me where can i find the code for this issue I want to create PR

@glemaitre
Copy link
Member

Yep apparently the directive is copying all the instructions from the different OS.
Not sure about the fix here.

@MuhammadNizamani
Copy link
Author

@glemaitre I want to know in which file the code is written for the above issue code?

@adrinjalali
Copy link
Member

@MuhammadNizamani you can try to look for the test around it in the project and find the file.

@ArturoAmorQ
Copy link
Member

Maybe @tuscland may have an idea on how to solve this issue.

@tuscland
Copy link
Contributor

Hi all,
It would be useful to see exactly where the snippet comes from.
If a change to the documentation is possible, I suggest the snippet is split in as many blocks as needed.

@adrinjalali
Copy link
Member

@betatim
Copy link
Member

betatim commented Aug 3, 2023

I think what happens is that the copy button selects all the text inside a <code> (or <pre>) tag, not just the visible text. One way that might fix this is to "invert" the following (and other occurrences):

<div class="highlight"><pre><code
        ><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="">python3 -m venv sklearn-venv</span
        ><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="">python -m venv sklearn-venv</span
        ><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="">python -m venv sklearn-venv</span
        ><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="">source sklearn-venv/bin/activate</span
        ><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="">source sklearn-venv/bin/activate</span
        ><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="">sklearn-venv\Scripts\activate</span
        ><span class="sk-expandable" data-packager="pip" data-venv="">pip install -U scikit-learn</span
        ><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="no">pip install -U scikit-learn</span
        ><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="no">pip install -U scikit-learn</span
        ><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="no">pip3 install -U scikit-learn</span
        ><span class="sk-expandable" data-packager="conda">conda create -n sklearn-env -c conda-forge scikit-learn</span
        ><span class="sk-expandable" data-packager="conda">conda activate sklearn-env</span
       ></code></pre></div>

to:

<div class="highlight">
<pre class="sk-expandable" data-packager="pip" data-os="linux" data-venv=""><code>
  <span>python3 -m venv sklearn-venv</span>
</pre></code>
<pre class="sk-expandable" data-packager="pip" data-os="windows" data-venv=""><code>
  <span >python -m venv sklearn-venv</span>
</pre></code>
... etc ...
</div>

so that we have one <code> per OS, instead of one <code> for all different OSs.

A related thought: how should one write these kinds of "changing text" so that screenreaders understand what is happening? Maybe by fixing that we also fix the copy button?

@tuscland
Copy link
Contributor

Hello Tim, I take a look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants