I try to improve an old project (mercurial / mercurial-devel · GitLab) with a pyproject.toml and a setup.py using setuptools.
I’d like to know what are the good practices for generation of files at different stages.
- Before the sdist build (actually before setuptools uses
MANIFEST.in
because this is for dynamic generation of this file) - During sdist build (translation,
__version__.py
,hgext/__index__.py
) - During wheel build (
mercurial/__modulepolicy__.py
)
Currently, these file generations are called through setuptools commands/subcommands in setup.py and also with Makefile targets.
I’d like to know if this is still the best methods when using setuptools through PEP 517.
I’d like them to work fine in different cases:
pip install .
pip install --editable .
python -m build
(produce sdist and wheel from the sdist)
I’m a bit lost with the association between setuptools commands/subcommands (build_py
, install
, etc.) and the PEP 517 functions (defined for setuptools in setuptools/setuptools/build_meta.py at main · pypa/setuptools · GitHub).
I’m a bit lost where the generated files have to be generated. For example, currently, mercurial/__modulepolicy__.py
(produced during build_py
) is produced in the wheel but not for the editable install.