-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backwards-incompatible changes - SUBSCRIBE TO THIS THREAD if you use trio! #1
Comments
ahem tap tap is this thing on? Github doesn't give any way to see who's subscribed to an issue, so maybe I'm just talking to myself? Anyway, if anyone is listening, then welcome to the first update on backwards incompatibility in Trio. I think as far as the code goes what's in master right now is pretty much what will be in 0.2.0, but I still want to do some doc updates so it'll still probably be a few days before the actual release. That means that now would be a great time to read this and check out master and let me know if I've made any embarrassing mistakes or am gratuitously inconveniencing anyone. In general, it turns out that there are very few actual breaking changes in 0.2.0; almost all the changes were easy enough to slap a small layer of back-compat shims on top of. The shims all print noisy If you read just one section of this comment then read this oneMy plan is to be quite aggressive and drop the back-compat shims in 0.3.0. So with a few exceptions (see below), the idea is that:
Important exception for anyone writing network servers: any code using Important exception for anyone using PyPy3: our backcompat shims rely on a feature that's in all supported releases of CPython, and... not yet any released version of PyPy3. (For any time travellers reading this in the future, it's PyPy3 5.8 that's missing the feature, and the upcoming PyPy3 5.9 should have the fix.) So the non-deprecated API is fully supported and should work identically on both CPython and PyPy3, but if you're using deprecated APIs and want to see the pretty warning messages then you need to upgrade to the latest PyPy3 nightly or stick with CPython. The plan for 0.2.0Actual breaking changesIn If I think that's it. If you try latest master and run into anything else then please let me know ASAP. DeprecationsAlmost all of the nursery API has been deprecated. Most importantly, The socket The various "run this" APIs have been reorganized to be more consistent and less confusing (see #68). In particular,
The following objects have been moved from the main
In general, "yield points" have been renamed to the less confusing "checkpoints", and functions are being updated to match (#157):
In The plan (so far) for 0.3.0As noted, all the changes mentioned in the "Deprecated" section above will become final in 0.3.0. In addition, there's a change coming in 0.3.0 where it's impossible to provide a useful warning period 😞: making the socket Fortunately, 0.2.0 adds a new high-level networking API that you'll want to switch to anyway instead of working with raw sockets, and as a bonus, if you do this now then you won't have to worry about 0.3.0's The quick cheat sheet for switching from the socket API to the stream API is:
That's pretty much it! PhewOkay, I think that's everything for 0.2.0. Hopefully this will be the biggest pile of deprecations like this; I wanted to try to clear up as much as possible ASAP before we get more users. Good luck and if you have any feedback please let me know! |
0.3.0 deprecations and breaking changesI'm just putting together the 0.3.0 release, and it looks like it's pretty simple:
|
Change in policyWhen I originally created this issue, we had no deprecation system at all and I had no idea how much churn we'd end up having in our APIs :-). These days we have some pretty solid tooling for documenting and issuing deprecation warnings, and for most of incompatible changes we've had to make it's turned out to be pretty easy to have a transitional warning period. So I'm going to stop posting detailed notes here for every release – you can read the official changelog :-). Instead, I'll save this issue for warning about changes that are more complicated / disruptive / controversial, the kind where it isn't enough to keep up to date with the latest trio release and fix deprecation warnings when you see them. |
Hi all! I just made a post in our forum asking what we should prioritize working on – if you have thoughts, let us know :-) https://trio.discourse.group/t/priorities-roadmap/34 (By the way, we have a forum now!) |
fix `sphinx_rtd_theme` lines in tables wrapping
Hi A new version of python-msrest in Debian picked up a dependency on python-trio. Currently python-trio is in Debian unstable, but it is currently blocked from migrating to testing by a bug filed by Robbie Basak saying "Trio upstream do not yet consider the API stable, so in my opinion this package is not yet ready for a stable Debian release". This (along with another issue) is in turn blocking the migration of the new version of python-msrest to Debian testing. I opened a discussion at https://alioth-lists.debian.net/pipermail/python-modules-team/2019-October/059368.html and also spoke to Robbie Basak in person yesterday and we would like to get your opinion on this. Do you think trio is sufficiently stable to include in the next release of Debian or should Debian disable the part of msrest that depends on trio? (note that trio has already been included in ubuntu LTS...) Note that personally I don't use these packages, i'm just looking at this from a Debian QA perspective. |
Well, it depends :-). What does Debian look at when deciding which things are allowed into testing and which are kept in unstable? We are still being fairly aggressive about fixing API stuff. And by "aggressive" I mean "our deprecation warnings are visible by default and we usually only issue them for a few months before dropping support for the old way", which I guess is much more aggressive than some projects and much less aggressive than others. OTOH the code we ship is extremely stable in the sense of "it works as advertised" – we have an extremely thorough test suite, high code coverage, etc. So even if Debian got stuck on some Trio release for a while, I don't think you'd need to worry that your Trio package would explode under your feet; it just might get out-of-sync with upstream. But of course "getting out of sync with upstream" is kind of the whole point of Debian's stable releases, so that should be fine? Also, FWIW, the end goal of all these changes is to get to the point where we can declare the API stable ASAP. So if Debian sticks to the roughly-two-year release cycle they've been on recently then things will probably look very different by the time bullseye freeze rolls around. |
I'm with @njsmith here (and also wearing my DD hat, even if it's kindof rarely used these days): by the time the next Debian release freeze looms Trio should be more than OK for long-term support. While Trio is not stable-as-in-API-frozen, it's stable as in "very well tested, and perfectly usable long-term in its current state", so yes I'd be happy with allowing it into Testing. If we do deprecate something, any dependents it has know they'll need to follow along before the deprecated parts are removed – but that's already better, frankly, than quite a few supposedly-stable libraries out there. |
Thank you @njsmith and @smurfix for your comments. Today I've caught up with Trio and dependencies in Debian. Debian unstable is now on 0.13.0, and based on your comments I've closed the blocking bug so we will no longer artificially hold Trio in Debian unstable and allow it to make the next release (assuming it passes the other usual criteria). |
Thank you. Might you be persuaded to also package anyio? |
This comment was marked as off-topic.
This comment was marked as off-topic.
I forgot about updating this issue regarding the Additionally, I plan on changing the main branch's name for trio from |
0.27.0 has a breaking change as |
A heads up that I've just merged a breaking change, but I hope everyone finds that it's an improvement worth the break: #3110 Rework KeyboardInterrupt protection to track code objects, rather than frames,
One minor drawback of the new approach is that multiple instances of the same Here's the additional docs: Since KeyboardInterrupt protection is tracked per code object, any attempt to def example(protect: bool) -> bool:
def inner() -> bool:
return trio.lowlevel.currently_ki_protected()
if protect:
inner = trio.lowlevel.enable_ki_protection(inner)
return inner()
async def amain():
assert example(False) == False
assert example(True) == True # once protected ...
assert example(False) == True # ... always protected
trio.run(amain) If you really need conditional protection, you can achieve it by giving each def example(protect: bool) -> bool:
def inner() -> bool:
return trio.lowlevel.currently_ki_protected()
if protect:
inner.__code__ = inner.__code__.replace()
inner = trio.lowlevel.enable_ki_protection(inner)
return inner()
async def amain():
assert example(False) == False
assert example(True) == True
assert example(False) == False
trio.run(amain) (This isn't done by default because it carries some memory overhead and reduces |
Stability is great for users! It lets them focus on solving their problem without worrying about their platform shifting under their feet. But stability is also bad for users! It means that anywhere an API is error-prone or hard to use or missing important functionality, they're stuck with it. Making the optimal trade-off here is tricky and context-dependent.
Trio is a very young project, that contains lots of new ideas, and that doesn't have much code built on top of it yet. So as we build things with it we'll probably discover places where the API is less awesome than desired, and for now we'll be relatively aggressive about fixing them. Hopefully we won't discover any real stinkers, but you never know. Then over time we'll gradually transition over to become more stable as we flush out the bad stuff and get more users.
This means that if you're an early adopter of Trio, it'd be good to have some strategy to make this as painless as possible. Our suggestions:
Pin your version. For example, in your
install_requires=
orrequirements.txt
, do not write:trio >= 0.1.0
. Instead, write:trio ~= 0.1.0
.==
if you prefer. The difference is that while both== 0.1.0
and~= 0.1.0
will disallow upgrading to0.2.0
,~=
allows upgrading to0.1.1
but== 0.1.0
does not. Our intention is that0.x.y
and0.x.(y+1)
will be backwards compatible.Please do report back on how trio is working out for you, e.g. by posting a comment on this issue.
Subscribe to this issue (for example, by pressing the little "Subscribe" button in the right column →). We'll bring up backwards-incompatible changes here before we make them, so this will give you fair warning and a chance to give feedback.
The text was updated successfully, but these errors were encountered: