From 896aefeb7019f99e4e784dd1d633f749ba0bee0c Mon Sep 17 00:00:00 2001 From: "Ashwin V. Mohanan" Date: Wed, 26 Nov 2025 21:34:57 +0100 Subject: [PATCH 1/4] Mention uv, pdm --- content/packaging.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/content/packaging.rst b/content/packaging.rst index 58200dcb..525bce9a 100644 --- a/content/packaging.rst +++ b/content/packaging.rst @@ -258,6 +258,9 @@ Once this is done, create yet another virtual environment and try to install fro $ python3 -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ calculator-myname $ deactivate +If you upload packages to PyPI or test PyPI often you can create an API token and +`save it in the .pypirc file `__. + Tools that simplify sharing via PyPI ------------------------------------ @@ -268,13 +271,18 @@ confuse too much. If you web-search this, you will also see that recently the trend goes towards using ``pyproject.toml`` as more general alternative to the previous ``setup.py``. -There are at least two tools which try to make the packaging and PyPI interaction easier: +There are at least five tools which try to make the packaging and PyPI interaction easier: +- `uv `__ +- `PDM `__ +- `Hatch `__ - `Poetry `__ - `Flit `__ -If you upload packages to PyPI or test PyPI often you can create an API token and -`save it in the .pypirc file `__. +Today, due to standards such as ``pyproject.toml`` and ``pylock.toml``, to specify the +package metadata and dependency lock file respectively, the four tools are largely +cross-compatible amongst themselves and with ``pip``. + Building a conda package and share it ------------------------------------- From 483cf9932b7e42666c581caa1a256a90466c5c80 Mon Sep 17 00:00:00 2001 From: "Ashwin V. Mohanan" Date: Wed, 26 Nov 2025 21:47:59 +0100 Subject: [PATCH 2/4] Mention pixi and rattler-build --- content/packaging.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/packaging.rst b/content/packaging.rst index 525bce9a..2fcab12a 100644 --- a/content/packaging.rst +++ b/content/packaging.rst @@ -390,6 +390,13 @@ library for research software. To be able to share and install your local conda package anywhere (on other platforms), you would need to upload it to a `conda channel `__ (see below). +Tools that simplify sharing conda packages +------------------------------------------ + +- `pixi `__ is package management tool to cover all features of conda, along with + ability to initialize and package new projects. +- `rattler-build `__ is a build tool which combines the functionalities of + ``conda grayskull``, ``conda build`` and allows you to also publish packages. Publishing a python package From 906d2407693254917f81bdb54f2f157f39fd5be6 Mon Sep 17 00:00:00 2001 From: "Ashwin V. Mohanan" Date: Wed, 26 Nov 2025 22:00:46 +0100 Subject: [PATCH 3/4] Embed infographic from pyOpenSci --- content/packaging.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/content/packaging.rst b/content/packaging.rst index 2fcab12a..503b4f4f 100644 --- a/content/packaging.rst +++ b/content/packaging.rst @@ -280,9 +280,19 @@ There are at least five tools which try to make the packaging and PyPI interacti - `Flit `__ Today, due to standards such as ``pyproject.toml`` and ``pylock.toml``, to specify the -package metadata and dependency lock file respectively, the four tools are largely -cross-compatible amongst themselves and with ``pip``. +package metadata and dependency lock file respectively, the above are largely +cross-compatible amongst each other and with ``pip``. +.. figure:: https://www.pyopensci.org/python-package-guide/_images/python-package-tools-decision-tree.png + :alt: Flowchart to help decide on a packaging tool + + Credits: pyOpenSci's Python Package Guide licensed CC-BY-SA 4.0 + + The properties of the project and your development requirements may determine which packaging + tool suits you. Use the above decision tree from pyOpenSci_ to help make that choice. + + +.. _pyOpenSci: https://www.pyopensci.org/python-package-guide/package-structure-code/python-package-build-tools.html Building a conda package and share it ------------------------------------- From c2dd64f2dc58d7f645fcf3f37988aeeb16dd6bc8 Mon Sep 17 00:00:00 2001 From: "Ashwin V. Mohanan" Date: Wed, 26 Nov 2025 22:26:10 +0100 Subject: [PATCH 4/4] Hint to create a venv --- content/packaging.rst | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/content/packaging.rst b/content/packaging.rst index 503b4f4f..fd917a42 100644 --- a/content/packaging.rst +++ b/content/packaging.rst @@ -142,7 +142,29 @@ Exercise 1 To test a local pip install: - Create a new folder outside of our example project - - Create a new virtual environment (:ref:`dependency_management`) + - Create a new virtual environment and activate it (more on this in :ref:`dependency_management`) + + .. hint:: To create and activate a virtual environment + :class: dropdown + + .. tabs:: + + .. tab:: Unix/macOS + + .. code-block:: bash + + python -m venv .venv + source .venv/bin/activate + which python + + .. tab:: Windows + + .. code-block:: bat + + python -m venv .venv + .venv\Scripts\activate + where python + - Install the example package from the project folder into the new environment::