sagemath/sage

Use lazy_import for module-level import from sage.plot (outside of sage.plot)

Closed this issue · 32 comments

... as found by git grep '^from sage.plot.*import'

In Cython files, we move the imports into the methods instead.

Depends on #22081

CC: @orlitzky

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: 6d37580

Reviewer: Michael Orlitzky, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/32847

New commits:

2d81310git grep -l '^from sage.plot.*import' | grep -v 'sage/plot' | xargs sed -E -i.bak $'s/^from (sage[.]plot[.][a-z0-9_]*) import (.*)/from sage.misc.lazy_import import lazy_import\\nlazy_import(\1, \2)/'
259b5ffFix up lazy_import from sage.plot.*
ba8d741git grep -l '^from sage.plot.*import' | grep -v 'sage/plot' | xargs sed -E -i.bak $'s/^from (sage[.]plot[.][a-z0-9._]*) import (.*)/from sage.misc.lazy_import import lazy_import\\nlazy_import(\1, \2)/'
f513999Fix up lazy_import from sage.plot.*

Author: Matthias Koeppe

Commit: f513999

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

bd854ecsrc/sage/modular/arithgroup/farey_symbol.pyx: Move imports from sage.plot into method
812c729src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx: Revert change to lazy_import
e27a459In Cython files, move imports from sage.plot into methods

Changed commit from f513999 to e27a459

Description changed:

--- 
+++ 
@@ -1,2 +1,4 @@
 ... as found by `git grep '^from sage.plot.*import'`
 
+In Cython files, we move the imports into the methods instead.
+
comment:8

It looks like you made both changes in src/sage/graphs/graph_coloring.pyx. You've added lazy_import AND moved the import into the module.

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

58d0994src/sage/graphs/graph_coloring.pyx: Remove unused lazy import

Changed commit from e27a459 to 58d0994

Reviewer: Michael Orlitzky

comment:10

pending patchbot approval but should be fine.

comment:11

Thanks!

comment:12

doesn't work, patchbot shows errors, all hail the failboat!

comment:13

I'll revisit this ticket in the 9.6 cycle

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

5df88daMerge tag '9.6.beta0' into t/32847/use_lazy_import_for_module_level_import_from_sage_plot__outside_of_sage_plot_
362b506src/sage/geometry/lattice_polytope.py: Fix lazy import
758dcaasrc/sage/repl/ipython_kernel/widgets_sagenb.py: Use try...except for import of sage.plot.colors.Color

Changed commit from 58d0994 to 758dcaa

Dependencies: #33007

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

2d9a84egit grep -l 'misc.all import' | xargs sed -i.bak 's/misc.all import tmp_/misc.temporary_file import tmp_/'
5a8d76eRemove imports from sage.misc.all
97b4dfdgit grep -l 'misc.all import' | xargs sed -i.bak 's/misc.all import sage_eval/misc.sage_eval import sage_eval/'
e72dc8eRemove more imports from sage.misc.all
d114096git grep -l 'misc.all import' | xargs sed -i.bak 's/misc.all import cartesian_product_iterator/misc.mrange import cartesian_product_iterator/'
1ab9441Remove remaining imports from sage.misc.all
0e814dcMerge #32989
37789fdMerge tag '9.5.beta9' into t/33007/remove_imports_from_sage_interfaces_all
584d121src/sage/rings/polynomial/multi_polynomial_libsingular.pyx: Fix import
b47604fMerge #33007

Changed commit from 758dcaa to b47604f

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

e29006bMerge tag '9.6.beta2' into t/32847/use_lazy_import_for_module_level_import_from_sage_plot__outside_of_sage_plot_

Changed commit from b47604f to e29006b

Changed dependencies from #33007 to none

Changed reviewer from Michael Orlitzky to Michael Orlitzky, Travis Scrimshaw

comment:20

The failbot has failed! Rejoice!

comment:21

Thanks!

comment:22

Merge failure on top of:

affaa06c9a Trac #32644: Typos in documentation of sage/modular/quasimodform

1491ab2b23 Trac #31576: Projective points over rings with zero divisors

05e75749d5 Trac #31355: upgrade lrcalc to 2.1

