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

Start preparing for Python 3 support #20

Merged
merged 2 commits into from
May 3, 2019
Merged

Start preparing for Python 3 support #20

merged 2 commits into from
May 3, 2019

Conversation

Zac-HD
Copy link
Collaborator

@Zac-HD Zac-HD commented Apr 30, 2019

This pull request uses futurize to ensure, and enforce in CI, that the codebase is syntactically valid on Python 3 as well as Python 2. This includes requiring use of print as a function (not statement), and absolute imports.

The implementation consists of updating some configuration in .travis.yml and setup.py, then running the tool and a few hand-fixes (a large diff), so I suggest reviewing the two commits separately.

Because this changes from relative to absolute imports for Python 3 compatibility, I have made the other import-related changes at the same time. That's replacing comment headers with module docstrings (so tools understand they should be kept at the top of the file), removing unused imports with autoflake, and grouping and sorting imports with isort.

@Zac-HD Zac-HD force-pushed the py3-prep branch 2 times, most recently from a927cac to b177b85 Compare April 30, 2019 16:09
.travis.yml Show resolved Hide resolved
@Zac-HD
Copy link
Collaborator Author

Zac-HD commented Apr 30, 2019

Just FYI - I'm going to convert the file headers from comments to module-level docstrings, so that they will be respected by tools such as futurize, as well as isort when we come to the autoformatter stage.

@Zac-HD Zac-HD force-pushed the py3-prep branch 4 times, most recently from e80db1d to c4bb5ca Compare April 30, 2019 18:45
From running futurize, autoflake, isort, and a hand-rolled header fixing script.
@Zac-HD
Copy link
Collaborator Author

Zac-HD commented May 3, 2019

Hi @jsn1993 - just as a process issue, the sequence of porting steps is pretty important to get Python 3 working without breaking Python 2. Basically, we need to:

  1. Merge this PR
  2. Merge @ptpan's translation passes (possibly before this PR, if it's easier for him)
  3. Finally, I'll come back and implement Run tests against PyPy and Python 3 on Travis #22 and Adopt the Black code style #23 in that order.

@jsn1993
Copy link
Contributor

jsn1993 commented May 3, 2019 via email

@Zac-HD
Copy link
Collaborator Author

Zac-HD commented May 3, 2019

No problem! I'm just waiting for Peitian's translation pull requests - this could be merged right now, but might make it much harder for him so I want to keep the option of merging those first.

@ptpan
Copy link
Contributor

ptpan commented May 3, 2019

Let's get this pull request merged first. I will be mainly focusing on my course project next week so merging the translation pass probably has to wait after the next week...

@Zac-HD
Copy link
Collaborator Author

Zac-HD commented May 3, 2019

Awesome - is there anything else that needs to happen before I hit merge?

@ptpan
Copy link
Contributor

ptpan commented May 3, 2019

FYI I did a push to revert the mis-commit from last night. I think this PR is ready to merge now.

@Zac-HD Zac-HD merged commit 1c6f1b7 into master May 3, 2019
@jsn1993 jsn1993 deleted the py3-prep branch May 4, 2019 01:39
ptpan pushed a commit that referenced this pull request Jun 8, 2019
Start preparing for Python 3 support
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.

3 participants