Skip to content

Commit 7228606

Browse files
authored
Merge pull request #337 from AaltoSciComp/mention-new-packaging-tools
mention new packaging tools
2 parents 1a7e059 + c2dd64f commit 7228606

File tree

1 file changed

+51
-4
lines changed

1 file changed

+51
-4
lines changed

content/packaging.rst

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,29 @@ Exercise 1
142142
To test a local pip install:
143143

144144
- Create a new folder outside of our example project
145-
- Create a new virtual environment (:ref:`dependency_management`)
145+
- Create a new virtual environment and activate it (more on this in :ref:`dependency_management`)
146+
147+
.. hint:: To create and activate a virtual environment
148+
:class: dropdown
149+
150+
.. tabs::
151+
152+
.. tab:: Unix/macOS
153+
154+
.. code-block:: bash
155+
156+
python -m venv .venv
157+
source .venv/bin/activate
158+
which python
159+
160+
.. tab:: Windows
161+
162+
.. code-block:: bat
163+
164+
python -m venv .venv
165+
.venv\Scripts\activate
166+
where python
167+
146168
- Install the example package from the project folder
147169
into the new environment::
148170

@@ -258,6 +280,9 @@ Once this is done, create yet another virtual environment and try to install fro
258280
$ python3 -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ calculator-myname
259281
$ deactivate
260282
283+
If you upload packages to PyPI or test PyPI often you can create an API token and
284+
`save it in the .pypirc file <https://packaging.python.org/en/latest/specifications/pypirc/#common-configurations>`__.
285+
261286
Tools that simplify sharing via PyPI
262287
------------------------------------
263288

@@ -268,13 +293,28 @@ confuse too much. If you web-search this, you will also see that recently the
268293
trend goes towards using ``pyproject.toml`` as more general
269294
alternative to the previous ``setup.py``.
270295

271-
There are at least two tools which try to make the packaging and PyPI interaction easier:
296+
There are at least five tools which try to make the packaging and PyPI interaction easier:
272297

298+
- `uv <https://docs.astral.sh/uv/>`__
299+
- `PDM <https://pdm-project.org/>`__
300+
- `Hatch <https://hatch.pypa.io/latest/>`__
273301
- `Poetry <https://python-poetry.org/>`__
274302
- `Flit <https://flit.pypa.io/>`__
275303

276-
If you upload packages to PyPI or test PyPI often you can create an API token and
277-
`save it in the .pypirc file <https://packaging.python.org/en/latest/specifications/pypirc/#common-configurations>`__.
304+
Today, due to standards such as ``pyproject.toml`` and ``pylock.toml``, to specify the
305+
package metadata and dependency lock file respectively, the above are largely
306+
cross-compatible amongst each other and with ``pip``.
307+
308+
.. figure:: https://www.pyopensci.org/python-package-guide/_images/python-package-tools-decision-tree.png
309+
:alt: Flowchart to help decide on a packaging tool
310+
311+
Credits: pyOpenSci's Python Package Guide licensed CC-BY-SA 4.0
312+
313+
The properties of the project and your development requirements may determine which packaging
314+
tool suits you. Use the above decision tree from pyOpenSci_ to help make that choice.
315+
316+
317+
.. _pyOpenSci: https://www.pyopensci.org/python-package-guide/package-structure-code/python-package-build-tools.html
278318

279319
Building a conda package and share it
280320
-------------------------------------
@@ -382,6 +422,13 @@ library for research software.
382422

383423
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 <https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/channels.html>`__ (see below).
384424

425+
Tools that simplify sharing conda packages
426+
------------------------------------------
427+
428+
- `pixi <https://pixi.sh>`__ is package management tool to cover all features of conda, along with
429+
ability to initialize and package new projects.
430+
- `rattler-build <https://rattler.build>`__ is a build tool which combines the functionalities of
431+
``conda grayskull``, ``conda build`` and allows you to also publish packages.
385432

386433

387434
Publishing a python package

0 commit comments

Comments
 (0)