From bbbbf602b81c7803804039738eade4d0e95256e9 Mon Sep 17 00:00:00 2001 From: nbruin Date: Tue, 16 Dec 2025 14:40:41 -0800 Subject: [PATCH] Add warning about imports to all.py Warn about not importing from all and instead use `import_statements` to figure out where to import from instead. --- src/sage/all.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/sage/all.py b/src/sage/all.py index 3ef717df659..d66c8b0ad67 100644 --- a/src/sage/all.py +++ b/src/sage/all.py @@ -2,6 +2,20 @@ all.py -- much of sage is imported into this module, so you don't have to import everything individually. +WARNING: + +Do not import from this module into other modules. Instead, import +from the orginal location. The tool `import_statements` helps in +figuring out where that location is. For instance:: + + sage: import_statements("TensorAlgebra") + from sage.algebras.tensor_algebra import TensorAlgebra + +tells you that `TensorAlgebra` should be imported from +`sage.algebras.tensor_algebra`. While the binding is available in `sage.all` +as a `LazyImport`, you should not use that because it can lead to unexpected +results. + TESTS: This is to test :issue:`10570`. If the number of stackframes at startup