Skip to content

DOC tweak appearance of installation instructions #29160

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

Merged
merged 7 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 41 additions & 32 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ Installing the latest release
.. div:: install-instructions

.. tab-set::
:class: tabs-os

.. tab-item:: pip
:class-label: tab-6
:sync: packager-pip
.. tab-item:: Windows
:class-label: tab-4

.. tab-set::
:class: tabs-package-manager

.. tab-item:: Windows
:class-label: tab-4
:sync: os-windows
.. tab-item:: pip
:class-label: tab-6
:sync: package-manager-pip

Install the 64-bit version of Python 3, for instance from the
`official website <https://www.python.org/downloads/windows/>`__.
Expand All @@ -66,9 +67,21 @@ Installing the latest release
python -m pip freeze # show all installed packages in the environment
python -c "import sklearn; sklearn.show_versions()"

.. tab-item:: macOS
:class-label: tab-4
:sync: os-macos
.. tab-item:: conda
:class-label: tab-6
:sync: package-manager-conda

.. include:: ./install_instructions_conda.rst

.. tab-item:: MacOS
:class-label: tab-4

.. tab-set::
:class: tabs-package-manager

.. tab-item:: pip
:class-label: tab-6
:sync: package-manager-pip

Install Python 3 using `homebrew <https://brew.sh/>`_ (`brew install python`)
or by manually installing the package from the `official website
Expand All @@ -93,9 +106,21 @@ Installing the latest release
python -m pip freeze # show all installed packages in the environment
python -c "import sklearn; sklearn.show_versions()"

.. tab-item:: Linux
:class-label: tab-4
:sync: os-linux
.. tab-item:: conda
:class-label: tab-6
:sync: package-manager-conda

.. include:: ./install_instructions_conda.rst

.. tab-item:: Linux
:class-label: tab-4

.. tab-set::
:class: tabs-package-manager

.. tab-item:: pip
:class-label: tab-6
:sync: package-manager-pip

Python 3 is usually installed by default on most Linux distributions. To
check if you have it installed, try:
Expand Down Expand Up @@ -127,28 +152,12 @@ Installing the latest release
python3 -m pip freeze # show all installed packages in the environment
python3 -c "import sklearn; sklearn.show_versions()"

.. tab-item:: conda
:class-label: tab-6
:sync: packager-conda

Install conda using the `Anaconda or miniconda installers
<https://docs.conda.io/projects/conda/en/latest/user-guide/install/>`__
or the `miniforge installers
<https://github.com/conda-forge/miniforge#miniforge>`__ (no administrator
permission required for any of those). Then run:

.. prompt:: bash

conda create -n sklearn-env -c conda-forge scikit-learn
conda activate sklearn-env

In order to check your installation, you can use:
.. tab-item:: conda
:class-label: tab-6
:sync: package-manager-conda

.. prompt:: bash
.. include:: ./install_instructions_conda.rst

conda list scikit-learn # show scikit-learn version and location
conda list # show all installed packages in the environment
python -c "import sklearn; sklearn.show_versions()"

Using an isolated environment such as pip venv or conda makes it possible to
install a specific version of scikit-learn with pip or conda and its dependencies
Expand Down
17 changes: 17 additions & 0 deletions doc/install_instructions_conda.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Install conda using the `Anaconda or miniconda installers
<https://docs.conda.io/projects/conda/en/latest/user-guide/install/>`__ or the
`miniforge installers <https://github.com/conda-forge/miniforge#miniforge>`__ (no
administrator permission required for any of those). Then run:

.. prompt:: bash

conda create -n sklearn-env -c conda-forge scikit-learn
conda activate sklearn-env

In order to check your installation, you can use:

.. prompt:: bash

conda list scikit-learn # show scikit-learn version and location
conda list # show all installed packages in the environment
python -c "import sklearn; sklearn.show_versions()"
54 changes: 47 additions & 7 deletions doc/scss/install.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,55 @@
* https://sass-lang.com/guide/
*/

.install-instructions .sd-tab-set > label.sd-tab-label {
margin: 0;
text-align: center;
.install-instructions .sd-tab-set {
.sd-tab-content {
padding: 0.5rem 0 0 0; // Vertical gap between the two sets of nested tabs
background-color: transparent;
border: none;

&.tab-6 {
width: 50% !important;
p:first-child {
margin-top: 1rem !important;
}
}

&.tab-4 {
width: calc(100% / 3) !important;
> label.sd-tab-label {
margin: 0 3px; // Horizontal gap within the same set of tabs
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px !important;

&.tab-6 {
width: calc((100% - var(--tab-caption-width, 0%)) / 2 - 6px) !important;
}

&.tab-4 {
width: calc((100% - var(--tab-caption-width, 0%)) / 3 - 6px) !important;
}
}

> input:checked + label.sd-tab-label {
transform: unset;
border: 2px solid var(--pst-color-primary);
}

// Show tab captions on large screens
@media screen and (min-width: 960px) {
--tab-caption-width: 20%;

&::before {
width: var(--tab-caption-width);
display: flex;
align-items: center;
font-weight: bold;
}

&.tabs-os::before {
content: "Operating System";
}

&.tabs-packager::before {
content: "Package Manager";
}
}
}