This fixes a lot of issues like
https://github.com/sympy/sympy/issues/15536 and
https://github.com/sympy/sympy/issues/17626, where it was previously
impossible to reference names in a way you would expect, due to
submodule names that are the same as other submodules or as functions.
Another example is

from sympy import core

or even just

sympy.core

In SymPy 1.5.1, this gives the sub-submodule sympy.core.core. It's
actually difficult to access the submodule sympy.core in SymPy 1.5
(you have to use sys.modules['sympy.core']). In 1.6 it gives
sympy.core, as you would expect.

This shouldn't break much code in the wild because it only affects
import *. Normal imports will continue to work, except for the cases
like above where they will may start giving the more correct thing
(there are still cases where a function has the same name as a module
and you have to use the workaround mentioned in the notes). So for
backwards incompatibility, it primarily affects interactive uses. But
we generally don't want to import submodules in interactive uses,
because it isn't something we want to part of the public API, per se.
For example, I often use expr as a variable name, and having expr
defined by default as sympy.core.expr would sometimes lead to
confusion.

Use of __all__ in __init__.py files is a best practice in Python files
and it's something that we should have been doing a long time ago. It
is also a requirement for our __init__.py files to pass pyflakes
linting, which we now require as part of the CI test suite.

Aaron Meurer

On Wed, May 13, 2020 at 4:36 PM Jason Moore <moorepa...@gmail.com> wrote:
>
> I had a look at the backwards incompatibilities.
>
> This one stood out:
>
> Submodule names are no longer imported with from sympy import *. They can 
> still be imported directly like from sympy import core or accessed like 
> sympy.core, or like sys.modules['sympy.simplify'] for modules that share 
> names with SymPy functions.
>
> Is this really necessary? On the face of it, I suspect this could cause a 
> fair amount of code in the wild to break. I'm not sure what breaking this 
> functionality gains, but it surely may cause down stream pain.
>
> Jason
> moorepants.info
> +01 530-601-9791
>
>
> On Wed, May 13, 2020 at 3:09 PM Oscar Benjamin <oscar.j.benja...@gmail.com> 
> wrote:
>>
>> Hi all,
>>
>> I'm about to put up the release candidate for sympy 1.6. I think that
>> the release blockers are covered and the performance regressions
>> identified so far have been addressed. Thanks to all who have helped
>> with that.
>>
>> I have been through the release notes and tried to extract what are
>> the potentially backward incompatible changes in this release and
>> added them at the top here:
>> https://github.com/sympy/sympy/wiki/Release-Notes-for-1.6
>>
>> I'm struggling a bit right now to say what the "highlights" of the
>> release are. Looking through the notes there are a *lot* of
>> improvements but it's hard to pull out any coherent big themes. This
>> would probably be easier if we released more often...
>>
>> Can anyone offer any suggestions for what sort of things we could list
>> as highlights? Don't be shy about suggesting your own contributions! I
>> guess the idea would be to list something that is significant and
>> perhaps the cumulative output of a number of PRs. Perhaps in
>> refactoring there are often no release notes for individual PRs but at
>> the end a major refactor could be considered worth mentioning.
>>
>> What sort of things might a "user" be interested in from this release?
>>
>> 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/CAHVvXxSEkNPjffwqiOA4-8xP0_1D8wAfLVrU9SbnvYSTRZC_Gg%40mail.gmail.com.
>
> --
> 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/CAP7f1AhwGFHgTC_3qBpjx25W8uydtiuJejnmbpG%3Dk1mtJkFj%2Bw%40mail.gmail.com.

-- 
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/CAKgW%3D6K_kc%2BBYDutErNT32NHHnxo7Tn4SFiPzQ%3D%2BzdT75r75kg%40mail.gmail.com.

Reply via email to