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

Upgrade python and django #4019

Merged
merged 20 commits into from
Jun 15, 2023
Merged

Upgrade python and django #4019

merged 20 commits into from
Jun 15, 2023

Conversation

mbertrand
Copy link
Member

@mbertrand mbertrand commented Jun 2, 2023

Pre-Flight checklist

  • Testing
    • Code is tested
    • Changes have been manually tested

What are the relevant tickets?

Closes #3724

What's this PR do?

  • Upgrades python to 3.11, Django to 4.1
  • Fixes tests and functionality that broke as a result of the above

How should this be manually tested?

Basically test everything. In particular:

  • registration, login, logout, forgot password

  • hijacking users

  • make posts and comments

  • backpopulate course data (edx or ocw or xpro, pick whatever you like).

  • search

  • micromasters/open-discussions integration is a bit tricky to test locally, I was planning to leave this for RC.

Any background context you want to provide?

  • The moto version update doubled the python unit test time, but then I realized a few global fixtures that use moto were being unnecessarily called for every test via autouse=true. Fixing that dropped total python test time to normal.
  • djangorestframework-jwt (used for authentication between micromasters and open) has not been updated since 2017 and isn't compatible with python 3.11. A drop-in replacement package (drf-jwt) was used for this PR, but at some point we should probably switch to djangorestframework_simplejwt instead.
  • The gitguardian alerts are for betamax cassette files created/modified when running tests against the local reddit instance.
  • The django-hijack version update required a new template file, removal of django-hijack-admin, and some changes to how a hijacked user is detected. The UI that indicates you are logged in as a hijacked user looks different now.

What GIF best describes this PR or how it makes you feel?

R

@gitguardian
Copy link

gitguardian bot commented Jun 2, 2023

⚠️ GitGuardian has uncovered 11 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
6852801 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[staff_user-200].json View secret
6852801 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[staff_user-200].json View secret
6852801 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[staff_user-200].json View secret
6852801 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[staff_user-200].json View secret
6852802 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[staff_user-200].json View secret
6852802 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[staff_user-200].json View secret
6852803 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[user-404].json View secret
6852803 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[user-404].json View secret
6852804 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[user-404].json View secret
6852804 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[user-404].json View secret
6852804 Bearer Token 67048f3 cassettes/channels.views.posts_test.test_get_removed_post[user-404].json View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@mbertrand mbertrand force-pushed the mb/python310 branch 7 times, most recently from 30979ae to b1acbb9 Compare June 12, 2023 12:32
@mbertrand mbertrand changed the title Upgrade python Upgrade python and django Jun 12, 2023
@abeglova abeglova self-assigned this Jun 13, 2023
Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

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

LGTM Everything i tested worked great

@mbertrand
Copy link
Member Author

Note for future reference: I did not upgrade django beyond 4.1.x because django 4.2+ requires PostgreSQL 12+

@mbertrand mbertrand requested a review from a team as a code owner June 14, 2023 13:58
@mbertrand
Copy link
Member Author

Additional notes:

@mbertrand mbertrand merged commit b695e13 into master Jun 15, 2023
@mbertrand mbertrand deleted the mb/python310 branch June 15, 2023 18:54
This was referenced Jun 15, 2023
@mbertrand mbertrand mentioned this pull request Jun 16, 2023
3 tasks
@odlbot odlbot mentioned this pull request Jun 16, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade python to 3.10.x
2 participants