-
Notifications
You must be signed in to change notification settings - Fork 43
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
Migrate all scripts to Python 3 #144
Conversation
Eh, this isn't quite right yet! Going to [WIP] it... |
circleci is failing because it's running flake8 in a python2 environment, so we have a chicken/egg problem: if we update our circleci configuration to run under python3, other PRs will fail CI. But until we do that update, this PR will fail CI. 🤔 |
Should have seen that one coming, @joshuathayer. Let's update the CI in this branch to switch the flake8 logic to python3, then all other active PRs remain passing. We have work elsewhere that we can port here, will share a patch... |
Hacky implementation, I admit. As part of the migration from Python2 to Python3, we must update the flake8 logic to use Python3, as well. The most straightforward way to do so is in a container. In order to support volume mounting in the container, we must update CircleCI to use the "machine" type for builds. The wrapper script logic is a bit convoluted here, would prefer to fold in the 'file' package requirement in the underlying container (freedomofpress/ci-python), but deferring that work for now to unblock development on the workstation. As for why the file package is necessary, flake8 autodiscovery will only lint .py files, not the various scripts we have here.
@joshuathayer Fixed the CircleCI config here. It now runs python3 flake8, and it's failing:
The setup should work for you locally, as well, so you can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looked at this diff, python 2-> 3 changes are uncontroversial so approving
re: flake8 in CI I think we could just use the circleci/python:3.x
docker container like we do in a couple other SecureDrop repos, e.g. https://github.com/freedomofpress/securedrop-client/blob/master/.circleci/config.yml#L16 which might be simpler, but approving nevertheless
This contains the minor changes necessary to our existing scripts for them to run using Python 3 rather than Python 2. Mostly that involves using the new
print
syntax and changing the hashbang lines.Closes #128