-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
sage -fixdistributions
#36135
sage -fixdistributions
#36135
Conversation
I understand the use case
is only dangerous. |
I have added a bit of documentation. The manual versions of the commands are there simply because whenever an automatic mechanism is provided, there should also be a simpler, manual mechanism. |
I've made it a bit safer. |
This
is too verbose and repetitive. How about logging like
or something close. |
Similarly how about this?
|
Perhaps because of |
Is this meaningful?
This is not a legitimate use, of course, but it would be better to guide erroneous people with a meaningful message. |
Yes, without |
Then does this
mean I get the same result after Is this documented? |
Now I understand its function
Nice. This is worth to be documented. |
(Hinted by the comment above) An alternative suggestion:
The advantage is that it is short and succinct, and shows the affected file first. By the way, the concept of "empty distribution" (because you mention "nonempty distribution") is confusing. Is this
empty distribution? Do we allow that? I think we should not. |
Now I understand why you allowed
I guess it is because eventually |
Thanks for the suggestion. Done in 64e50f3 |
Yes, that's a possible future step |
I agree it is poor terminology. The empty string designates a catch-all distribution, likely sagemath-standard. |
Perhaps we may say "empty distribution (string) designates the standard distribution, which is likely to be sagemath-standard"... You didn't answer, but I guess you don't allow literally
but you meant no |
How about adding in the help
or something? |
To prevent needless confusion, we may say "package" instead " packages" in
|
It is allowed and is the same as no |
I get $ sage --fixdistributions src/sage/monoids
src/sage/monoids/all.py: file in distribution ''
src/sage/monoids/automatic_semigroup.py: file in distribution ''
...
src/sage/monoids/trace_monoid.py: file in distribution ''
$ sage --fixdistributions src/sage/monoids/all.py
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/kwankyu/GitHub/sage-dev/src/sage/misc/package_dir.py", line 548, in <module>
handle_file(path)
TypeError: handle_file() missing 1 required positional argument: 'file It should work also with a single file. Right? |
OK, then. |
$ sage --fixdistributions --set sagemath-coxeter3 src/sage/libs/coxeter3
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/kwankyu/GitHub/sage-dev/src/sage/misc/package_dir.py", line 546, in <module>
handle_file(root, file)
File "/Users/kwankyu/GitHub/sage-dev/src/sage/misc/package_dir.py", line 521, in handle_file
package_distributions_per_directives[root].add(distribution)
UnboundLocalError: local variable 'distribution' referenced before assignment ?? |
…ing as distribution
…distributions --set all --from-egg-info'
54e953d
to
f6fabd8
Compare
Rebased |
Documentation preview for this PR (built with commit f6fabd8; changes) is ready! 🎉 |
I get
Note the two lines beginning with |
Yes, some of the MANIFESTs are not clean yet (even in #35095). In |
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.
LGTM.
Yes. This is a useful feature of |
Thank you! |
sagemathgh-36135: `sage -fixdistributions` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> This is a new maintenance command for adding/updating `# sage_setup: distribution` directives at the top of source files. Based on a discussion in sagemath#35884 (comment) <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Part of: sagemath#29705 - Cherry-picked from: sagemath#35095 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> - Depends on sagemath#36533 (CI fix) <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36135 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee, Matthias Köppe
This is a new maintenance command for adding/updating
# sage_setup: distribution
directives at the top of source files.Based on a discussion in #35884 (comment)
📝 Checklist
⌛ Dependencies
pkgs/sage-conf_pypi
: Repair after #36400, #36435 #36533 (CI fix)