-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Drop obsolete private definitions from twisted.python.compat #1363
Conversation
@@ -13,8 +13,7 @@ | |||
|
|||
from zope.interface import implementer, Interface, Attribute | |||
|
|||
from twisted.python.compat import (StringType, _coercedUnicode, | |||
iteritems, itervalues) | |||
from twisted.python.compat import StringType, iteritems, itervalues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringType, iteritems, and itervalues can all be easily dropped.
You can do that in this PR, or do a separate one if you want.
@@ -23,7 +23,7 @@ | |||
from twisted.application import service | |||
from twisted.internet import defer | |||
from twisted.python import log | |||
from twisted.python.compat import _coercedUnicode, unicode | |||
from twisted.python.compat import unicode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unicode
can go, and be replaced by str
. You can do that in this PR, or a separate one if you want.
@@ -4,7 +4,7 @@ | |||
# See LICENSE for details. | |||
|
|||
|
|||
from twisted.python.compat import _coercedUnicode, unicode | |||
from twisted.python.compat import unicode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unicode
can go
@@ -9,7 +9,7 @@ | |||
from twisted.trial.unittest import TestCase | |||
from twisted.spread import banana | |||
from twisted.python import failure | |||
from twisted.python.compat import long, iterbytes, _bytesChr as chr | |||
from twisted.python.compat import long, iterbytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long
can go, and be replaced by int
. You can do that in this PR, or a separate one if you want.
@@ -35,8 +35,7 @@ | |||
|
|||
# Twisted Imports | |||
from twisted.python import log, failure, reflect | |||
from twisted.python.compat import (unicode, _bytesChr as chr, range, | |||
comparable, cmp) | |||
from twisted.python.compat import unicode, range, comparable, cmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unicode
and range
can go
@@ -20,22 +20,27 @@ | |||
from twisted.internet import protocol | |||
from twisted.persisted import styles | |||
from twisted.python import log | |||
from twisted.python.compat import iterbytes, long, _bytesChr as chr | |||
from twisted.python.compat import iterbytes, long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long
can go, replace with int
@@ -36,8 +36,7 @@ | |||
from twisted.python import log | |||
from twisted.python import util | |||
from twisted.python.compat import (long, unicode, networkString, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long
, unicode
, and iteritems
can be easily dropped here
_b64encodebytes as encodebytes, | ||
intToBytes, iterbytes, long, nativeString, networkString, unicode, | ||
_matchingString, _get_async_param, | ||
unichr as chr, intToBytes, iterbytes, long, nativeString, networkString, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long
and unicode
can go
iterbytes, long, izip, nativeString, unicode, | ||
_b64decodebytes as decodebytes, _b64encodebytes as encodebytes, | ||
_bytesChr as chr) | ||
from twisted.python.compat import iterbytes, long, izip, nativeString, unicode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long
and unicode
can go
@@ -17,8 +17,7 @@ | |||
from twisted.conch import error | |||
from twisted.internet import defer | |||
from twisted.python import log | |||
from twisted.python.compat import ( | |||
nativeString, networkString, long, _bytesChr as chr) | |||
from twisted.python.compat import nativeString, networkString, long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long
can go
@@ -13,8 +13,7 @@ | |||
|
|||
|
|||
from twisted.python import log | |||
from twisted.python.compat import ( | |||
nativeString, raw_input, _b64decodebytes as decodebytes) | |||
from twisted.python.compat import nativeString, raw_input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raw_input
can be replaced with input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK. Since you are removing some obsolete compat definitions, I suggested a few
more that you can easily remove as part of this PR.
I want to handle the public definitions in a separate PR, because if I understand the compatibility policy correctly, those should all be deprecated instead of removed. |
3c4b6e8
to
bb6f8da
Compare
The ones I mentioned don't need to go through the whole deprecation cycle, since they were part of Python 2 to 3 porting, and Python 2 deprecation was announced over a year ago, with the last Twisted release supporting Python 2 being 20.3.0 |
What I'm worried about is some project using Twisted having |
Oh I see what you are saying. Just remove the usages of those things in the twisted files that I indicated. |
I'd prefer to do that in a separate PR, while also deprecating those names, so we can remove them from |
compat is going to be around for a while yet, because unfortunately it was written as a public module, with publicly exported methods and variables. So it is not easy to know who is using it. In hindsight, it would have been better to have the compat module as a completely private module only to be used internally in Twisted. But it's too late for that now. I think it would be nice if you could remove those uses of compat as I have suggested in this PR. |
While much of I have already filed a ticket for the public cleanup of |
Yes the compat needs to be looked at case by case. |
I created a draft version of the public definitions counterpart to this PR, see #1364. I hope the size of that diff will make it clear why I want to merge this PR with its current scope (private definitions only) instead of including cleanups of public definitions such as |
We can now use type annotations to verify argument types.
bb6f8da
to
7ca09b0
Compare
The feedback that I was suggesting you incorporate into this PR was this:
That would have been relatively easy to do. |
So it looks like you chose to merge this PR into Twisted, and put my name as a reviewer without me actually That's not very nice. |
I re-read your comments yesterday and thought "You can do that in this PR, or do a separate one if you want." applied to all of them. Since I was pretty far with #1364 and I think that PR addresses all of the issues you raised, I thought it was safe to merge this one and move the discussion to the new PR. The scope of this PR is addressing the private definitions, while #1364 is for the public definitions. I didn't want to offend you or your work as a reviewer. You're doing awesome work on Twisted and the issues you raise are valid improvements that I will address, just in a separate PR. |
I reverted the merge and created a new PR here: #1367. |
@mthuurne it is quite clear that I did not transition this PR into the approved state in GitHub, These documents are a bit long, sometimes a bit outdated, and sometimes a little bit hard to follow,
Looking at the audit trail of this PR, it is quite clear that you were very eager to merge this PR (which is OK to be But the fact that you merged, put my name as I'm going to stop reviewing your PR's. There are other Twisted developers that you can work with to review your PR's, so you hopefully you can still move |
I won't deny that I was a bit frustrated that the review wasn't progressing. However, I did the sensible thing and took some rest. After I had some sleep, I re-read the entire ticket from the start and concluded that while you would prefer more changes to be made in this PR, that was optional rather than mandatory. From your reaction, it is now clear to me that was an incorrect assessment, but that's how I interpreted the situation at that time. So that's when I decided to merge PR 1363 and asked for your review of PR 1364, which continues the work of cleaning up uses of Also I would like to stress again that I didn't ignore your review feedback: the removal of Regarding the development process, I should have waited for explicit approval instead of interpreting the situation on my own. But regarding the content, I think we are both working towards the same end result, which is Twisted with type annotations and correct documentation. I don't want one mistake on the process side to get in the way of reaching that goal. |
Regarding the development process, I should have waited for explicit approval instead of interpreting the situation on my own. |
Craig, this really seems a bit harsh to me. It seems clear to me that Maarten was a bit overenthusiastic, but he also took it upon himself to do the revert when it was made clear that you had not intended to approve the review and he'd misinterpreted the process. As such it's hard for me to read malice or intentional subversion into his actions here. Having everything in version control means we can address process-violation concerns here in retrospect as long as nobody's cut a release in the meanwhile. |
Many of the definitions in
twisted.python.compat
have become obsolete now that Python 2.7 support has been dropped. For private definitions, that means we can drop them as soon as Twisted itself no longer needs them.Contributor Checklist:
review
to the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.