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

remove python 2 support in securedrop server code #4859

Merged
merged 6 commits into from
Sep 25, 2019
Merged

Conversation

redshiftzero
Copy link
Contributor

Status

Ready for review

Description of Changes

Fixes #4699

Changes proposed in this pull request:

  • Removes python 2 support from SecureDrop server code
  • Removes python 2 CI job
  • Removes python 2 dev env support

Testing

For this one you should be able to rely on diff review and CI (application unit tests):

  • app-tests job (this is the python 3 application test job) should pass
  • all six calls from app code and tests should be gone
  • developer documentation should not reference python 2 compliance

Deployment

as of 1.0.0 the paths I'm removing are no longer ran in production, the other changes are mostly dev/CI facing

Checklist

If you made changes to the server application code:

  • Linting (make lint) and tests (make -C securedrop test) pass in the development container

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

If you made changes to documentation:

  • Doc linting (make docs-lint) passed locally

@rmol
Copy link
Contributor

rmol commented Sep 23, 2019

Fall cleaning! This looks great. 🙂

Found a few lingering references in the docs (which I'd link to if GitHub didn't insist on rendering them 🙁 ):

  • In contributor_guidelines.rst, line 128: SecureDrop uses Python2, that is why all type annotation/hints are mentioned as code comments.
  • In setup_development.rst, line 243, we're still recommending developers on Macs set up a Python 2 virtualenv.

And in install_files/securedrop-app-code/debian/securedrop-app-code.triggers the comment says we're registering interest in Python 2 interpreter changes, but we're not.

Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

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

Thank you @redshiftzero ! Changes look good to me.

While grepping through the repo for references to python2, came across these two findings (I think it's fine to merge as-is, since the former would require a fix for running installs, perhaps a follow up, if necessary is more suitable):

I'll leave this around for a bit to give the opportunity for others to chime in, otherwise will merge this tomorrow morning

@@ -146,9 +146,9 @@ safety: ## Run `safety check` to check python dependencies for vulnerabilities.
bandit: test-config ## Run bandit with medium level excluding test-related folders.
@command -v bandit || (echo "Please run 'pip install -U bandit'."; exit 1)
@echo "███ Running bandit..."
@bandit -ll --exclude ./admin/.tox,./admin/.venv,./admin/.eggs,./molecule,./testinfra,./securedrop/tests,./.tox,./.venv*,securedrop/config.py --recursive .
@bandit -ll --skip B322 --exclude ./admin/.tox,./admin/.venv,./admin/.eggs,./molecule,./testinfra,./securedrop/tests,./.tox,./.venv*,securedrop/config.py --recursive .
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 an interested observer can see https://docs.openstack.org/bandit/latest/api/bandit.blacklists.html#b322-input for more details

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that we still have some Python2 code (securedrop-admin), but that will be moved to python3 before the next release, so I think it's fine to merge

@rmol
Copy link
Contributor

rmol commented Sep 24, 2019

  Is this package strictly required for SecureDrop now? Since we are using a virtualenv, this package should no longer be necessary ?

That's a good catch. I think it should be removed.

Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

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

Opened #4864 to follow-up on removal of libpython2.7-dev, this is good to merge, thanks @redshiftzero and @rmol for the review

@emkll emkll merged commit da62232 into develop Sep 25, 2019
@emkll emkll deleted the python-2-removal branch September 25, 2019 14:18
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.

remove Python 2 code paths in server code
3 participants