4c5660bae4 Trac #30680: Finitely presented modules over the Steenrod algebra

472e893b31 Trac #29927: shifting issue in padic _set_from_list functions

1f683e92f7 Trac #29215: valuation error

ad663d9393 Trac #22081: Add new option to hyperbolic graphics to select the model

ca4c2aa62c Trac #33390: singular spkg-configure.m4: Better test for help

58e2a16 Trac #33390: singular spkg-configure.m4: Better test for help

b96b86a Trac #33377: GenericGraph.[weighted]adjacency_matrix, incidence_matrix: Accept keyword arguments for matrix constructor

5705d22 Trac #33374: adjust error messages in algebras/

f71a59c Trac #33367: Adjust some error messages in combinat/

d2b071e Trac #33364: remove traces of # py3 and some # py2

518f9fc Trac #33358: Fix for rename of conda e-antic package to libeantic

7abda14 Trac #33357: Random set partition with fixed block sizes does not respect the constraint and other improvements

b17a291 Trac #33353: increase tolerance of doctests in modular/modform/numerical.py

bfa90bb Trac #33351: raw docs and other pycodestyle details in some pyx files

09c55f3 Trac #33349: a few details in designs

ed86487 Trac #33342: fix indentation in toy_variety.py

2fd4054 Trac #33341: pycodestyle cleaning in convolution.py

016f864 Trac #33336: Fix deprecation warning with scipy 1.8.

a64514b Trac #33335: fix E111 (indentation) in geometry, groups, logic, matrix

aa255bf Trac #33334: fix E111 (indentation) in rings

b35def6 Trac #33333: Deduplicate package names in installation guide

df13563 Trac #33332: fix E111 (indentation) in dynamics, numerical, modules, interfaces

fd2d77c Trac #33328: Some improvements for signed permutations

9d77db7 Trac #33323: Cardinality of partitions of negative values

567da5a Trac #33309: Make Sage documentation functional

7050541 Trac #33247: Restore quiet in ./configure -q

56c6240 Trac #33149: use lazy_string() for string formatting when creating exceptions

5bf1f88 Trac #32465: Refactor {Matrix,Vector}_double_dense through ..._numpy_dense, add ..._numpy_integer_dense

72f573e Trac #30649: Reimplement "sage -p SPKG" as "cd $SAGE_ROOT && make SPKG-no-deps"

9941688 Trac #33150: more direct conversion from QQbar to real and complex ball fields

d08b099 Trac #33127: Fix warning about missing sage-site when SAGE_ROOT is removed after installation

f456256 Trac #33100: is_positive_definite returns wrong results

ca6ac0b Trac #33054: conda-forge (linux): primecount fails to install

347ee93 Trac #32987: Deprecate sage.misc.misc.sage_makedirs

433e4d9 Trac #30252: Make TensorProducts of finite-dimensional modules / vector spaces finite-dimensional

29b0897 Trac #32965: tox / GH Actions: Add centos-7-devtoolset-gcc_{9,10,11}

15c8011 Updated SageMath version to 9.6.beta2

merge was not clean: conflicts in src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py

Changed commit from e29006b to 6d37580

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

8e80bc9Added a plot of an ideal triangle
1b46f13Merge branch 'develop' into t/22081/public/graphics/hyperbolic_graphics-22081
2fe7b35Added Klein Model to the hyperbolic_arc and hyperbolic_polygon
9b53e18Added partial implementation of Hiperboloid model. It does not support nor color (fairy easy) nor fill oprion: The latter may be subject for a new ticket in the future
09a5c9bAdded color and fill option to the hiperboloid model. The fill option is somewhat jaggy in some cases, but to this end I think its improvement should be deferred to a later ticket
767722eMerge branch 'public/graphics/hyperbolic_graphics-22081' of git://trac.sagemath.org/sage into public/graphics/hyperbolic_graphics-22081
900c36cReviewer changes simplifying plot implementation, more robust inputs, and misc doc changes.
25c0d32Some last little doc tweaks and fixes.
3f367ecFixing one last typo hiper -> hyper.
6d37580Merge #22081

Dependencies: #22081

comment:25

Merged #22081 to resolve merge conflict