-
Notifications
You must be signed in to change notification settings - Fork 14
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
Validate SPDX license expressions #217
Validate SPDX license expressions #217
Conversation
|
src/validate_pyproject/formats.py
Outdated
# let's try setuptools vendored version | ||
from setuptools._vendor.packaging import ( # type: ignore[no-redef] | ||
licenses as _licenses, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to cover this case...
-
Newer versions of
setuptools
use this strategy for exposing the_vendor
directory:sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path]) # fmt: skip
So
packaging
will be available directly, without the need for prefixing it withsetuptools._vendor
. -
Older versions of setuptools will contain older versions of
packaging
so importingsetuptools._vendor.packaging.licenses
will always fail, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am just wondering now if we should add right at the beginning of the file:
try:
import setuptools # Just interested on the side effect in `sys.path`
except ImportError:
pass
... however, this may:
- Hurt performance
- Cause version conflict errors when there would be no need for modifying
sys.path
So maybe the best for now is to leave the implementation as suggested in the current state of the PR. We can revisit this later if we receive bug reports.
Thank you very much for having a look on this @cdce8p. |
Co-authored-by: Anderson Bravalheri <andersonbravalheri+github@gmail.com>
Thank you very much @cdce8p |
@abravalheri Would you mind creating a new release for it? I'd love to use that in |
Hi @cdce8p I am preparing one. Regarding setuptools, it might take still a while, I would prefer to pipeline the implementation of the metadata PEPs, so that we have consistency... This may mean retaining an old version of the validation while the version 2.2 is not fully merged yet. |
Thanks!
I can understand the intention, although as explained in pypa/setuptools#4706 (comment) I don't think that blocks us from added the support for |
Followup to #210. Implement the validation for PEP 639.
Most of the test cases are directly from the packaging PR: pypa/packaging#828