On Thu, 14 May 2020 at 19:57, Jason Moore <moorepa...@gmail.com> wrote:
>
> Is it possible to give a blanket deprecation warning if anyone does an import 
> with a `*`? It could warn the user that functionality will change in the next 
> version such that modules are not accessible via star imports.

I think that using "from sympy import *" should be fine. We should
stop putting all of the names there and design and document a coherent
way to import things from the different packages but as long as almost
all the functions most users want are at top-level they should be able
to use star import to get them. Many more users would be affected by
deprecating star-import in general than by removing the submodules
from the star import.

If we want to be extra-cautious here then we could do this:

1. Explicitly import all of the packages like sympy.physics that are
implicitly exported in 1.5 and add them to __all__ in
sympy/__init__.py. Those would then continue to be imported by "from
sympy import *".

2. Make a wrapper object for each of the sympy.x.y modules that are
implicitly exported in 1.5 that gives a deprecation warning on access
and add them to __all__ as well. Those would continue to be imported
by "from sympy import *" but would give a warning when used e.g.:

>>> from sympy import *
>>> add.Add
DeprecationWarning: Import the add module as "import sympy.core.add as
add" or "from sympy.core import add" not "from sympy import *" or
"from sympy import add".

--
Oscar

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxT71L2%2BumrL6a0DB_Nfj%3D%3DA2JMxtMGQ85xx%2B0_%2B9tWHrw%40mail.gmail.com.

Reply via email to