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

Restructure sage.*.all for modularization, replace relative by absolute imports #36676

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions pkgs/sagemath-categories/known-test-failures.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"ntests": 28
},
"sage.categories.affine_weyl_groups": {
"ntests": 14
"ntests": 15
},
"sage.categories.algebra_ideals": {
"failed": true,
Expand Down Expand Up @@ -148,7 +148,7 @@
},
"sage.categories.coxeter_groups": {
"failed": true,
"ntests": 362
"ntests": 363
},
"sage.categories.cw_complexes": {
"failed": true,
Expand Down Expand Up @@ -301,7 +301,7 @@
},
"sage.categories.finite_complex_reflection_groups": {
"failed": true,
"ntests": 178
"ntests": 199
},
"sage.categories.finite_coxeter_groups": {
"ntests": 6
Expand Down Expand Up @@ -493,10 +493,6 @@
"failed": true,
"ntests": 13
},
"sage.categories.inner_product_spaces": {
"failed": true,
"ntests": 9
},
"sage.categories.integral_domains": {
"failed": true,
"ntests": 22
Expand Down Expand Up @@ -783,7 +779,7 @@
},
"sage.cpython.debug": {
"failed": true,
"ntests": 14
"ntests": 13
},
"sage.cpython.dict_del_by_value": {
"failed": true,
Expand Down Expand Up @@ -826,7 +822,6 @@
"ntests": 321
},
"sage.doctest.reporting": {
"failed": true,
"ntests": 124
},
"sage.doctest.sources": {
Expand Down Expand Up @@ -1091,7 +1086,7 @@
},
"sage.misc.sageinspect": {
"failed": true,
"ntests": 329
"ntests": 332
},
"sage.misc.superseded": {
"failed": true,
Expand Down Expand Up @@ -1124,6 +1119,7 @@
"ntests": 128
},
"sage.repl.configuration": {
"failed": true,
"ntests": 22
},
"sage.repl.display.fancy_repr": {
Expand All @@ -1149,6 +1145,7 @@
"ntests": 42
},
"sage.repl.inputhook": {
"failed": true,
"ntests": 7
},
"sage.repl.interface_magic": {
Expand All @@ -1157,7 +1154,7 @@
},
"sage.repl.interpreter": {
"failed": true,
"ntests": 118
"ntests": 114
},
"sage.repl.ipython_extension": {
"failed": true,
Expand Down Expand Up @@ -1188,7 +1185,7 @@
},
"sage.repl.load": {
"failed": true,
"ntests": 42
"ntests": 38
},
"sage.repl.preparse": {
"failed": true,
Expand Down Expand Up @@ -1315,9 +1312,6 @@
"sage.structure.global_options": {
"ntests": 145
},
"sage.structure.graphics_file": {
"ntests": 8
},
"sage.structure.indexed_generators": {
"failed": true,
"ntests": 90
Expand Down
2 changes: 2 additions & 0 deletions src/doc/en/reference/calculus/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Using calculus

- :doc:`More about symbolic variables and functions <sage/calculus/var>`
- :doc:`Main operations on symbolic expressions <sage/symbolic/expression>`
- :doc:`sage/calculus/expr`
- :doc:`Assumptions about symbols and functions <sage/symbolic/assumptions>`
- :doc:`sage/symbolic/relation`
- :doc:`sage/symbolic/integration/integral`
Expand Down Expand Up @@ -65,6 +66,7 @@ Internal functionality supporting calculus

sage/symbolic/expression
sage/symbolic/callable
sage/calculus/expr
sage/symbolic/assumptions
sage/symbolic/relation
sage/calculus/calculus
Expand Down
58 changes: 7 additions & 51 deletions src/sage/algebras/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,12 @@
# The full text of the GPL is available at:
#
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.misc.lazy_import import lazy_import

# old-style class for associative algebras, use Parent instead
from sage.rings.ring import Algebra

import sage.algebras.catalog as algebras

from .quatalg.all import *
from .steenrod.all import *
from .fusion_rings.all import *
from .lie_algebras.all import *
from .quantum_groups.all import *
from .lie_conformal_algebras.all import *

# Algebra base classes
from .free_algebra import FreeAlgebra
from .free_algebra_quotient import FreeAlgebraQuotient

from .finite_dimensional_algebras.all import FiniteDimensionalAlgebra

lazy_import('sage.algebras.group_algebra', 'GroupAlgebra')

lazy_import('sage.algebras.iwahori_hecke_algebra', 'IwahoriHeckeAlgebra')
lazy_import('sage.algebras.affine_nil_temperley_lieb',
'AffineNilTemperleyLiebTypeA')
lazy_import('sage.algebras.nil_coxeter_algebra', 'NilCoxeterAlgebra')
lazy_import('sage.algebras.schur_algebra', ['SchurAlgebra',
'SchurTensorModule'])

lazy_import('sage.algebras.hall_algebra', 'HallAlgebra')

lazy_import('sage.algebras.jordan_algebra', 'JordanAlgebra')

lazy_import('sage.algebras.octonion_algebra', 'OctonionAlgebra')

lazy_import('sage.algebras.shuffle_algebra', 'ShuffleAlgebra')

from .clifford_algebra import CliffordAlgebra, ExteriorAlgebra
from .weyl_algebra import DifferentialWeylAlgebra

lazy_import('sage.algebras.commutative_dga', 'GradedCommutativeAlgebra')

lazy_import('sage.algebras.rational_cherednik_algebra',
'RationalCherednikAlgebra')

lazy_import('sage.algebras.tensor_algebra', 'TensorAlgebra')

lazy_import('sage.algebras.q_system', 'QSystem')
# *****************************************************************************

lazy_import('sage.algebras.cluster_algebra', 'ClusterAlgebra')
from sage.algebras.all__sagemath_modules import *
from sage.algebras.all__sagemath_combinat import *

lazy_import('sage.algebras.yangian', 'Yangian')
from sage.algebras.quatalg.all import *
from sage.algebras.fusion_rings.all import *
from sage.algebras.lie_algebras.all import *
from sage.algebras.lie_conformal_algebras.all import *
37 changes: 37 additions & 0 deletions src/sage/algebras/all__sagemath_combinat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from sage.misc.lazy_import import lazy_import


# Algebra base classes
from sage.algebras.free_algebra import FreeAlgebra
from sage.algebras.free_algebra_quotient import FreeAlgebraQuotient

from sage.algebras.steenrod.all import *
from sage.algebras.quantum_groups.all import *

lazy_import('sage.algebras.iwahori_hecke_algebra', 'IwahoriHeckeAlgebra')
lazy_import('sage.algebras.affine_nil_temperley_lieb',
'AffineNilTemperleyLiebTypeA')
lazy_import('sage.algebras.nil_coxeter_algebra', 'NilCoxeterAlgebra')
lazy_import('sage.algebras.schur_algebra', ['SchurAlgebra',
'SchurTensorModule'])

lazy_import('sage.algebras.hall_algebra', 'HallAlgebra')

lazy_import('sage.algebras.jordan_algebra', 'JordanAlgebra')

lazy_import('sage.algebras.shuffle_algebra', 'ShuffleAlgebra')

lazy_import('sage.algebras.commutative_dga', 'GradedCommutativeAlgebra')

lazy_import('sage.algebras.rational_cherednik_algebra',
'RationalCherednikAlgebra')

lazy_import('sage.algebras.tensor_algebra', 'TensorAlgebra')

lazy_import('sage.algebras.q_system', 'QSystem')

lazy_import('sage.algebras.cluster_algebra', 'ClusterAlgebra')

lazy_import('sage.algebras.yangian', 'Yangian')

del lazy_import
14 changes: 14 additions & 0 deletions src/sage/algebras/all__sagemath_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from sage.misc.lazy_import import lazy_import

lazy_import('sage.algebras.group_algebra', 'GroupAlgebra')

# old-style class for associative algebras, use Parent instead
from sage.rings.ring import Algebra

from sage.algebras.finite_dimensional_algebras.all import FiniteDimensionalAlgebra
from sage.algebras.clifford_algebra import CliffordAlgebra, ExteriorAlgebra
from sage.algebras.weyl_algebra import DifferentialWeylAlgebra
lazy_import('sage.algebras.octonion_algebra', 'OctonionAlgebra')

import sage.algebras.catalog as algebras
del lazy_import
Empty file.
2 changes: 1 addition & 1 deletion src/sage/algebras/finite_dimensional_algebras/all.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .finite_dimensional_algebra import FiniteDimensionalAlgebra
from sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra import FiniteDimensionalAlgebra
1 change: 1 addition & 0 deletions src/sage/algebras/fusion_rings/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

lazy_import('sage.algebras.fusion_rings.fusion_ring', ['FusionRing'])
lazy_import('sage.algebras.fusion_rings.fusion_double', ['FusionDouble'])
del lazy_import
1 change: 0 additions & 1 deletion src/sage/algebras/hecke_algebras/all.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""
Hecke Algebras
"""
#from sage.misc.lazy_import import lazy_import
9 changes: 5 additions & 4 deletions src/sage/algebras/lie_algebras/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Lie Algebras
"""

#*****************************************************************************
# *****************************************************************************
# Copyright (C) 2013 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
Expand All @@ -14,10 +14,11 @@
#
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# *****************************************************************************
from sage.misc.lazy_import import lazy_import

lazy_import('sage.algebras.lie_algebras.lie_algebra', 'LieAlgebra')
#from kac_moody import KacMoodyAlgebra
# from kac_moody import KacMoodyAlgebra
lazy_import('sage.algebras.lie_algebras', 'examples', 'lie_algebras')
del lazy_import
Empty file.
13 changes: 8 additions & 5 deletions src/sage/algebras/lie_conformal_algebras/all.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#******************************************************************************
# ******************************************************************************
# Copyright (C) 2020 Reimundo Heluani <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# *****************************************************************************


from sage.misc.lazy_import import lazy_import
lazy_import('sage.algebras.lie_conformal_algebras.lie_conformal_algebra','LieConformalAlgebra')
lazy_import('sage.algebras.lie_conformal_algebras', 'examples', 'lie_conformal_algebras')
lazy_import('sage.algebras.lie_conformal_algebras.lie_conformal_algebra',
'LieConformalAlgebra')
lazy_import('sage.algebras.lie_conformal_algebras',
'examples', 'lie_conformal_algebras')
del lazy_import
1 change: 1 addition & 0 deletions src/sage/algebras/quantum_groups/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from sage.misc.lazy_import import lazy_import
lazy_import('sage.algebras.quantum_groups.fock_space', 'FockSpace')
lazy_import('sage.algebras.quantum_groups.quantum_group_gap', 'QuantumGroup')
del lazy_import
2 changes: 1 addition & 1 deletion src/sage/algebras/quatalg/all.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .quaternion_algebra import QuaternionAlgebra
from sage.algebras.quatalg.quaternion_algebra import QuaternionAlgebra
3 changes: 2 additions & 1 deletion src/sage/algebras/steenrod/all.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""
The Steenrod algebra
"""
from .steenrod_algebra import SteenrodAlgebra, Sq
from sage.misc.lazy_import import lazy_import
lazy_import('sage.algebras.steenrod.steenrod_algebra', ['SteenrodAlgebra', 'Sq'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why convert this to a lazy import?

Copy link
Contributor Author

@mkoeppe mkoeppe Nov 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was convenient in the modularization. Do you have a specific concern about it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For another ticket: I think that SteenrodAlgebra (which I wrote) and other named algebras perhaps could be deprecated and accessed solely through the algebras catalog, as a way of cleaning up the namespace. (I have no concerns about lazy importing here, for what that's worth.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was convenient in the modularization. Do you have a specific concern about it?

Just that it makes it very hard to review this PR, as there are all these unrelated changes sprinkled in. Can you extract these lazy_import changes to a new PR please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't believe this would be helpful for anything.

lazy_import('sage.algebras.steenrod.steenrod_algebra_bases',
'steenrod_algebra_basis',
deprecation=(32647, 'removed from namespace'))
del lazy_import
Loading
Loading