Open smartYSC opened 11 months ago
Hi @smartYSC, thank you very much for reporting this.
By all means please do consider support for config_settings
in setuptools a feature that is highly unstable.
This is a complicated topic and I feel that we are kind of steering in circles: every time that we try to improve something that is suggested by someone we change something else that breaks things for other users...
Would something like the following work for you?
echo -e "[egg_info]\ntag_build=.dev+foo\n" > /tmp/build_opts.cfg
export DIST_EXTRA_CONFIG=/tmp/build_opts.cfg
python -m build
To me, the proper fix is to move https://github.com/pypa/setuptools/discussions/4083 ahead, but I have not got much feedback on that, nor people willing to champion the implementation.
Thank you for the immediate response!
I shortened this to:
echo -e "[egg_info]\ntag_build=.dev+foo\n" > /tmp/build_opts.cfg
DIST_EXTRA_CONFIG=/tmp/build_opts.cfg python -m build
And it works fine! I will change our build process accordingly.
Actually I cannot really help with the underlying problem you pointed out as I do not know (that) much about Python packaging.
Is your solution just a workaround that may break again in the (forseeable) future once #4083 is resolved? Or is this the "proper" way to provide build options?
Keep up the good work, I really appreciate that you are trying to solve the many issues outdated/deprecated Python packaging has!
I believe that right now the solution I pointed out is the most stable way of achieving the task you proposed. I don't think it will stop working even after #4083 is implemented.
It will stop working once we remove egg_info
from setuptools
, though (probably going to be replaced by dist_info
because the word egg
is a reference to an old unsupported format). But that is far ahead in the future.
Let's rename this topic and change categories so more people can find help in the future.
I also met this problem. For now, I plan to work around that by pinning setuptools<69.0.0
.
Our scenario is: I need to pack my package to a new "dev" version every time I run a script in a pipeline without manually updating metadata file, and I hope to only use pyproject.toml
without introducing setup.py
or setup.cfg
to my project.
Currently the only way we found is to use python build module with --build-option=egg_info
and --build-option=--tag-build=dev123456
parameter, @abravalheri do you have suggestions how should we pack with dynamic versions after #4083?
Hi @junshi356, please see my previous comment about the most stable solution we have right now.
Note that the suggestion uses a throw-away file not included in the dist.
setuptools version
setuptools===69.0.0
Python version
Python 3.8.10
OS
Ubuntu 20.04 in WSL
Additional environment information
No response
Description
We are building test packages for branches and tag them as described here.
The build is executed with
build===1.0.3
like this:The equivalent command for
setup.py
would be something like this:Building with
setup.py
works correctly insetuptools===68.2.2
AND69.0.0
. Building withbuild
works in68.2.2
but fails in69.0.0
. This is like due to the change of--build-option
introduced in https://github.com/pypa/setuptools/pull/4079.However, I cannot find a way to pass the
egg_info --tag-build=.dev+foo
intosetuptools===69.0.0
viabuild
.I am not totally sure if this is a bug (because the change is documented) or if this is even an issue with
setuptools
orbuild
. However, the interaction between both tools broke for us :-(Is there a way to still tag a build through
build
when I cannot provide this as abuild-option
anymore?Expected behavior
Building with
setuptools
viabuild
should allow to tag builds.How to Reproduce
Inside some project buildable with
build
(pyproject.toml
andsetup.py
both work)python -m venv venv
source venv/bin/activate
pip install build setuptools==68.2.2 wheel
python -m build -C--build-option=egg_info -C--tag-build=.dev+foo -n
-> WORKSpip install setuptools=69.0.0
python -m build -C--build-option=egg_info -C--tag-build=.dev+foo -n
-> FAILSNote that the example runs
build
with option-n
to be able to change the version ofsetuptools
by using a non-isolated build. Running without-n
will always fail as it installssetuptools==69.0.0
in its own temporary virtual environment.Output
The error message printed is also somewhat misleading...