Open jaraco opened 3 months ago
Another reason to be cautious about adopting setuptools_scm is because it also implies the scm-based file finder, so adopting it will supersede (or augment) MANIFEST.in, and I'm unaware of a way to opt out of that behavior.
Another reason to be cautious about adopting setuptools_scm is because it would need to be declared as a build-time dependency. It would be inappropriate to declare it as a runtime dependency, as that would cause that plugin (and its implicit behaviors) to be employed for every project building with Setuptools, which would be inappropriate. So it must be declared as a build-time dependency (and thus only used when building setuptools).
Since setuptools_scm is [built by setuptools](), adding even a build-time dependency on it will also trigger the bootstrap problem, so any solution probably needs to vendor setuptools_scm in such a way that it's only added to the sys.path when Setuptools is building itself.
I was thinking that there might be a different approach (more lightweight) for adopting setuptools-scm
without creating the build-cycle, for example by running python -m setuptools_scm > some-file
in the CI job... This way we benefit from the setuptools-scm
, but when someone tries to build setuptools from the sdist they would simply fallback to the version in PKG-INFO
(or other file generated by tools/finalize.py
)...
Would this be an acceptable approach? (This would avoid problems with vendoring).
I was thinking that there might be a different approach (more lightweight) for adopting
setuptools-scm
without creating the build-cycle, for example by runningpython -m setuptools_scm > some-file
in the CI job... This way we benefit from thesetuptools-scm
, but when someone tries to build setuptools from the sdist they would simply fallback to the version inPKG-INFO
(or other file generated bytools/finalize.py
)...Would this be an acceptable approach? (This would avoid problems with vendoring).
Interesting ideas. I am interested in solving more than just the issues with building sdist. Plus, I feel like we already have a methodology for vendoring, which we can apply to this approach. I also feel like we're getting rather close to a solution to the bootstrap problem, so maybe setuptools can simply declare the build-time dependency soon, so I don't want to invest too much in a new, separate methodology.
I very much like the concept of not relying on setuptools_scm in the sdist. In coherent-oss/system#12, I'm considering taking that concept to the extreme. In a different build system, I'm considering having the build-to-sdist step have all of the complicated logic with dependencies an all, but then generate an sdist reliant on flit-core with no dependencies. That approach doesn't generalize to something like setuptools, which performs important transformations (compiling) at the build stage, but it does illustrate a similar concept (materialize a lot of the dynamic behaviors in the generation of the sdist and don't rely on those dynamic behaviors when building the wheel). Setuptools could implement a similar approach with versions (materialize them in the sdist) and have a limited set of dependencies when compiling an sdist to a wheel (i.e. rely on PKG-INFO instead of setuptools_scm). This difference in dependencies could potentially be advertised in the PEP 517 get_requires_for_build_sdist
vs. get_requires_for_build_wheel
.
All of these ideas are rather new (incorporating setuptools_scm, alternate approaches), so I'm going to take some time and explore lots of options. I'd like to see what an approach with python -m setuptools_scm
(or similar) might do. Please feel encouraged to draft an implementation and propose the change, especially if you feel that approach beats what's drafted in #4532 (which is broken atm).
I'd be happy to provide a opt out for file finders if setuptools provided a way to communicate with them, currently its simply not safely possible without gruesome hacks
I haven't previously articulated my goals for this effort, so let me do so now:
I was thinking that there might be a different approach (more lightweight) for adopting
setuptools-scm
without creating the build-cycle, for example by runningpython -m setuptools_scm > some-file
in the CI job... This way we benefit from thesetuptools-scm
, but when someone tries to build setuptools from the sdist they would simply fallback to the version inPKG-INFO
(or other file generated bytools/finalize.py
)...Would this be an acceptable approach? (This would avoid problems with vendoring).
This doesn't sound fun to distros wanting to build from git that need to do bootstrap build setuptools->setuptools-scm without having setuptools priorhand.
It was not documented here but in my opinion (packager hat on) the biggest problem with tag_date is that setuptools built from git tag is not reproducible without hacking at setup.cfg.
For a long time, Setuptools has taken advantage of the
--tag-build
and--tag-date
options of the build via setup.cfg to make builds outside of the release process produce version numbers like72.1.0.post20240731
, so they're not uploaded and are distinct from their released counterparts.This approach has the unfortunate effect, however, of making setuptools unable to be built from the repo without incorporating that workaround.
For example:
So even though the project is built from a tagged release, it produces the post release tag.
Moreover, there are better ways to handle this situation, such as setuptools_scm, which should be viable now that Setuptools has natural dependencies (vendored or not).
I'd like to take a two-stage approach:
The first stage gets the project to a state where tagged releases can be built and reflect their number. It also means that untagged commits will be built with that same version, but that seems like a small price to pay.
Maybe these changes can both happen in the same release, but I want to be able to back out stage 2 if it causes undue disruption.