-
Notifications
You must be signed in to change notification settings - Fork 687
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
Make application code Python 3 compliant #4239
Conversation
Hey @kushaldas, for draft WIP PRs like that, could you use GitHub's draft pull request feature? That will make it easier to distinguish WIP PRs at a glance, and you can in fact avoid the scary all caps headlines (since a draft PR cannot be merged until it is promoted). |
Hey @kushaldas do you agree that the plan is:
|
597f894
to
629b08a
Compare
Codecov Report
@@ Coverage Diff @@
## develop #4239 +/- ##
===========================================
- Coverage 84.7% 84.41% -0.29%
===========================================
Files 43 43
Lines 2785 2798 +13
Branches 304 307 +3
===========================================
+ Hits 2359 2362 +3
- Misses 358 363 +5
- Partials 68 73 +5
Continue to review full report at Codecov.
|
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.
Some nits, but nothing that looks terribly wrong. I think some of these nits need to be cleaned up so we won't end up with extra parentheses in the codebase forever, but some changes matter less because they'll go away when we drop python2 support.
Also, there are a bunch of places where 2to3
added list(...)
around places where we made iterators out of dict
s (keys
, items
, values
). It looks like most of these aren't necessary.
I would suggest that this PR add a section to https://docs.securedrop.org/en/release-0.12.1/development/setup_development.html specifying what you're stating in the PR summary: how to build the dev environment for Python 3, and how to run the tests for Python 3, at least while both Python 2 and Python 3 are supported in development. If this is done, this PR can resolve #997 (which has been re-scoped to describe stage 1 of the Python 3 migration). |
In Python3 we need to use BytesIO and then later convert bytes to string for viewing svg QR code on the browser.
Also fixes the import statement for Python3
Requires any locale other than posix for click module.
(bandit will flag the use of input() in python 2 as a high severity security issue otherwise) Also adds a wrapper as a workaround for pytest-dev/pytest#1598
Based on code review and easy code reading of the branches.
409be5a
to
3a7470b
Compare
There were still some place with double parentheses for |
Status
Ready for review
Description of Changes
Moving the application code base into
Python3
inXenial
.Testing
There should be a new Python 3 test CI job that is passing, all other CI jobs should pass.
Tests should pass on Python 2 and Python 3
Deployment
Until we are ready to deploy Python 3 in a virtualenv, we'll continue to deploy using Python 2 on production servers. However, all changes once this PR are merged should work under both Python 2 and Python 3.
Checklist
If you made changes to the server application code:
make ci-lint
) and tests (make -C securedrop test
) pass in the development containerIf you made non-trivial code changes: