Hi all,
I have learned some very rudimentary Python packaging best practices and methods, reading the Python Packaging Guide and the documentation of setuptools
. I have a fairly typical Python package I want to distribute (principally to PyPi) and am using the so-called “src” packaging layout. I have a pyproject.toml
which specifies to use setuptools
as the build backend. Packaging seems to work, except that I need to process a Python template file (valid Python module code but not intended for immediate importing) which is encapsulated with a Makefile
. Obviously, just running python -m build
doesn’t get me any such processing.
How can I accomplish running e.g. make
when the wheel is built from the sdist? The sdist is otherwise perfectly valid, as it includes the template that needs processing (automatically since it’s a Python module under the “src” directory, after all) and I have also got the sdist to include the Makefile
, through a MANIFEST.in
. So while the sdist is now sound at least in terms of information it contains that is in principle sufficient to process the template, I need to somehow have the latter be triggered during building of the wheel. Am I thinking right, even?
I imagine make
is run when the wheel is built and the result of the template processing, a Python module (which make
builds beside the template in the “src” directory) is included in the wheel. There’s also the template processing script that is included in the sdist (as it should) but which I naturally want to exclude from the wheel.
I have spent considerable time with the aforementioned documents, but I find them to simultaneously be too verbose while being too vague and missing what I seem to be after (if my assumptions are even remotely valid, that is), so I have come up empty so far, except for one slimmer of hope I hold – to just use setup.py
and “do things myself” (keeping the “pyproject.toml”, though).