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 Python 2 support #515

Merged
merged 1 commit into from May 7, 2020
Merged

Drop Python 2 support #515

merged 1 commit into from May 7, 2020

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented May 7, 2020

Fixes #514

The following commands were executed to clean all source files:

sed -i '/from __future__.*$/d' {} +
sed -i 's/(object):/:/g' {} +
sed -i 's/super([^)]*,[^)]*)/super()/g' {} +
sed -i '/\(import six\|from six\).*$/d' {} +
sed -i '/\(six\.add_metaclass\).*$/d' {} +
sed -i 's/six.integer_types/int/g' {} +
sed -i 's/six.string_types/str/g' {} +
sed -i 's/six.text_type/str/g' {} +
sed -i 's/six.binary_type/bytes/g' {} +
sed -i 's/six.moves.StringIO/io.StringIO/g' {} +
sed -i 's/six.StringIO/io.StringIO/g' {} +
sed -i 's/six.moves.BytesIO/io.BytesIO/g' {} +
sed -i 's/six.BytesIO/io.BytesIO/g' {} +
sed -i 's/six.moves.range/range/g' {} +
sed -i 's|six.iterkeys(\([^)]*\))|\1.keys()|' {} +
sed -i 's|six.iteritems(\([^)]*\))|\1.items()|' {} +
sed -i 's|six.itervalues(\([^)]*\))|\1.values()|' {} +

The operations were applied to all files using find -exec:

find . -type f -not -path './.git*' -exec

Note the exclusion of the .git folder which is very important.

Copy link
Member

@greschd greschd left a comment

Choose a reason for hiding this comment

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

Aw yeah 🥳 I've added a few minor comments - good to go for me once the tests pass.

CHANGELOG.md Show resolved Hide resolved
@@ -86,14 +83,13 @@
},
"install_requires": [
Copy link
Member

Choose a reason for hiding this comment

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

I think we were missing the six requirement before 😅

tests/parsers/test_pw2gw.py Outdated Show resolved Hide resolved
@greschd
Copy link
Member

greschd commented May 7, 2020

It seems the pre-commit 2.X series supports only py36+

@sphuber sphuber force-pushed the fix/514/drop-python-2-support branch from 79a730c to d543396 Compare May 7, 2020 09:02
@sphuber
Copy link
Contributor Author

sphuber commented May 7, 2020

It seems the pre-commit 2.X series supports only py36+

yeah, in my other projects I therefore split the dev extra into tests and pre-commit. That way I can just run pre-commit on CI with python 3.8 with latest packages and still run tests with python 3.5. For now I just downgraded pre-commit because I don't want to mix those extra changes in this huge PR. I will do that straight after this is merged with some additional CI related stuff

@greschd
Copy link
Member

greschd commented May 7, 2020

Yeah I think that's good practice anyway - the fewer extra dependencies are installed when testing, the less likely to forget something that should be in install_requires.

The following commands were executed to clean all source files:

    sed -i '/from __future__.*$/d' {} +
    sed -i 's/(object):/:/g' {} +
    sed -i 's/super([^)]*,[^)]*)/super()/g' {} +
    sed -i '/\(import six\|from six\).*$/d' {} +
    sed -i '/\(six\.add_metaclass\).*$/d' {} +
    sed -i 's/six.integer_types/int/g' {} +
    sed -i 's/six.string_types/str/g' {} +
    sed -i 's/six.text_type/str/g' {} +
    sed -i 's/six.binary_type/bytes/g' {} +
    sed -i 's/six.moves.StringIO/io.StringIO/g' {} +
    sed -i 's/six.StringIO/io.StringIO/g' {} +
    sed -i 's/six.moves.BytesIO/io.BytesIO/g' {} +
    sed -i 's/six.BytesIO/io.BytesIO/g' {} +
    sed -i 's/six.moves.range/range/g' {} +
    sed -i 's|six.iterkeys(\([^)]*\))|\1.keys()|' {} +
    sed -i 's|six.iteritems(\([^)]*\))|\1.items()|' {} +
    sed -i 's|six.itervalues(\([^)]*\))|\1.values()|' {} +

The operations were applied to all files using `find -exec`:

    find . -type f -not -path './.git*' -exec

Note the exclusion of the `.git` folder which is very important.
@sphuber sphuber force-pushed the fix/514/drop-python-2-support branch from d543396 to c3348b3 Compare May 7, 2020 09:06
@greschd greschd self-requested a review May 7, 2020 09:11
@greschd
Copy link
Member

greschd commented May 7, 2020

image
Might need a change in branch protection settings.

@sphuber sphuber requested a review from greschd May 7, 2020 09:12
@sphuber sphuber merged commit a417071 into develop May 7, 2020
@sphuber sphuber deleted the fix/514/drop-python-2-support branch May 7, 2020 09: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
Development

Successfully merging this pull request may close these issues.

Remove Python 2 compatibility
2 participants