Skip to content

Commit

Permalink
Merge pull request #880 from marcoesters/875-rework-miniconda-docs-jinja
Browse files Browse the repository at this point in the history
Add jinja2 templates to documentation rework
  • Loading branch information
kathatherine authored Aug 21, 2023
2 parents a7fcc97 + 49dd493 commit b184cc1
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 20 deletions.
18 changes: 10 additions & 8 deletions docs/source/create_miniconda_installer_links_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
from pathlib import Path

HERE = Path(__file__).parent
OUT_FILENAME = HERE / "miniconda-installer-links.rst"
TEMPLATE_FILENAME = HERE / "miniconda-installer-links.rst.jinja2"
OUTFILES = (
"miniconda.rst",
"miniconda-other-installer-links.rst",
)
FILES_URL = "https://repo.anaconda.com/miniconda/.files.json"

# Update these!
Expand Down Expand Up @@ -152,13 +154,13 @@ def get_latest_miniconda_sizes_and_hashes():
def main():
rst_vars = get_latest_miniconda_sizes_and_hashes()

with open(TEMPLATE_FILENAME) as f:
template_text = f.read()
for outfile_name in OUTFILES:
template_file = HERE / f"{outfile_name}.jinja2"
template = Template(template_file.read_text())

template = Template(template_text)
rst_text = template.render(**rst_vars)
with open(OUT_FILENAME, "w") as f:
f.write(rst_text)
rst_text = template.render(**rst_vars)
outfile = HERE / outfile_name
outfile.write_text(rst_text)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion docs/source/miniconda-other-installer-links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
to re-generate miniconda-other-installer-links.rst
================================
Other Miniconda installer links
Latest Miniconda installer links
================================

This list of Miniconda installers is for all supported versions of Python, separated by operating system. For an archive of Miniconda versions, see https://repo.anaconda.com/miniconda/.
Expand Down
12 changes: 1 addition & 11 deletions docs/source/miniconda-other-installer-links.rst.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@
Latest Miniconda installer links
================================

This list of installers is for the latest release of Python: {{ python_version}}. For installers for older versions of Python, see the sections below. For an archive of Miniconda versions, see https://repo.anaconda.com/miniconda/.

.. csv-table:: Latest - Conda {{ conda_version }} Python {{ python_version }} released {{ release_date }}
:header: Platform,Name,SHA256 hash
:widths: 5, 10, 80
{% for os in operating_systems %}
{%- for platform in platforms[os,'latest'] %}
{% set first_column = os if loop.first else "" -%}
{{ first_column }},`Miniconda3 {{ platform['description'] }} <https://repo.anaconda.com/miniconda/Miniconda3-latest-{{ platform['suffix'] }}>`_,``{{ platform['hash'] }}``
{%- endfor -%}
{%- endfor -%}
This list of Miniconda installers is for all supported versions of Python, separated by operating system. For an archive of Miniconda versions, see https://repo.anaconda.com/miniconda/.

{%- for os in operating_systems %}
{% set heading = "{} installers".format(os) %}
Expand Down
98 changes: 98 additions & 0 deletions docs/source/miniconda.rst.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
=========
Miniconda
=========

Miniconda is a free minimal installer for conda. It is a small bootstrap version of Anaconda that includes only conda, Python, the packages they
both depend on, and a small number of other useful packages (like pip, zlib, and a few others). If you need more packages, use the ``conda install``
command to install from thousands of packages available by default in Anaconda’s public repo, or from other channels, like conda-forge or bioconda.

**Is Miniconda the right conda install for you?** The `Anaconda or Miniconda <https://docs.conda.io/projects/conda/en/stable/user-guide/install/download.html#anaconda-or-miniconda>`_ page lists some reasons why you might want one installation over the other.

.. toctree::
:maxdepth: 1

miniconda-system-requirements
miniconda-other-installer-links
miniconda-install
miniconda_release_notes
miniconda-other-resources

.. _miniconda-latest-installer-links:

Latest Miniconda installer links
================================

This list of installers is for the latest release of Python: 3.11.3. For installers for older versions of Python, see :doc:`Other installer links <miniconda-other-installer-links>`. For an archive of Miniconda versions, see https://repo.anaconda.com/miniconda/.

.. csv-table:: Latest - Conda {{ conda_version }} Python {{ python_version }} released {{ release_date }}
:header: Platform,Name,SHA256 hash
:widths: 5, 10, 80
{% for os in operating_systems %}
{%- for platform in platforms[os,'latest'] %}
{% set first_column = os if loop.first else "" -%}
{{ first_column }},`Miniconda3 {{ platform['description'] }} <https://repo.anaconda.com/miniconda/Miniconda3-latest-{{ platform['suffix'] }}>`_,``{{ platform['hash'] }}``
{%- endfor -%}
{%- endfor %}

.. _quick-command-line-install:

Quick command line install
==========================

These quick command line instructions will get you set up quickly with the latest Miniconda installer. For graphical installer (`.exe` and `.pkg`) and hash checking instructions, see :doc:`Installing Miniconda <miniconda-install>`.

.. tab-set::

.. tab-item:: Windows

These three commands quickly and quietly install the latest 64-bit version of the installer and then clean up after themselves. To install a different version or architecture of Miniconda for Windows, change the name of the ``.exe`` installer in the ``curl`` command.

.. code-block:: none

curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
start /wait "" miniconda.exe /S
del miniconda.exe

After installing, open the Anaconda Prompt (miniconda3) program to use Miniconda3. The following commands initialize conda for the cmd.exe and Powershell shells:

.. code-block:: none

conda init cmd.exe
conda init powershell

.. tab-item:: macOS

These four commands quickly and quietly install the latest M1 macOS version of the installer and then clean up after themselves. To install a different version or architecture of Miniconda for macOS, change the name of the ``.sh`` installer in the ``curl`` command.

.. code-block:: bash

mkdir -p ~/miniconda3
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~miniconda3/miniconda.sh

After installing, initialize your newly-installed Miniconda. The following commands initialize for bash and zsh shells:

.. code-block:: bash

~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh

.. tab-item:: Linux

These four commands quickly and quietly install the latest 64-bit version of the installer and then clean up after themselves. To install a different version or architecture of Miniconda for Linux, change the name of the ``.sh`` installer in the ``wget`` command.

.. code-block:: bash

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh

After installing, initialize your newly-installed Miniconda. The following commands initialize for bash and zsh shells:

.. code-block:: bash

~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh

0 comments on commit b184cc1

Please sign in to comment.