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 < 3.8 #117

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Drop python < 3.8 #117

wants to merge 3 commits into from

Conversation

aqeelat
Copy link

@aqeelat aqeelat commented Sep 6, 2023

Closes #111

Todo:

  • Update the tests
  • Update the code
  • Add notice to readme and docs
  • (Optional) replace mypy with native typing

Comment on lines +43 to +45
# FIXME: This is the only remaining usage for six. Do we still need this check?
# If so, then we should copy the function here and remove dependency on six
source_text = six.ensure_text(source_text)
Copy link
Author

Choose a reason for hiding this comment

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

review this part

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I'd say we should still decode bytes to preserve compatibility. So the type hint needs to be amended. Also the "Decode source after parsing to let Python 2..." doesn't even make sense and needs updating.

Comment on lines +15 to +16
# TODO: since we don't need python 2 anymore, should we move testdata/python3/astroid to testdata/astroid?
return os.path.join(os.path.dirname(__file__), "testdata", "python3", *path_parts)
Copy link
Author

Choose a reason for hiding this comment

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

review this part

Copy link
Contributor

Choose a reason for hiding this comment

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

it wouldn't hurt, but it's not required

@aqeelat
Copy link
Author

aqeelat commented Sep 6, 2023

@alexmojaki @dsagal I don't have permissions to add you as reviewers but please look at this pr.

@@ -34,9 +28,7 @@ classifiers =

[options]
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -146,6 +145,7 @@ def test_unicode_offsets(self):

def test_coding_declaration(self):
"""ASTTokens should be able to parse a string with a coding declaration."""
# TODO: figure out if the comment below is relevant
Copy link
Contributor

Choose a reason for hiding this comment

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

The Python 2 part can be removed, but let's test that it works with both bytes and str.

Comment on lines +277 to 280
# TODO: is this test still needed?
# This testcase imports print as function (using from __future__). Check that we can parse it.
# verify_all_nodes doesn't work on Python 2 because the print() call parsed in isolation
# is viewed as a Print node since it doesn't see the future import
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# TODO: is this test still needed?
# This testcase imports print as function (using from __future__). Check that we can parse it.
# verify_all_nodes doesn't work on Python 2 because the print() call parsed in isolation
# is viewed as a Print node since it doesn't see the future import
# This testcase imports print as function (using from __future__). Check that we can parse it.

Copy link
Author

Choose a reason for hiding this comment

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

yeah but why do we need to import print from future?

Copy link
Contributor

Choose a reason for hiding this comment

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

This probably isn't testing anything interesting any more but we might as well keep it.

@alexmojaki
Copy link
Contributor

Thanks for your hard work, sorry it took so long to respond

@a-detiste
Copy link

pîng

@kloczek
Copy link

kloczek commented Mar 15, 2024

Please add patch with filtering asttokens code over command find . -name \*py | xargs pyupgrade --py38.

@dsagal
Copy link
Member

dsagal commented Mar 16, 2024

Sorry everyone this hasn't moved. @aqeelat , any chance you could merge or rebase onto master? A couple other PRs landed since you opened this, and I am getting merge conflicts.

install_requires =
six >= 1.12.0
typing; python_version < "3.5"
install_requires = six >= 1.12.0

Choose a reason for hiding this comment

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

Doesn't this PR actually make six irrelevant and unused ?

Suggested change
install_requires = six >= 1.12.0

Choose a reason for hiding this comment

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

six usage remains in places

Choose a reason for hiding this comment

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

I see. I expect applying #117 (comment) would solve that, but it could also be done as a follow up patch.

Copy link

Choose a reason for hiding this comment

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

Please have look on de0a2e7 where is patch which removes use of six from all places.

Choose a reason for hiding this comment

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

I see "import six" immediately after following this link.

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.

Drop Python 2.7?
6 participants