-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Fix __package_version__ attr literal evaluation. #322
Conversation
To explain the practical importance of this: Having to import the module simply to read metadata causes trouble for cross-builds (this patch is the result of a discussion on the Buildroot mailing list), because suddenly all target runtime dependencies are needed in the host environment, too, only to be able to read the version. |
Thanks for doing this James. I highlighted a few other things we should maybe change too in https://lore.kernel.org/buildroot/CADvTj4psKDjXCC3691x-eboKJ=aLVXKw9g7pRASOvpRq_xYz4w@mail.gmail.com/T/#mb7202713e922c31c328e3539a4a5ce606aabfb44
|
dcabf4a
to
a263336
Compare
Added these changes as well. |
Thanks for the PR. The current approach was arrived at after a surprisingly long process. I'm not necessarily averse to making this change, but would want to make sure it doesn't just cause the same issue the other way around. After all, Of course, all of this stems from my early (and in hindsight probably ill-advised) choice of ISO 8601 date rather than a more pythonic version specifier. An easier change could just be to switch Other notes:
|
Both are missing quotes that'd be in the code. Try |
Dynamic metadata should be compatible with ast.literal_eval() so that import fallback is not needed. It's important to avoid the import fallback as that pulls in a number of unnecessary build dependencies. See: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
a263336
to
f128f65
Compare
Should be fixed now.
Usually only build tooling like setuptools need to do ast parsing to avoid imports so anything accessing |
Thanks for the additional detail (and 🤦 re: I can't find any downstream projects that make any use of |
Dynamic metadata should be compatible with
ast.literal_eval()
so that import fallback is not needed. It's important to avoid the import fallback as that pulls in a number of unnecessary build dependencies.See:
https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata