Generating python files from setup.py? #4803
-
I try to improve an old project (https://foss.heptapod.net/mercurial/mercurial-devel/) 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.
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:
I'm a bit lost with the association between setuptools commands/subcommands ( I'm a bit lost where the generated files have to be generated. For example, currently, Indeed, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @paugier this customisation is trick to implement, I will try my best to give some pointers, but I don't have all the answers:
In general it looks like the following:
In turn, each command has subcommands and dependencies on other commands, so setuptools will run a bunch of stuff in the process (e.g.
Setuptools uses I think you can get away with ignoring So assuming the file has to be generated in
The problem with Finally, the build process may run different PEP 517 using different directories as working directory. E.g. the "recommended" (less error prone) frontend implementation is to run graph LR
src[fa:fa-laptop-code source code] --> b1(fa:fa-hammer)
subgraph build process
b1 --> sdist(fa:fa-file-code sdist) --> b2(fa:fa-hammer)
b2 --> wheel(fa:fa-box wheel)
build([build dependencies]) --> b1
build([build dependencies]) --> b2
end
subgraph installation process
wheel --> pkg
pkg(fa:fa-box-open) --> inst[fa:fa-python installed packages]
runtime([runtime dependencies]) --> inst
end
classDef deps fill:#2aa198,stroke:#333
classDef env fill:#6c71c4,stroke:#333
build:::deps
runtime:::deps
|
Beta Was this translation helpful? Give feedback.
Hi @paugier this customisation is trick to implement, I will try my best to give some pointers, but I don't have all the answers:
In general it looks like the following:
get_requires_for_*
=> Internally setuptools will run theegg_info
/dist_info
command objectsprepare_metadata_for_*
=> Internally setuptools will run theegg_info
/dist_info
command objectsbuild_sdist
=> Internally setuptools will run thesdist
command objectbuild_wheel
=> Internally setuptools wi…