Thanks for writing this Jason. I agree we need to be considerate about
API compatibility.
For reference, here is our deprecation policy
https://github.com/sympy/sympy/wiki/Deprecating-policy.
I think there are two challenges with respect to this. One is that it
isn't always obvious that something will break API. I think in one of
the issues you are referring to, a return type changed simply because
some code was moved around and it caused sympify() to be called on the
result. To be fair, though, this was caught by the tests and the tests
shouldn't have been changed without some more consideration.
Secondly is that sometimes newer contributors are not are familiar
with the dangers of changing APIs.
A third issue is that sometimes it isn't clear what is and isn't API.
For example, the exact output format of a function like simplify() is
not considered API, and can change between releases without any
deprecations. We also have several functions that are not included in
__init__.py, but it isn't clear if they are "internal" or not (for
instance
https://github.com/sympy/sympy/issues/15384).
My comments on your points:
> 1. We should not change existing tests unless the change in the outputs don't affect user code, e.g. if an output expression is simpler that's ok.
I agree. This is on the reviewers, unless you can think of some way to
test this automatically with the bot.
Also, we should try to write down and clarify better what is and isn't
considered API for the purposes of breakage. Like I said, changing the
output format of an expression in a way that is still mathematically
equal is generally not considered breakage. Fixing something that was
wrong should not be considered breakage either. And I'm not sure how
we can clarify which internal functions are API. There have also been
some misconceptions. For instance, a lot of the subclassing APIs use
methods that start with underscore, but these are still public APIs
because we expect public subclasses to be able to define them (so as a
random example, adding a required argument to an _eval_* method would
be a no go because it would break existing subclasses that override
it).
> 2. We should not change existing public API unless absolutely necessary. Changing API just because it isn't the optimal design is not a valid reason to change it.
I would qualify this. I think it's sometimes necessary to change an
API. For example, an existing API may be too restrictive to allow
something to be done. Also, a very important consideration is
deprecability. If the old API can be kept intact for a deprecation
period (or sometimes, even without deprecating), that makes it much
more reasonable to do a break, vs. situations where this is not
technically possible.
> 3. Deprecation warnings must be used if changes are made at these should be in place for at least a year.
Absolutely agree. Our deprecation policy outlines this pretty clearly
(although the length of the deprecation is still not specified, but a
year sounds fine to me).
> 4. Never give warnings in documentation or code that exclaim something like "this api is experimental and may change in future versions". If you make it public, then you are stuck with it.
I'm not sure I agree with this. The problem with API breakage is that
it is often just not possible, as humans, to design an API right the
first time. When this is known, we still often want to get things
merged in so that people can start to play around with them. We
actually have a sympy.sandbox module where stuff like this can go in.
I agree a major problem here is that people won't read the
documentation. Maybe one option would be to make such things private
APIs (everything starts with an underscore). This would make it
clearer that it could change, and it would actually force an API
change of at least the name when it is made public. We could also use
UserWarning for this, though non-deprecation warnings should be used
sparingly.
> 5. Never merge your own code. This "I'm merging in 24 hours if no response" stuff is bad practice. We should at least require one review of the code.
I agree here too, though it's understandable given the low ability of reviewers.
> In PyDy, for example, we try to have it function with dependency versions that are 2 years old, typically maintain compatibility with the package versions available in the Ubuntu LTS release. If you look at the PyDy code base you now find loads of `if sympy_version >= x: do this; if sympy_version >=x and sympy_version <=y: do that; ...`. It is a mess! And that's only for 2 years of API changes.
Is there any reason you don't just require the latest version of SymPy
for each PyDy release. Trying to support old SymPy releases seems like
a lot of work for you as a single developer and I'm curious what are
the benefits.
> * I'd also like to see us follow semantic versioning, but can hold that for a future conversation. As it would require much more to implement.
As the person who sets the release numbers, we are doing some variant
of semantic versioning now, in that every major release of SymPy bumps
the second number (1.2, 1.3, 1.4). I'm only using the third number for
small bugfix releases after a major release (for instance, 1.1.1 fixed
a few minor issues that popped up when 1.1 was released
https://github.com/sympy/sympy/wiki/release-notes-for-1.1.1).
I'm not really sure how we should treat the first number. I'll
probably just bump it after 1.9, but I'm open to other suggestions. By
strict semantic versioning rules, every release should bump the first
number, because every release has major changes. Our release cycle
doesn't really coincide with the design of semantic versioning. It was
designed for smaller projects that release after every pull request.
Aaron Meurer
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to
sy...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/sympy.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/CAP7f1AgxRL7gu%2Bkdg6MW7yZF4%3DdrkScg078BizoGUyqqWKUHoA%40mail.gmail.com.
> For more options, visit
https://groups.google.com/d/optout.