Remove useless 'from . import all' from some __init__.py files
Closed this issue · 21 comments
... and similar imports of modules in the package, found via
find src/sage -name '__init__.py' | xargs grep import
Possibly some of them are needed to break circular imports, but likely not all of them.
Part of #32501.
Depends on #32506
CC: @tscrim @fchapoton
Component: refactoring
Author: Matthias Koeppe
Branch/Commit: 55ca4bc
Reviewer: Frédéric Chapoton
Issue created by migration from https://trac.sagemath.org/ticket/32507
Description changed:
---
+++
@@ -1,3 +1,5 @@
+... and similar imports of modules in the package.
+
Possibly some of them are needed to break circular imports, but likely not all of them.
Part of #32501.In src/sage/combinat/__init__.py, there is
from . import quickref
from . import tutorial
These are modules without code. Are these imports needed for anything?
New commits:
8efece0 | sage.graphs, sage.graphs.graph_decompositions: Remove unnecessary import of modules |
from . import all was previously discussed in #20617 comment:16
Author: Matthias Koeppe
Branch pushed to git repo; I updated commit sha1. New commits:
892f2e7 | Remove all 'from . import all' from __init__.py files |
Description changed:
---
+++
@@ -1,4 +1,8 @@
-... and similar imports of modules in the package.
+... and similar imports of modules in the package, found via
+
+```
+find src/sage -name '__init__.py' | xargs grep import
+```
Possibly some of them are needed to break circular imports, but likely not all of them.
Replying to @mkoeppe:
In
src/sage/combinat/__init__.py, there isfrom . import quickref from . import tutorialThese are modules without code. Are these imports needed for anything?
Also:
src/sage/categories/__init__.py:from . import primer
I am guessing these are some kind of workarounds for the sphinx docbuild?
We can take care of them in #32508.
looks good, but does it pass the doctests with optional - dot2tex ?
Just tested, yes it does
ok, thx. Then let's go
Reviewer: Frédéric Chapoton
Thank you!
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
1c106cd | Remove useless 'file is not empty' comments from __init__.py files |
55ca4bc | Merge branch 't/32506/remove_useless__file_is_not_empty__comments_from___init___py_files' into t/32507/remove_useless__from___import_all__from_some___init___py_files |
Changed branch from u/mkoeppe/remove_useless__from___import_all__from_some___init___py_files to 55ca4bc