-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Remove Python2 #6890
Comments
two quick remarks:
|
@funkyfuture I agree with the first remark, and for the second, I don't see any problem on dropping that. |
Closes: docker#6890 Signed-off-by: Bastian Venthur <[email protected]>
see docker#6890 Signed-off-by: Nicolas De Loof <[email protected]>
see #6890 Signed-off-by: Nicolas De Loof <[email protected]>
Closes: docker#6890 Signed-off-by: Bastian Venthur <[email protected]>
I'm not arguing against dropping Python 2 support, but all of these language features are already supported on Python 2. |
There's probably many places a pure python 3 codebase could offer improvements, but my main motivation here is to reduce the maintenance effort. |
and Python 2.7 is EOL and is going to be removed from the next Debian and Ubuntu releases. |
see #6890 Signed-off-by: Nicolas De Loof <[email protected]>
see #6890 Signed-off-by: Nicolas De Loof <[email protected]>
see #6890 Signed-off-by: Nicolas De Loof <[email protected]>
Hi,
I think it could be worthwhile to leave this as a deprecation notice for some time after the change, so folks with broken python support who come here can know what's up (that this is intentional, etc.) Otherwise all sounds reasonable to me. 👍 Edit: Or you could pin this issue. Just something to avoid issue spam and to give clarity to the situation. Edit 2:
Not strictly true. The executable named See:
|
---- Downgrade gitpython to 2.1.15 and idna to 2.8 Signed-off-by: Ulysses Souza <[email protected]> Removed Python2 support Closes: docker#6890 Signed-off-by: Bastian Venthur <[email protected]> Removed six Signed-off-by: Bastian Venthur <[email protected]>
---- Downgrade gitpython to 2.1.15 and idna to 2.8 Signed-off-by: Ulysses Souza <[email protected]> Removed Python2 support Closes: docker#6890 Signed-off-by: Bastian Venthur <[email protected]> Removed six Signed-off-by: Bastian Venthur <[email protected]> Removed now useless check for version_info >= 2.7 Signed-off-by: Bastian Venthur <[email protected]> Removed now unused get_output_stream method Signed-off-by: Bastian Venthur <[email protected]> Import unittest.mock directly. We don't need to support Python2 anymore. Signed-off-by: Bastian Venthur <[email protected]>
---- Downgrade gitpython to 2.1.15 and idna to 2.8 Signed-off-by: Ulysses Souza <[email protected]> Removed Python2 support Closes: docker#6890 - Removed six - Removed now useless check for version_info >= 2.7 - Removed now unused get_output_stream method - Import unittest.mock directly. How we removed six from docker-compose We expect this to happen in a couple steps, 1. Remove six entirely, and remove python2.7 from requirements, setup, etc. 2. cleanup code that is left (All the conditionals that are now always True or False) 3. Remove all unnecessary `__future__` commands, by modifying the pre-commit-hook of python sourts to be `--py3-plus` After removing all occurrances, we made sure `six` wasn't used anymore running a search for ```txt six\.\w+\(([^()]+)\) ``` - We replaced all types for their corresponding python3 types. Note how six returns a tuple for the isinstance (since in python2 there are more than one type, but that isn't necessary in python3, so we removed the tuple and instead used the class directly) We then searched for all instances where code could be pruned. (i.e., if/else clauses that now where always `True` or `False`) After that, - Removed inheritinng from `object` super class, it isn't necessary in python3 - `# coding ... utf-8` statements are not needed - `super(ClassName, self)` can now be replaced with `super()`
---- Removed Python2 support Closes: docker#6890 - Removed six - Removed now useless check for version_info >= 2.7 - Removed now unused get_output_stream method - Import unittest.mock directly. How we removed six from docker-compose We expect this to happen in a couple steps, 1. Remove six entirely, and remove python2.7 from requirements, setup, etc. 2. cleanup code that is left (All the conditionals that are now always True or False) 3. Remove all unnecessary `__future__` commands, by modifying the pre-commit-hook of python sourts to be `--py3-plus` After removing all occurrances, we made sure `six` wasn't used anymore running a search for ```txt six\.\w+\(([^()]+)\) ``` - We replaced all types for their corresponding python3 types. Note how six returns a tuple for the isinstance (since in python2 there are more than one type, but that isn't necessary in python3, so we removed the tuple and instead used the class directly) We then searched for all instances where code could be pruned. (i.e., if/else clauses that now where always `True` or `False`) After that, - Removed inheritinng from `object` super class, it isn't necessary in python3 - `# coding ... utf-8` statements are not needed - `super(ClassName, self)` can now be replaced with `super()` Signed-off-by: Alejandro G. Recuenco <[email protected]>
---- Removed Python2 support Closes: docker#6890 - Removed six - Removed now useless check for version_info >= 2.7 - Removed now unused get_output_stream method - Import unittest.mock directly. How we removed six from docker-compose We expect this to happen in a couple steps, 1. Remove six entirely, and remove python2.7 from requirements, setup, etc. 2. cleanup code that is left (All the conditionals that are now always True or False) 3. Remove all unnecessary `__future__` commands, by modifying the pre-commit-hook of python sourts to be `--py3-plus` After removing all occurrances, we made sure `six` wasn't used anymore running a search for ```txt six\.\w+\(([^()]+)\) ``` - We replaced all types for their corresponding python3 types. Note how six returns a tuple for the isinstance (since in python2 there are more than one type, but that isn't necessary in python3, so we removed the tuple and instead used the class directly) We then searched for all instances where code could be pruned. (i.e., if/else clauses that now where always `True` or `False`) After that, - Removed inheritinng from `object` super class, it isn't necessary in python3 - `# coding ... utf-8` statements are not needed - `super(ClassName, self)` can now be replaced with `super()` Signed-off-by: alexrecuenco <[email protected]>
---- Removed Python2 support Closes: docker#6890 - Removed six - Removed now useless check for version_info >= 2.7 - Removed now unused get_output_stream method - Import unittest.mock directly. Signed-off-by: Ulysses Souza <[email protected]>
Closes: docker#6890 Signed-off-by: Bastian Venthur <[email protected]>
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: #6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Closes: #6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <[email protected]>
Is your feature request related to a problem? Please describe.
As January 1st approaches, support for "Python 2" gets to its end. By deprecating it we can free some machine/time on CI and maybe simplify our "dependency matrix"
Note that this issue is not meant to be executed before the January 1st 2020. The early public issue is just to track it and talk/communicate about.
Describe the solution you'd like
six
from requirements.txtThe text was updated successfully, but these errors were encountered: