-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version "attr" method in setup.py builds dist names incorrectly #2492
Comments
The built distribution file was observed to have a strange string in place of where a version string was expected. The issue has been reported to the setuptools project: pypa/setuptools#2492 The installation file is named as expected when using setup.cfg. Signed-off-by: Alex Nelson <[email protected]>
The built distribution file was observed to have a strange string in place of where a version string was expected. The issue has been reported to the setuptools project: pypa/setuptools#2492 The installation file is named as expected when using setup.cfg. Signed-off-by: Alex Nelson <[email protected]>
The syntax you see of I can see how you might have expected setup.py to accept those parameters as well, but because these systems evolved over time, they're not based on the same language or design. Why not just rely on setup.cfg, which I would consider more mature and preferable to the setup.py usage? |
Thank you for the reply, @jaraco . I was not aware of the relative maturity, or evolutionary order, of setup.cfg versus setup.py. I can appreciate that they had grown from different specifications, but I'm not aware of where in the documentation they are documented to behave differently. I was surprised when I'd initially tried the "Config style" of I'm fine with relying on setup.cfg. (You might see from other tags in this Issue that I've already switched over to doing so.) Future users would benefit from either:
I wouldn't be offended if this Issue were closed with no action because my issue is apparently expected behavior. Expected behavior turned out to be a surprise, so I think it'd be helpful if something changed. |
I do believe that #2497 will address option 3. I'd also welcome a PR to address option 2 by warning in the docs that none of the declarative config indicators are supported in parameters to setup.py. |
This patch is part of addressing setuptools issue 2492: pypa/setuptools#2492 The code in this Note block was found to not apply to equivalently-named features in setup.py. After discussion on the above issue, a project maintainer noted this behavior was expected. This patch adds documentation of expected behavior close to where it would be discovered by somebody who stumbled upon the attr: feature, but might not know the background on directives and setup.cfg vs. setup.py.
@jaraco I've filed packaging docs PR 806 (pypa/packaging.python.org#806) to address option 2. It might need a little help. If you think #2497 here will address option 3, I'm happy with you closing this Issue when you think it's appropriate. |
Hello,
Currently, the "Single-sourcing the package version" page provides several methods for storing a package's version in one location. The first includes a "modern" technique as of setuptools 46.4.0, describing this mechanism for use in
setup.cfg
:I was pleasantly surprised to find the
setuptools.setup()
call would also accept (read: not halt in an error state) this string in itsversion=
parameter. However, I found none of the distribution files build with the correct name embedded.I have set up a repository to test this issue here.
Setup
Given a package
example_pkg
, thesetup.py
program includes these lines:A wheel is built with this command:
Expected output
I expect the generated file to be
dist/example_pkg-0.0.1-py3-none-any.whl
. This is the effect when thesetup()
call is written like this:Current output
The output file is currently errantly named
dist/example_pkg-attr_.example_pkg._version_-py3-none-any.whl
.Reproduction instructions
make
. The errant file is in the directoryusing_setup_py/dist
. A functioning example of the same version retrieval syntax is inusing_setup_cfg/
.As a last comment, it seems a bit ironic that the configuration file currently has more programmatic access to code variables than the setup script. Shouldn't these two methods behave the same? Or, is there a specification somewhere I've missed?
The text was updated successfully, but these errors were encountered: