-
Notifications
You must be signed in to change notification settings - Fork 584
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
The "we're dropping Python 2" checklist #2218
Comments
Is python 3.5 still desired? If not updating to f-strings can tidy the code substantially. |
Our compatibility policy is "until end of upstream support", so we'll be keeping 3.5 until next September. I'm definitely looking forward to a 3.6+ codebase though! (strictly speaking our policy only says "Hypothesis is ...", not "will remain" - so we're in the clear to drop it early if we choose, as proposed below) |
though personally I'm keen to be more aggressive about this, and dropping 3.5 early is a pretty safe choice IMO. |
I've been thinking about this too - the only reason I'm keen to keep compatibility for 3.5 given the relatively low usage is to avoid blocking users from upgrading to the latest Hypothesis. (honestly this shouldn't be an issue anyway, but it is anyway for some) Simplicity of communication is nice, but "3.6+" is even easier to say! I think a reasonable pathway would be to:
End result, 3.5 users have ~8 months on "modern" Hypothesis but without any extra features / bugfixes / whatever else we do over that timeframe; and we have a nicer development experience. If any users care a lot, I'm happy to do paid backports in an isolated branch! Sound good? |
Ha! You're on the ball. I was just coming over to this issue to add that. |
Wait, just rereading this... I missed this the first time. Why will this be a minor version? I don't think we should drop Python 2 in a minor version. If the reason is that we don't want to do both turn deprecations into errors and drop Python 2 support in the same release (which I'd be fine with us doing but I can see the argument against) I'd rather us do two major versions in short succession (it wouldn't be the first time!) than drop Python 2 support in a minor version. |
I'm fine with doing 5.0 at the stroke of midnight - it shouldn't actually be hard to manage, so long as we push the refactoring off to follow-up patches (which was already the plan). Top post updated. I've got that week off and I'm happy to |
If you don't mind, I want to help on this beside django and drf. |
I don't mind at all - I'll write the initial set of three or four big changes (I've already scripted most of it), but after that I'd be happy for you to write some of the more contained ones in the first week of January. Review comments are also helpful! |
I will happily help shepherd the |
I've re-organised the post-5.0 checklist into two parts - one large but fairly mechanical PR that I'll aim to get out in the first day or two of January, and a second part with smaller changes which more of us can work on concurrently 😄 |
can you try pyupgrade? |
If you mean "to remove the |
As of the current PR, plus drafts linked in the top comment:
My I'm already enjoying life without awkward compat shims - it makes a surprisingly big difference. Or perhaps not so surprising; pygount suggests that I've deleted a net 6% of the library even before considering tests... and the changed portion is generally much nicer to work with. |
Could I ask for a major version bump then? It makes version pinning clearer... /me is still running hypothesis on python 2.6 and 3.3 |
Surely you already have to pin to a much older version though? |
yes, that's why I'm asking for making it easier/more obvious to know which version to pin to (I don't pin all dependencies, only the ones I have to) |
This post is a living document, and regularly edited to reflect our latest plans.
Per our compatibility policy, Hypothesis will drop Python 2 support soon after upstream support ends on 2020-01-01 (countdown here). This issue exists to describe, discuss, and track progress on all the improvements that are possible once we go Python-3-only.
First,
That PR has its own checklist, with minimal changes to get to the new public API.
Once Hypothesis 5.0 is released, I'll open a second PR with the large tool-assisted changes. This will be a very large diff, but quite mechanical and not too hard to review. IMO it's best to get this in as a single hard-changeover, to minimise the merge conflicts and churn it could cause for other PRs.
That PR also has its own checklist, and has no changes to the public API.
That's a
+1,020 −2,461
line PR, which is quite enough to review even as obvious mechanical fixes. Once that's in, we have the manual fixes - the bulk of which are "shrinkcompat.py
":Finally, I'll:
typing
module, and fix bad annotationsSubsequent changes - of which there are many! - can be done in smaller and mostly independent chunks. This reduces the size of merge conflicts, facilitates code review, and ensures that we can mix feature development, unrelated bugfixes, and refactoring work as they appeal to each contributor 😄
inspect.getfullargspec
withinspect.signature
e.g. preferring
b"\x00"
over any ofb"\0"
,bytes(1)
, orbytes([0])
.compat.py
to live with related code insteadI'm sure there are many things I'm missing - if you think of one that doesn't already have its own issue or pull request, please comment below and I'll update the list! My goal here is to assemble a complete checklist of refactorings and upgrades that we probably want to do; so interpret these as options rather than requirements.
Special bonus checklist: things to revisit when we drop Python 3.5 later this year!
com2ann
to convert type-hints on variables to annotationsgit grep -nE "# pragma: no (branch|cover)|[pP]y(thon)? ?3|sys\.version" -- . ':!*changes.rst'
to see all of the locations we've tagged for version compatibility reasons (and a few false-positives)from_type()
backendblack
andpyupgrade
The text was updated successfully, but these errors were encountered: