Skip to content

[NFC] Remove Python 2 imports from __future__ #42086

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

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

dduan
Copy link
Contributor

@dduan dduan commented Mar 29, 2022

The __future__ we relied on is now, where the 4 specific things are
all included since Python 3.0:

  • absolute_import
  • print_function
  • unicode_literals
  • division

These import statements will be no-ops and are no longer necessary.

@dduan dduan force-pushed the dd/the-future-is-now branch from ccaeffd to c834ff5 Compare March 29, 2022 21:52
@dduan dduan closed this Apr 6, 2022
@dduan dduan reopened this Apr 6, 2022
@dduan
Copy link
Contributor Author

dduan commented Apr 6, 2022

swiftlang/swift-syntax#378
@swift-ci smoke test

@dduan dduan force-pushed the dd/the-future-is-now branch 2 times, most recently from c81c64b to c0a160e Compare April 6, 2022 07:42
@dduan
Copy link
Contributor Author

dduan commented Apr 6, 2022

swiftlang/swift-syntax#378
@swift-ci smoke test

@dduan dduan requested a review from ahoppen April 6, 2022 09:36
@ahoppen ahoppen requested review from gottesmm and shahmishal April 6, 2022 09:40
@ahoppen
Copy link
Member

ahoppen commented Apr 6, 2022

SwiftSyntax-related changes are looking good.

@gottesmm @shahmishal Do you know if there is anything in our infrastructure that might still be requiring the Python 2 scripts or any other implications of dropping Python 2 support from the build scripts?

@dduan
Copy link
Contributor Author

dduan commented Apr 8, 2022

ping 👋

I personally think this change poses minimal risk. If something went wrong, it should be fairly easy to revert because it's part of the project that rarely changes.

@etcwilde
Copy link
Member

I know that some folks (me) still run some older systems that still point /usr/bin/env python to python 2. I suspect those will complain about this change. Can you ensure that the scripts are shebang'd to /usr/bin/env python3? Thanks!

@dduan
Copy link
Contributor Author

dduan commented Apr 11, 2022

@etcwilde I already had to do it for a few scripts that CI runs. I was planning to do the shebang changes you suggested in a separate PR. But I suppose it's a reasonable request.

@dduan
Copy link
Contributor Author

dduan commented Apr 11, 2022

swiftlang/swift-syntax#378
@swift-ci smoke test

@etcwilde
Copy link
Member

Cool, thanks. I'd just meant for the ones changed in the initial PR, but this all looks good to me. It's a lot of files, but a really small change. Assuming things pass and no one else has issues with it, LGTM.

The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
@dduan dduan force-pushed the dd/the-future-is-now branch from b9477f6 to 946e05e Compare April 12, 2022 03:21
@dduan
Copy link
Contributor Author

dduan commented Apr 12, 2022

swiftlang/swift-syntax#378
@swift-ci smoke test

@ahoppen
Copy link
Member

ahoppen commented Apr 12, 2022

swiftlang/swift-syntax#378
@swift-ci Please smoke test Linux

1 similar comment
@dduan
Copy link
Contributor Author

dduan commented Apr 12, 2022

swiftlang/swift-syntax#378
@swift-ci Please smoke test Linux

@dduan dduan closed this Apr 12, 2022
@dduan dduan reopened this Apr 12, 2022
Copy link
Contributor

@edymtt edymtt left a comment

Choose a reason for hiding this comment

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

Apologies for my delay getting to this -- this looks good to me as well.

Thanks a lot for your work on migrating to Python 3!

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Also thanks for working on this from my side. You can merge this whenever you’re ready.

@dduan dduan merged commit 3dfc408 into swiftlang:main Apr 13, 2022
@dduan dduan deleted the dd/the-future-is-now branch April 13, 2022 21:01
@dduan
Copy link
Contributor Author

dduan commented Apr 13, 2022

thank you for the reviews!

@dkparmar562 dkparmar562 mentioned this pull request Apr 24, 2022
shahmishal pushed a commit that referenced this pull request Aug 9, 2022
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.

(cherry picked from commit 3dfc408)
shahmishal pushed a commit that referenced this pull request Aug 10, 2022
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.

(cherry picked from commit 3dfc408)
(cherry picked from commit 66bf05b)
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.

4 participants