Refactoring tool to fix modularization anti-patterns
Closed this issue · 40 comments
The new command sage --fiximports replaces imports from sage.PAC.KAGE.all by more specific imports when sage.PAC.KAGE is an implicit namespace package.
Part of Meta-ticket #34201
Depends on #34849
CC: @alexchandler100
Component: scripts
Author: Alex Chandler, Matthias Koeppe
Branch/Commit: u/mkoeppe/replace_dot_all @ e74dbf6
Reviewer: Matthias Koeppe, Alex Chandler
Issue created by migration from https://trac.sagemath.org/ticket/34945
Branch: u/mkoeppe/replace_dot_all
Commit: 294e3e9
Branch pushed to git repo; I updated commit sha1. New commits:
46a15bf | src/sage/misc/replace_dot_all.py: Pass package_regex, not regex including 'import ' (fixup) |
2cbbf2d | src/sage/misc/replace_dot_all.py: Use more 'with open' |
29e5ddb | src/sage/misc/replace_dot_all.py: Replace sort_log_messages by print_log_messages |
01efec0 | src/sage/misc/replace_dot_all.py: Use endswith() |
Branch pushed to git repo; I updated commit sha1. New commits:
810d982 | src/sage/misc/replace_dot_all.py: Replace -l with positional argument, handle multiple files/dirs, do not use directory prefix |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
dbcccc1 | src/sage/misc/replace_dot_all.py: Replace -l with positional argument, handle multiple files/dirs, do not use directory prefix |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
491805d | src/sage/misc/replace_dot_all.py: Replace -l with positional argument, handle multiple files/dirs, do not use directory prefix |
Branch pushed to git repo; I updated commit sha1. New commits:
8cef447 | src/sage/misc/replace_dot_all.py: Restore print_log_messages lost in previous commit |
aa5f1e4 | src/sage/misc/replace_dot_all.py: Clean docstrings, uncamelcaps |
202cdc5 | src/sage/misc/replace_dot_all.py: Update doctests |
bf5e6d2 | src/sage/misc/replace_dot_all.py: Simplify some 'if' conditions |
Branch pushed to git repo; I updated commit sha1. New commits:
b426778 | src/sage/misc/replace_dot_all.py: Doc updates, pycodestyle fixes |
Branch pushed to git repo; I updated commit sha1. New commits:
685680b | src/sage/misc/replace_dot_all.py: Use isinstance instead of type(...) == ... |
Branch pushed to git repo; I updated commit sha1. New commits:
0b8dd2f | src/sage/misc/replace_dot_all.py: Fixup |
Branch pushed to git repo; I updated commit sha1. New commits:
d296b7c | src/sage/misc/replace_dot_all.py: Replace 'row number', 'line number' by : |
ac83a49 | src/sage/misc/replace_dot_all.py: Use __import__ |
fe617e9 | src/sage/misc/replace_dot_all.py: Fold parse_arguments into main |
1c19d43 | src/sage/misc/replace_dot_all.py: Fix doctests |
Reviewer: Matthias Koeppe, ...
Changed author from Alex Chandler to Alex Chandler, Matthias Koeppe
Branch pushed to git repo; I updated commit sha1. New commits:
23dff24 | src/sage/misc/replace_dot_all.py: Simplify print_log_messages, fold into main |
Branch pushed to git repo; I updated commit sha1. New commits:
568c538 | src/sage/misc/replace_dot_all.py: Use os.path.join more |
Branch pushed to git repo; I updated commit sha1. New commits:
eef9cd5 | src/doc/en/developer/packaging_sage_library.rst: Mention relint, sage --fiximports |
Alex, your code works well. I have only made minor changes that bring the command line interface in line with similar tools, and some style changes.
It has proper doctest coverage now and passes the code style tests.
If you have a chance to look through my changes, you can add your name to "Reviewers"
Branch pushed to git repo; I updated commit sha1. New commits:
e74dbf6 | src/sage/misc/replace_dot_all.py: Add copyright notice |
Description changed:
---
+++
@@ -1 +1,3 @@
+The new command `sage --fiximports` replaces imports from `sage.PAC.KAGE.all` by more specific imports when `sage.PAC.KAGE` is an implicit namespace package.
+Part of Meta-ticket #34201The Lint and Build&Test failures are unrelated to the changes here.
I've taken a look, and the changes all look great to me. I've added my name to the reviewers.
Changed reviewer from Matthias Koeppe, ... to Matthias Koeppe, Alex Chandler
Merged in 10.0.beta0