-
-
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
Implement #1681 (globbing support for [options.data_files]
)
#2712
Conversation
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.
This work is really good... good enough to merge after fixing a couple of nitpicks (done).
My only hesitation is that license_files
, which was introduced recently, also accepts globs, but using a different syntax (no glob:
prefix) and relies on postprocessing to expand the globs.
At some point, it would probably be worthwhile to harmonize those two mechanisms (if that makes sense). And of course, it might prove easiest to harmonize the two before this setting adopts the glob feature and users come to depend on it.
@darkvertex Would you be willing to analyze these two settings and make a recommendation on how you'd like to proceed?
@jaraco Hi! Thanks for the review and doing the little adjustments.
Thanks! :)
@jaraco If I understand correctly, the Or did you mean to harmonize as in make both functions reuse the same glob expansion logic? I see two avenues of going about this: A) If we want to make Line 583 in 0aa3576
but keeping the logic about searching for some default patterns ( patterns = ('LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*') ) when no values are declared whatsoever.
B) If you wanted to simply bring some of the core glob logic together to reduce repetition / duplication, not changing any behaviour of Line 602 in 0aa3576
into config.py and introduce the os.path.relpath() bit I had in my expansion -- which does not seem to break any related tests; I tried it:
then I could use it in line 280:
and edit it to reuse the function:
and then make sure it still gets used in There's already a few things being imported from config.py in dist.py, so it would not be wise to move that logic completely to dist.py as that could cause a circular import situation. How would you guys like to proceed? Personally I prefer option A: make |
We could also slightly reverse tracks and decide to expand globs by default in data_files. I discussed the tradeoffs in #1681 (comment) |
I wasn't thinking about avoiding code duplication, so thanks for raising that possibility. I do, however, want to focus primarily on the user interface first and then address implementation details subsequently. I'm liking option A, and I do think that's the best approach. In that case, it doesn't particularly affect this PR, so I'll likely merge this soon. |
…g a custom directive.
glob:
directive for [options.data_files]
)[options.data_files]
)
As requested by @jaraco in his comment I've adapted the code such that globbing is implicit. Looks like someone needs to approve the Github workflows again for me since I'm a first-time contributor. Can someone help? |
…ames with globby characters that exist literally.
I fixed the line-too-long flake8 warning. Sorry about that. Can someone re-run the tests please? |
No rush, but just sharing that I'll be AFK on vacation for three weeks starting next week. So if anyone wants any further little edits from me, now is the time to ask for them (or else see ya late August.) |
Thanks for the patience and extra re-work. |
No problem! Thanks for reviewing and merging. Looking forward to cleaning up my setup.py files that only existed to do some globbing in some of my pip packages at work. 😀 |
@jaraco I see you tried to create a release but Github Actions workflow failed due to a test failure. Thought you'd like to know that it would appear that it's an issue with I also found this fix for the line causing the type error seen in this repo's failed build: |
In pypa/setuptools#2712 setuptools learned to natively support globbing data files, and the pbr setting to do the exact same thing is not needed anymore. Pin the minimum build requirement to ensure the correct version is used.
In pypa/setuptools#2712 setuptools learned to natively support globbing data files, and the pbr setting to do the exact same thing is not needed anymore. Pin the minimum build requirement to ensure the correct version is used.
In pypa/setuptools#2712 setuptools learned to natively support globbing data files, and the pbr setting to do the exact same thing is not needed anymore. Pin the minimum build requirement to ensure the correct version is used.
Summary of changes
Hello! 👋 First time contributor here.
This change (which closes #1681) introduces an optional new
glob:
directive just for values of[options.data_files]
which will expand the given patterns to the corresponding relative paths.It is also possible to do a mix of some regular strings and some using the new directive in the same dict. (See new unittest for an example.)
I took the liberty of updating
docs/userguide/declarative_config.rst
to mention the new directive. Please advise if it should be noted elsewhere in the documentation.I tried to stay within the style of the file and added a new unittest for this new feature. Let me know what you think or if you wish to reword or adjust anything.
Pull Request Checklist
changelog.d/
.(See documentation for details)