-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
Ensure we can detect simple "computed" Python package versions in setup.py #2263
Comments
We have a possible solution with this https://github.com/pyserial/pyserial/blob/d867871e6aa333014a77498b4ac96fdd1d3bf1d8/setup.py#L34
which is MIT-licensed https://github.com/pyserial/pyserial/blob/master/LICENSE.txt |
Using the list of test packages listed in the ticket description, with this:
we get these results package-scan.json.txt A more feature scan with:
has these results |
Another extra possibility would be to ensure that when we detect: PKG-INFO and a setup.py at the same level in an sdist we merge the package records in a single one, for instance:
This would not replace the need to detect dunder versions, but when we have an sdist, PKG-INFO contains an already resolved version (including from running any code and dynamic lookup of a dunder version) |
I have a patch that needs testing inspired by @rob-smallshire and heavily modified from:
It gets things mostly right for all these
|
* use __version__ and related conventions to improve license detection in setup.py scripts. Most detectable version that are fetched from an attribute are now detected. Some complex cases cannot be detected as they do not use conventions. * also add a "Party" when only the email is present. Signed-off-by: Philippe Ombredanne <[email protected]>
Improve setup.py version collection #2263
Description
It is a common pattern to have a computed version for a setup.py.
This means that we cannot detect the version in this case. This is even the case in the current scancode-toolkit.
See for instance:
https://github.com/nexB/scancode-toolkit/blob/c3c92ff121632ea5db835f1c460c7d483a91a5d6/setup.py#L101
In simpler cases we should be able to detect the convention of using a "dunder"
__version__
field such as in six:version=six.__version__
is used__version__
is defined https://github.com/benjaminp/six/blob/c0be8815d13df45b6ae471c4c436cce8c192245d/six.py#L32We also need to clean up the mess we are about to create with the new break out in repos for #2233 and the use of setuptools_scm that would completely remove any version references from setup.py/.cfg https://github.com/nexB/typecode/blob/a337e7484ec563f47c2e6d3ce650448d69b13549/setup.cfg
See aboutcode-org/typecode#3
One approach to a solution may be in the many possible tools listed in #253
See also https://packaging.python.org/guides/single-sourcing-package-version/
A good test is with this list of download URLs:
The text was updated successfully, but these errors were encountered: