@@ -15,29 +15,27 @@ packaging styles, but this document is intended to outline a recommended style
1515that existing packages should slowly adopt. The reasoning for each decision is
1616outlined as well.
1717
18- There are several popular packaging systems. This guide covers [ Setuptools] [ ] ,
19- which is the oldest system and supports compiled extensions. If you are not
20- working on legacy code or are willing to make a larger change, other systems
21- like [ Hatch] [ ] are drastically simpler - most of this page is unneeded for those
22- systems. Even setuptools supports modern config now, though setup.py is still
23- also required for compiled packages to be supported.
24-
25- Also see the [ Python packaging guide] [ ] , especially the [ Python packaging
26- tutorial] [ ] .
18+ There are several popular packaging systems. This guide covers the old
19+ configuration style for [ Setuptools] [ ] . Unless you really need it, you should be
20+ using the modern style described in
21+ [ Simple Packaging] ( /guides/packaging-simple/ ) . The modern style is guided by
22+ Python Enhancement Proposals (PEPs), and is more stable than the
23+ setuptools-specific mechanisms that evolve over the years. This page is kept to
24+ help users with legacy code (and hopefully upgrade it).
2725
2826{: .note }
2927
30- > Raw source lives in git and has a ` setup.py ` . You _ can _ install directly from
31- > git via pip, but normally users install from distributions hosted on PyPI.
32- > There are three options: ** A)** A source package, called an SDist and has a
33- > name that ends in ` .tar.gz ` . This is a copy of the GitHub repository, stripped
34- > of a few specifics like CI files, and possibly with submodules included (if
35- > there are any). ** B)** A pure python wheel, which ends in ` .whl ` ; this is only
36- > possible if there are no compiled extensions in the library. This does _ not _
37- > contain a setup.py, but rather a ` PKG_INFO ` file that is rendered from
38- > setup.py (or from another build system). ** C) ** If not pure Python, a
39- > collection of wheels for every binary platform, generally one per supported
40- > Python version and OS as well.
28+ > Raw source lives in git and has a ` pyproject.toml ` and/or a ` setup.py ` . You
29+ > _ can _ install directly from git via pip, but normally users install from
30+ > distributions hosted on PyPI. There are three options: ** A)** A source
31+ > package, called an SDist and has a name that ends in ` .tar.gz ` . This is a copy
32+ > of the GitHub repository, stripped of a few specifics like CI files, and
33+ > possibly with submodules included (if there are any). ** B)** A pure python
34+ > wheel, which ends in ` .whl ` ; this is only possible if there are no compiled
35+ > extensions in the library. This does _ not _ contain a setup.py, but rather a
36+ > ` PKG_INFO ` file that is rendered from setup.py (or from another build system).
37+ > ** C) ** If not pure Python, a collection of wheels for every binary platform,
38+ > generally one per supported Python version and OS as well.
4139>
4240> Developer requirements (users of A or git) are generally higher than the
4341> requirements to use B or C. Poetry and optionally flit create SDists that
@@ -87,8 +85,8 @@ these "[hypermodern][]" packaging tools is growing in scientific Python
8785packages. All tools build the same wheels (and they often build setuptools
8886compliant SDists, as well).
8987
90- {% rr PP003 %} Note that ` "wheel" ` is never required; it is injected
91- automatically by setuptools only when needed .
88+ {% rr PP003 %} Note that ` "wheel" ` is never required; it was injected
89+ automatically by setuptools in older versions, and is no longer used at all .
9290
9391### Special additions: NumPy
9492
@@ -326,9 +324,12 @@ where = src
326324# extern
327325```
328326
327+ {% rr SCFG001 %} Note that all keys use underscores; using a dash will cause
328+ warnings and eventually failures.
329+
329330And, a possible `setup.py`; though in recent versions of pip, there no longer is
330- a need to include a legacy `setup.py` file, even for editable installs, unless
331- you are building extensions.
331+ a need to include a legacy `setup.py` file, even for editable installs or
332+ building extensions.
332333
333334```python
334335# !/usr/bin/env python
@@ -479,7 +480,5 @@ the app.
479480[ manifest.in ] : https://packaging.python.org/guides/using-manifest-in/
480481[ setuptools ] : https://setuptools.readthedocs.io/en/latest/userguide/index.html
481482[ setuptools cfg ] : https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html
482- [ python packaging guide ] : https://packaging.python.org
483- [ python packaging tutorial ] : https://packaging.python.org/tutorials/packaging-projects/
484483
485484<!-- prettier-ignore-end -->
0 commit comments