Skip to content
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 Python2 support #325

Closed
wants to merge 6 commits into from

Conversation

DjLegolas
Copy link
Contributor

@DjLegolas DjLegolas commented Dec 25, 2021

As python2 is already at its EOF state, we can drop all of the support to it.

This PR will contain all of the changes to this end.

Plan:

  • Remove __future__ imports
  • Remove six dependency
  • Remove future_builtins imports
  • Change the way we perform string formats (maybe even move to f-strings only?)
  • Make sure there are no sections that handles Py2 compatibilities
  • Remove files coding header

If you know about any other things to change, please write.

Copy link
Member

@cas-- cas-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are making wholesale changes, we can remove the following from all files:

# -*- coding: utf-8 -*-

deluge/crypto_utils.py Outdated Show resolved Hide resolved
deluge/core/alertmanager.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
deluge/event.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@cas--
Copy link
Member

cas-- commented Dec 26, 2021

Thanks for getting this work started.

Maybe look at using this: https://github.com/asottile/pyupgrade with --py36-plus since with can bump to >=3.6 (I know 3.6 EOL)

@bwitt
Copy link

bwitt commented Dec 26, 2021

+1 for using https://github.com/asottile/pyupgrade with --py36-plus ;
also suggest using https://github.com/asottile/reorder_python_imports with --py36-plus to fix up a few more things.

@DjLegolas
Copy link
Contributor Author

Thanks for getting this work started.

Maybe look at using this: https://github.com/asottile/pyupgrade with --py36-plus since with can bump to >=3.6 (I know 3.6 EOL)

Do you want to add it permanently to the linting process?

@cas--
Copy link
Member

cas-- commented Dec 27, 2021

What I would suggest is that this PR is wrapped up as is and we merge it. So things to finalise for this PR:

  • remove urllib imports in PreferencesManager to pass the linting
  • Any tests or reference to Python 2 use git grep -Ei "python.?2|py2[ 0-9]"

Then create a second PR that uses pyupgrade since that will be another huge changeset. Adding pyupgrade to pre-commit is helpful since if added as a pre-commit [manual] stage we can run it quickly with

pre-commit run pyupgrade -a

CHANGELOG.md Outdated
### Codebase

- Dropped support for Python 2

## 2.0.6 (WIP)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to remove this since we'll add it back when needed

@cas-- cas-- changed the title [WiP][1328] Drop Python2 support Drop Python2 support Dec 27, 2021
@DjLegolas DjLegolas marked this pull request as ready for review December 28, 2021 16:24
cas-- pushed a commit to cas--/Deluge that referenced this pull request Dec 28, 2021
* Removed all __future__ imports from code
* Removed all six dependencies
* Removed all future_builtins imports
* Removed all Python 2 related code

Closes: deluge-torrent#325
@cas-- cas-- closed this in 897955f Dec 28, 2021
@DjLegolas DjLegolas deleted the 1328-drop-py2 branch December 28, 2021 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants