Skip to content
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

Remove useless 'from . import all' from some __init__.py files #32507

Closed
mkoeppe opened this issue Sep 12, 2021 · 21 comments
Closed

Remove useless 'from . import all' from some __init__.py files #32507

mkoeppe opened this issue Sep 12, 2021 · 21 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Sep 12, 2021

... 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

@mkoeppe mkoeppe added this to the sage-9.5 milestone Sep 12, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 12, 2021

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 12, 2021

Commit: 8efece0

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 12, 2021

comment:3

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:

8efece0sage.graphs, sage.graphs.graph_decompositions: Remove unnecessary import of modules

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

comment:4

from . import all was previously discussed in #20617 comment:16

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

Author: Matthias Koeppe

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 13, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

892f2e7Remove all 'from . import all' from __init__.py files

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 13, 2021

Changed commit from 8efece0 to 892f2e7

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

comment:8

Replying to @mkoeppe:

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?

Also:

src/sage/categories/__init__.py:from . import primer

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

comment:9

I am guessing these are some kind of workarounds for the sphinx docbuild?
We can take care of them in #32508.

@fchapoton
Copy link
Contributor

comment:10

looks good, but does it pass the doctests with optional - dot2tex ?

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

comment:11

Just tested, yes it does

@fchapoton
Copy link
Contributor

comment:12

ok, thx. Then let's go

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

comment:13

Thank you!

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 13, 2021

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

1c106cdRemove useless 'file is not empty' comments from __init__.py files
55ca4bcMerge 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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 13, 2021

Changed commit from 892f2e7 to 55ca4bc

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

comment:15

Merged #32506 to remove the trivial merge conflicts

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 13, 2021

Dependencies: #32506

@vbraun
Copy link
Member

vbraun commented Sep 19, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants