Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Strategy for incremental Django Ninja upgrade (v1 to v2 Pydantic) #1399

Unanswered
BEMELON asked this question in Q&A
Discussion options

I'm working on upgrading Django Ninja and Pydantic in my project:

Current setup:

  • Django Ninja < 1.0 (0.22.2)
  • Pydantic v1

Target setup:

  • Django Ninja >= 1.0
  • Pydantic v2

Challenge:
Django Ninja 0.22.2 strictly depends on Pydantic v1 (pydantic>=1.6,<2.0.0). I tried to maintain compatibility by updating import statements to use pydantic.v1, but this approach doesn't work with Django Ninja 0.22.2. The codebase is too large to upgrade everything at once.

Has anyone successfully managed incremental migration in this scenario? What strategies did you use?

You must be logged in to vote

Replies: 1 comment

Comment options

Usually process is straightforward if you use standard methods and tools

from django-ninja side you can apply change Config -> Meta (Config.model_fields > Meta.fields) - NOTE: this is not required but recomended as Config will be eventually removed

as for pydantic - you can follow their guide - https://docs.pydantic.dev/latest/migration/#migration-guide

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /