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

chore: update python dependencies #693

Merged
merged 8 commits into from
Sep 16, 2023

Conversation

afuetterer
Copy link
Member

@afuetterer afuetterer commented Sep 7, 2023

Proposed Changes

This PR proposed the following changes:

  • update the python dependencies of the project, in particular Django 4.2
  • generate new django model migration files (required by Django 4.2)
  • broaden the version constraints to allow compatible releases (e.g. Django ~=4.2, instead of ~=4.2.0)
  • add CI job: install all optional dependency groups combined without failure
  • add 'allauth.account.middleware.AccountMiddleware' to MIDDLEWARE, which is required since django-allauth 0.56
  • remove SERIALIZE test setting (will be removed in Django 5.0)
  • move custom deletion logic from MembershipDeleteView.delete() to MembershipDeleteView.form_valid(), fixes DeleteViewCustomDeleteWarning
  • fix "passing unsaved objects to related filters" error in ProfileForm, when an unsaved user model instance was used in a related models lookup
  • fix "passing unsaved objects to related filters" warning in IntegrationForm, when an unsaved integration model instance was used in a related models lookup
  • add filterwarnings to pytest settings to prepare for upgrading to Django 5.0 (~12/2023)

Related issue: #442

Packages to be updated

$ pip list --outdated                                              
Package              Version Latest Type
-------------------- ------- ------ -----
coverage             6.5.0   7.3.0  wheel
Django               3.2.21  4.2.5  wheel
django-allauth       0.53.1  0.55.2 sdist
django-cleanup       6.0.0   8.0.0  wheel
django-filter        21.1    23.2   wheel
django-mptt          0.13.4  0.14.0 wheel
django-widget-tweaks 1.4.12  1.5.0  wheel
djangorestframework  3.12.4  3.14.0 wheel
Markdown             3.3.7   3.4.4  wheel
pypandoc             1.10    1.11   wheel
pytest-cov           4.0.0   4.1.0  wheel

Progress

  • toml: ignore errors -> ignore warnings
  • squash commits
  • add comment about psycopg[binary] and python 3.12-dev
  • fix problem with psycopg[binary] and python 3.12-dev
  • move django-allauth to optional dependencies
  • middleware
  • install rdmo[allauth] in optional-dependencies ci job
  • psycopg[binary]~=3.1, https://www.psycopg.org/psycopg3/docs/basic/install.html
  • Django 4.2.5
  • fix: RemovedInDjango50Warnings
  • fix: Passing unsaved model instances to related filters will no longer be allowed
  • django-allauth 0.56
  • djangorestframework 3.14.0: https://www.django-rest-framework.org/community/release-notes/#314x-series
  • pytest-cov 4.1.0
  • django-filter 23.2
  • Markdown 3.4.4
  • pypandoc 1.11
  • django-cleanup 8.0.0
  • django-mptt 0.14.0
  • django-widget-tweaks 1.5.0

Notes

pytest rdmo/core/tests/test_swagger.py --nomigrations -s -rw

Django Deprecation Timeline

@afuetterer afuetterer marked this pull request as draft September 7, 2023 05:19
@afuetterer afuetterer force-pushed the 442-update-dependencies branch 2 times, most recently from caf8621 to c57a17f Compare September 7, 2023 11:31
@afuetterer

This comment was marked as outdated.

@jochenklar

This comment was marked as outdated.

@jochenklar

This comment was marked as outdated.

@afuetterer

This comment was marked as resolved.

@afuetterer

This comment was marked as resolved.

@afuetterer

This comment was marked as resolved.

@jochenklar

This comment was marked as resolved.

@afuetterer

This comment was marked as resolved.

@afuetterer

This comment was marked as resolved.

@afuetterer afuetterer marked this pull request as ready for review September 11, 2023 05:51
@afuetterer
Copy link
Member Author

afuetterer commented Sep 11, 2023

It's done. 🥳
Tests are passing. All dependencies are up-to-date.

... but actually Django 5.0 is coming soon.

@jochenklar

This comment was marked as resolved.

@afuetterer
Copy link
Member Author

Thank you, glad I could help out.
I think from these dependency versions, Dependabot can start to submit PRs. We can update version constraints again for certain libraries, if they introduce breaking changes.

rdmo/core/settings.py Outdated Show resolved Hide resolved
rdmo/projects/forms.py Show resolved Hide resolved
@afuetterer afuetterer force-pushed the 442-update-dependencies branch 2 times, most recently from 25ed8a9 to 68194cb Compare September 13, 2023 05:49
@afuetterer
Copy link
Member Author

I adopted your requested changes. Happy if you review again.

]

[project.optional-dependencies]
allauth = [
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the new optional dependency group you asked for.

@@ -29,6 +29,10 @@
'allauth.account'
]

MIDDLEWARE += [
'allauth.account.middleware.AccountMiddleware'
Copy link
Member Author

Choose a reason for hiding this comment

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

The test config using allauth in installed apps needs this middleware to run, otherwise django will not even start.

pyproject.toml Outdated
ci = [
"coveralls",
"coveralls~=3.3",
"rdmo[allauth]",
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to have allauth available in CI for the tests, so I added the new group here as well.

"psycopg2-binary~=2.9.6",
# once python 3.12 is officially released, the psycopg team will release a psycopg-binary for it.
# replace these two lines with "psycopg[binary]~=3.1"
"psycopg[binary]~=3.1; python_version<'3.12'",
Copy link
Member Author

Choose a reason for hiding this comment

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

Python 3.8 - 3.11 with Django 4.2 can utilize psycopg3, i.e. psycopg[binary].

There will be a binary available, when Python 3.12 is officially released. I will adapt accordingly in October.

@afuetterer

This comment was marked as resolved.

@jochenklar jochenklar mentioned this pull request Sep 15, 2023
@jochenklar
Copy link
Member

Ah sorry, I merged the other two PR into dev-2.0.0.

@afuetterer
Copy link
Member Author

afuetterer commented Sep 15, 2023

I will rebase.
Could not sign my commits on this machine. :(

@afuetterer
Copy link
Member Author

Branch is rebased, the tests still passing.
Is there something else remaining to do?

@jochenklar
Copy link
Member

Thanks. In principle I can merge now. One last question, are you sure that pinning to foo~=A.B only is a good idea? This will also allow for foo~=A.C, so a different minor version.

@afuetterer
Copy link
Member Author

Thanks. In principle I can merge now. One last question, are you sure that pinning to foo~=A.B only is a good idea? This will also allow for foo~=A.C, so a different minor version.

I think it is a good idea for most libraries that use semantic versioning. django-allauth being 0.* could potentially break something anytime. But I think it might be better to be forgiving here and pin later? The CI and dependabot should catch something breaking, right?

You can decide if you prefer pinning Django==4.2.5, Django~=4.2.5 or Django~=4.2. I would suggest the last one. Maybe with pinning all dependencies that have v0?

What do you think? Otherwise of course add the patch versions to the toml file.

@jochenklar
Copy link
Member

Ok, I will review the dependencies later. I think a good compromise is to allow for a minor version change unless the major version is 0. Thanks again.

@jochenklar jochenklar merged commit bf004c6 into rdmorganiser:dev-2.0.0 Sep 16, 2023
18 checks passed
@afuetterer afuetterer deleted the 442-update-dependencies branch September 19, 2023 08:36
@MyPyDavid MyPyDavid added this to the 2.0.0 milestone Sep 19, 2023
CalamityC pushed a commit to CalamityC/rdmo that referenced this pull request Nov 23, 2023
…encies

chore: update python dependencies
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.

Update requirements, in particular Django 4.0
3 participants