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

Update python version in API and attribution #5095

Merged
merged 4 commits into from
Oct 31, 2024
Merged

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Oct 28, 2024

Fixes

Fixes #4940 by @sarayourfriend

Description

Updates python version to 3.12 in the API and python/openverse-attribution. Some packages also had to be updated to work with the new version of Python.

Testing Instructions

The CI should pass, and the API should work as usual

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@obulat obulat requested a review from a team as a code owner October 28, 2024 09:16
@obulat obulat requested review from dhruvkb and stacimc and removed request for a team October 28, 2024 09:16
@openverse-bot openverse-bot added 🧱 stack: api Related to the Django API 🟧 priority: high Stalls work on the project or its dependents 🧰 goal: internal improvement Improvement that benefits maintainers, not users 💻 aspect: code Concerns the software code in the repository labels Oct 28, 2024
@obulat obulat force-pushed the update/api-python-version branch 2 times, most recently from 1942168 to 9cff8cd Compare October 28, 2024 17:37
@obulat obulat self-assigned this Oct 28, 2024
Copy link
Collaborator

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

A few notes before we consider merging this!

"django-uuslug >=2.0.0, <3",
"djangorestframework >=3.14.0, <4",
"drf-spectacular >=0.27.1, <0.28",
"elasticsearch==8.13.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this package and pook were the only ones that were changed in this list, and both were pinned. Is there a specific version that should be set as the upper bound instead so these can still receive patch updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for catching these! Initially, pdm automatically updated more packages, but some of the tests with pook were failing, so I reverted most unnecessary changes manually, and some reversals resulted in pinned versions :(

Copy link
Collaborator

Choose a reason for hiding this comment

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

@obulat if you noticed any issues with Pook, do you mind opening an issue upstream so I can fix it?

"uvicorn[standard] >=0.30, <0.31",
"openverse-attribution @ file:///${PROJECT_ROOT}/../packages/python/openverse-attribution",
"structlog-sentry>=2.1.0",
"pook==2.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be in the dev-dependencies section? Is it needed for core application code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in c9a8fcb

@sarayourfriend
Copy link
Collaborator

I was going to suggest looking at going straight to 3.13 (it is GA since last week), but Django 5.1 is required before that's possible (so #4015).

@obulat
Copy link
Contributor Author

obulat commented Oct 28, 2024

I was going to suggest looking at going straight to 3.13 (it is GA since last week), but Django 5.1 is required before that's possible (so #4015).

Great to know. We'll go step by step here :) Some changes in this PR's initial commits caused test failures due to pook mocks not working as expected, so we might have to debug while updating these packages.

Copy link
Member

@krysal krysal left a comment

Choose a reason for hiding this comment

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

I recreated the image and everything seems to be working correctly 👍

env COMPOSE_PROFILES="api" just up --force-recreate --build
just catalog/up && just api/init

@obulat obulat merged commit 403596c into main Oct 31, 2024
52 checks passed
@obulat obulat deleted the update/api-python-version branch October 31, 2024 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Upgrade API to Python 3.12
5 participants