On Thu, 14 May 2020 at 21:12, Aaron Meurer <asmeu...@gmail.com> wrote:
>
> > Oscar, your idea looks helpful. It would resolve my concerns, but I'm not 
> > sure how to evaluate if that is worth doing. My opinion is that if the 
> > effort to deprecate isn't extreme, then we should do it. What "extreme" is 
> > defined as, is certainly debatable.
>
> I may be wrong on this, but I don't think Oscar's idea would actually
> work. The issue is that there's no way to tell the difference between
>
> from sympy import *
> core
>
> and
>
> from sympy import core
> core
>
> where the latter still works and should work. We could make it not
> work, but it's expected Python behavior to be able to import
> submodules like this.

I've opened a PR:
https://github.com/sympy/sympy/pull/19316

The PR adds back all the submodules wrapped in an object that emits a
warning when accessed e.g.:

In [1]: from sympy import add

In [2]: add.Add
/Users/enojb/current/sympy/sympy/sympy/__init__.py:653: SymPyDeprecationWarning:
importing sympy.core.add with 'from sympy import *' has been
deprecated since SymPy 1.6. Use import sympy.core.add instead. See
https://github.com/sympy/sympy/issues/18245 for more info.

  deprecated_since_version="1.6").warn()
Out[2]: sympy.core.add.Add

I left out core which can not be included in a backward compatible way
without failing to fix the broken behaviour that from sympy import
core doesn't give the package.

This is similar to what scipy recently did:
https://github.com/scipy/scipy/pull/10290

Top-level packages like printing, polys etc are all just listed in
__all__ (and not deprecated).

The only names not importable by from sympy import * in the PR that
were previously importable in 1.5 are:

SYMPY_DEBUG
core
physics

Those could also be added. In the case of core the reason is above.
For physics it's because adding it means importing it even during a
plain "import sympy" which otherwise wouldn't happen. SYMPY_DEBUG
seems obviously internal to me.

--
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/CAHVvXxS8ZLoBzercBDypJ-b4Tk3eWRYFULVEvOjiYs8b%3DLFNCg%40mail.gmail.com.

Reply via email to