From e946b73a089633cf28bf56d65a5b10cbb4bc507a Mon Sep 17 00:00:00 2001 From: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com> Date: Mon, 3 Jun 2024 00:39:14 +0800 Subject: [PATCH 1/4] DOC tweak appearance of installation instructions --- doc/install.rst | 116 ++++++++++++++++++++++++++++++++---------- doc/scss/install.scss | 50 +++++++++++++++--- 2 files changed, 131 insertions(+), 35 deletions(-) diff --git a/doc/install.rst b/doc/install.rst index be924b012ce65..b289846512b06 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -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-packager - .. tab-item:: Windows - :class-label: tab-4 - :sync: os-windows + .. tab-item:: pip + :class-label: tab-6 + :sync: packager-pip Install the 64-bit version of Python 3, for instance from the `official website `__. @@ -66,9 +67,38 @@ 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: packager-conda + + Install conda using the `Anaconda or miniconda installers + `__ + or the `miniforge installers + `__ (no administrator + permission required for any of those). Then run: + + .. prompt:: powershell + + conda create -n sklearn-env -c conda-forge scikit-learn + conda activate sklearn-env + + In order to check your installation, you can use: + + .. prompt:: powershell + + 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()" + + .. tab-item:: MacOS + :class-label: tab-4 + + .. tab-set:: + :class: tabs-packager + + .. tab-item:: pip + :class-label: tab-6 + :sync: packager-pip Install Python 3 using `homebrew `_ (`brew install python`) or by manually installing the package from the `official website @@ -93,9 +123,38 @@ 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: packager-conda + + Install conda using the `Anaconda or miniconda installers + `__ + or the `miniforge installers + `__ (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()" + + .. tab-item:: Linux + :class-label: tab-4 + + .. tab-set:: + :class: tabs-packager + + .. tab-item:: pip + :class-label: tab-6 + :sync: packager-pip Python 3 is usually installed by default on most Linux distributions. To check if you have it installed, try: @@ -127,28 +186,29 @@ 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 + .. tab-item:: conda + :class-label: tab-6 + :sync: packager-conda + + Install conda using the `Anaconda or miniconda installers + `__ + or the `miniforge installers + `__ (no administrator + permission required for any of those). Then run: - Install conda using the `Anaconda or miniconda installers - `__ - or the `miniforge installers - `__ (no administrator - permission required for any of those). Then run: + .. prompt:: bash - .. prompt:: bash + conda create -n sklearn-env -c conda-forge scikit-learn + conda activate sklearn-env - conda create -n sklearn-env -c conda-forge scikit-learn - conda activate sklearn-env + In order to check your installation, you can use: - In order to check your installation, you can use: + .. prompt:: bash - .. 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()" - 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 diff --git a/doc/scss/install.scss b/doc/scss/install.scss index 92e201f00a107..554366b831fbd 100644 --- a/doc/scss/install.scss +++ b/doc/scss/install.scss @@ -6,15 +6,51 @@ * https://sass-lang.com/guide/ */ -.install-instructions .sd-tab-set > label.sd-tab-label { - margin: 0; - text-align: center; +.install-instructions .sd-tab-set { + &::before { + width: 5rem; + display: flex; + align-items: center; + font-weight: bold; + border-left: 2px solid var(--pst-color-primary); + } + + &.tabs-os::before { + content: "OS"; + } + + &.tabs-packager::before { + content: "Packager"; + } + + .sd-tab-content { + padding: 0.5rem 0 0 0; // Vertical gap between the two sets of nested tabs + background-color: transparent; + border: none; + + p:first-child { + margin-top: 1rem !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% - 5rem) / 2 - 6px) !important; + } - &.tab-6 { - width: 50% !important; + &.tab-4 { + width: calc((100% - 5rem) / 3 - 6px) !important; + } } - &.tab-4 { - width: calc(100% / 3) !important; + > input:checked + label.sd-tab-label { + transform: unset; + border: 2px solid var(--pst-color-primary); } } From e3c2018a47970749aed9a48ca13c1dde227a8226 Mon Sep 17 00:00:00 2001 From: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com> Date: Mon, 3 Jun 2024 01:06:06 +0800 Subject: [PATCH 2/4] remove the wrong border --- doc/scss/install.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/scss/install.scss b/doc/scss/install.scss index 554366b831fbd..c71ec6dfa6006 100644 --- a/doc/scss/install.scss +++ b/doc/scss/install.scss @@ -12,7 +12,6 @@ display: flex; align-items: center; font-weight: bold; - border-left: 2px solid var(--pst-color-primary); } &.tabs-os::before { From 3a5f015508bb3b3d37dfc23bc3abc56fb9033434 Mon Sep 17 00:00:00 2001 From: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com> Date: Thu, 20 Jun 2024 23:55:54 +0800 Subject: [PATCH 3/4] address comments --- doc/install.rst | 57 ++---------------------------- doc/install_instructions_conda.rst | 17 +++++++++ doc/scss/install.scss | 39 +++++++++++--------- 3 files changed, 42 insertions(+), 71 deletions(-) create mode 100644 doc/install_instructions_conda.rst diff --git a/doc/install.rst b/doc/install.rst index b289846512b06..ad32fcc7e1c77 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -71,24 +71,7 @@ Installing the latest release :class-label: tab-6 :sync: packager-conda - Install conda using the `Anaconda or miniconda installers - `__ - or the `miniforge installers - `__ (no administrator - permission required for any of those). Then run: - - .. prompt:: powershell - - conda create -n sklearn-env -c conda-forge scikit-learn - conda activate sklearn-env - - In order to check your installation, you can use: - - .. prompt:: powershell - - 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()" + .. include:: ./install_instructions_conda.rst .. tab-item:: MacOS :class-label: tab-4 @@ -127,24 +110,7 @@ Installing the latest release :class-label: tab-6 :sync: packager-conda - Install conda using the `Anaconda or miniconda installers - `__ - or the `miniforge installers - `__ (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()" + .. include:: ./install_instructions_conda.rst .. tab-item:: Linux :class-label: tab-4 @@ -190,24 +156,7 @@ Installing the latest release :class-label: tab-6 :sync: packager-conda - Install conda using the `Anaconda or miniconda installers - `__ - or the `miniforge installers - `__ (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()" + .. include:: ./install_instructions_conda.rst Using an isolated environment such as pip venv or conda makes it possible to diff --git a/doc/install_instructions_conda.rst b/doc/install_instructions_conda.rst new file mode 100644 index 0000000000000..284a6925eeba9 --- /dev/null +++ b/doc/install_instructions_conda.rst @@ -0,0 +1,17 @@ +Install conda using the `Anaconda or miniconda installers +`__ or the +`miniforge installers `__ (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()" diff --git a/doc/scss/install.scss b/doc/scss/install.scss index c71ec6dfa6006..cb9c5357dea57 100644 --- a/doc/scss/install.scss +++ b/doc/scss/install.scss @@ -7,21 +7,6 @@ */ .install-instructions .sd-tab-set { - &::before { - width: 5rem; - display: flex; - align-items: center; - font-weight: bold; - } - - &.tabs-os::before { - content: "OS"; - } - - &.tabs-packager::before { - content: "Packager"; - } - .sd-tab-content { padding: 0.5rem 0 0 0; // Vertical gap between the two sets of nested tabs background-color: transparent; @@ -40,11 +25,11 @@ border-radius: 5px !important; &.tab-6 { - width: calc((100% - 5rem) / 2 - 6px) !important; + width: calc((100% - var(--tab-caption-width, 0%)) / 2 - 6px) !important; } &.tab-4 { - width: calc((100% - 5rem) / 3 - 6px) !important; + width: calc((100% - var(--tab-caption-width, 0%)) / 3 - 6px) !important; } } @@ -52,4 +37,24 @@ 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"; + } + } } From e265128c0f6c9f8904719685f4d0e9374c913c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Fri, 21 Jun 2024 06:00:46 +0200 Subject: [PATCH 4/4] packager -> package-manager --- doc/install.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/install.rst b/doc/install.rst index ad32fcc7e1c77..3d11b506473ee 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -39,11 +39,11 @@ Installing the latest release :class-label: tab-4 .. tab-set:: - :class: tabs-packager + :class: tabs-package-manager .. tab-item:: pip :class-label: tab-6 - :sync: packager-pip + :sync: package-manager-pip Install the 64-bit version of Python 3, for instance from the `official website `__. @@ -69,7 +69,7 @@ Installing the latest release .. tab-item:: conda :class-label: tab-6 - :sync: packager-conda + :sync: package-manager-conda .. include:: ./install_instructions_conda.rst @@ -77,11 +77,11 @@ Installing the latest release :class-label: tab-4 .. tab-set:: - :class: tabs-packager + :class: tabs-package-manager .. tab-item:: pip :class-label: tab-6 - :sync: packager-pip + :sync: package-manager-pip Install Python 3 using `homebrew `_ (`brew install python`) or by manually installing the package from the `official website @@ -108,7 +108,7 @@ Installing the latest release .. tab-item:: conda :class-label: tab-6 - :sync: packager-conda + :sync: package-manager-conda .. include:: ./install_instructions_conda.rst @@ -116,11 +116,11 @@ Installing the latest release :class-label: tab-4 .. tab-set:: - :class: tabs-packager + :class: tabs-package-manager .. tab-item:: pip :class-label: tab-6 - :sync: packager-pip + :sync: package-manager-pip Python 3 is usually installed by default on most Linux distributions. To check if you have it installed, try: @@ -154,7 +154,7 @@ Installing the latest release .. tab-item:: conda :class-label: tab-6 - :sync: packager-conda + :sync: package-manager-conda .. include:: ./install_instructions_conda.rst