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

Skip to content

Commit fe97533

Browse files
Charlie-XIAOlesteve
authored andcommitted
DOC tweak appearance of installation instructions (#29160)
Co-authored-by: Loïc Estève <[email protected]>
1 parent 70ac14b commit fe97533

File tree

3 files changed

+105
-39
lines changed

3 files changed

+105
-39
lines changed

doc/install.rst

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ Installing the latest release
3333
.. div:: install-instructions
3434

3535
.. tab-set::
36+
:class: tabs-os
3637

37-
.. tab-item:: pip
38-
:class-label: tab-6
39-
:sync: packager-pip
38+
.. tab-item:: Windows
39+
:class-label: tab-4
4040

4141
.. tab-set::
42+
:class: tabs-package-manager
4243

43-
.. tab-item:: Windows
44-
:class-label: tab-4
45-
:sync: os-windows
44+
.. tab-item:: pip
45+
:class-label: tab-6
46+
:sync: package-manager-pip
4647

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

69-
.. tab-item:: macOS
70-
:class-label: tab-4
71-
:sync: os-macos
70+
.. tab-item:: conda
71+
:class-label: tab-6
72+
:sync: package-manager-conda
73+
74+
.. include:: ./install_instructions_conda.rst
75+
76+
.. tab-item:: MacOS
77+
:class-label: tab-4
78+
79+
.. tab-set::
80+
:class: tabs-package-manager
81+
82+
.. tab-item:: pip
83+
:class-label: tab-6
84+
:sync: package-manager-pip
7285

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

96-
.. tab-item:: Linux
97-
:class-label: tab-4
98-
:sync: os-linux
109+
.. tab-item:: conda
110+
:class-label: tab-6
111+
:sync: package-manager-conda
112+
113+
.. include:: ./install_instructions_conda.rst
114+
115+
.. tab-item:: Linux
116+
:class-label: tab-4
117+
118+
.. tab-set::
119+
:class: tabs-package-manager
120+
121+
.. tab-item:: pip
122+
:class-label: tab-6
123+
:sync: package-manager-pip
99124

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

130-
.. tab-item:: conda
131-
:class-label: tab-6
132-
:sync: packager-conda
133-
134-
Install conda using the `Anaconda or miniconda installers
135-
<https://docs.conda.io/projects/conda/en/latest/user-guide/install/>`__
136-
or the `miniforge installers
137-
<https://github.com/conda-forge/miniforge#miniforge>`__ (no administrator
138-
permission required for any of those). Then run:
139-
140-
.. prompt:: bash
141-
142-
conda create -n sklearn-env -c conda-forge scikit-learn
143-
conda activate sklearn-env
144-
145-
In order to check your installation, you can use:
155+
.. tab-item:: conda
156+
:class-label: tab-6
157+
:sync: package-manager-conda
146158

147-
.. prompt:: bash
159+
.. include:: ./install_instructions_conda.rst
148160

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

153162
Using an isolated environment such as pip venv or conda makes it possible to
154163
install a specific version of scikit-learn with pip or conda and its dependencies

doc/install_instructions_conda.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Install conda using the `Anaconda or miniconda installers
2+
<https://docs.conda.io/projects/conda/en/latest/user-guide/install/>`__ or the
3+
`miniforge installers <https://github.com/conda-forge/miniforge#miniforge>`__ (no
4+
administrator permission required for any of those). Then run:
5+
6+
.. prompt:: bash
7+
8+
conda create -n sklearn-env -c conda-forge scikit-learn
9+
conda activate sklearn-env
10+
11+
In order to check your installation, you can use:
12+
13+
.. prompt:: bash
14+
15+
conda list scikit-learn # show scikit-learn version and location
16+
conda list # show all installed packages in the environment
17+
python -c "import sklearn; sklearn.show_versions()"

doc/scss/install.scss

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,55 @@
66
* https://sass-lang.com/guide/
77
*/
88

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

13-
&.tab-6 {
14-
width: 50% !important;
15+
p:first-child {
16+
margin-top: 1rem !important;
17+
}
1518
}
1619

17-
&.tab-4 {
18-
width: calc(100% / 3) !important;
20+
> label.sd-tab-label {
21+
margin: 0 3px; // Horizontal gap within the same set of tabs
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
border-radius: 5px !important;
26+
27+
&.tab-6 {
28+
width: calc((100% - var(--tab-caption-width, 0%)) / 2 - 6px) !important;
29+
}
30+
31+
&.tab-4 {
32+
width: calc((100% - var(--tab-caption-width, 0%)) / 3 - 6px) !important;
33+
}
34+
}
35+
36+
> input:checked + label.sd-tab-label {
37+
transform: unset;
38+
border: 2px solid var(--pst-color-primary);
39+
}
40+
41+
// Show tab captions on large screens
42+
@media screen and (min-width: 960px) {
43+
--tab-caption-width: 20%;
44+
45+
&::before {
46+
width: var(--tab-caption-width);
47+
display: flex;
48+
align-items: center;
49+
font-weight: bold;
50+
}
51+
52+
&.tabs-os::before {
53+
content: "Operating System";
54+
}
55+
56+
&.tabs-packager::before {
57+
content: "Package Manager";
58+
}
1959
}
2060
}

0 commit comments

Comments
 (0)