Pydantic Migration Guides

How to move BaseSettings to pydantic-settings in Pydantic v2

Fix BaseSettings migrations for Pydantic v2 and keep config cleanup inside the supported subset.

Start here

The safe first move

Import BaseSettings from pydantic_settings and update supported Config keys when the settings class stays inside the safe subset.

Stop before automation when: Removed config keys. Indirect imports and wrappers.

Target shape

from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    api_url: str

Repo fit check

Want to know if your repo has this pattern?

Run the matching scanner locally first. Read the free findings and manual alternatives; consider paid cleanup only if supported patterns repeat enough to justify the price.

  • Local scan; no repository upload.
  • Supported findings are separated from manual-review findings.
  • Buy only when the repeated pattern is worth automating.
Run the Pydantic scan first View example report See when to buy
Example scan summary
supported_findings: 38
manual_review_findings: 6
files_uploaded: 0
confidence: reviewable

Why this page exists

How to move BaseSettings to pydantic-settings in Pydantic v2

BaseSettings left core Pydantic, so the migration is both an import move and a config cleanup.

Direct answer

What changes

Import BaseSettings from pydantic_settings and update supported Config keys when the settings class stays inside the safe subset.

Example

Before and after

Before

from pydantic import BaseSettings

class Settings(BaseSettings):
    api_url: str

After

from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    api_url: str

Decision path

If this repeats across the repo, open the evaluation pages next.

The cleanup pack is strongest when the repo still uses direct pydantic imports and a clean validator/settings/config subset.

  • The repo has direct pydantic or pydantic.v1 imports, BaseSettings usage, safe Config blocks, or simple validators.
  • The migration pain is repetitive v1-to-v2 cleanup, not a custom semantic rewrite.
  • If the scan output is ambiguous, review its findings and upstream guidance. Do not buy expecting unsupported cases to be resolved.

Typical symptoms

  • BaseSettings imports break after the v2 bump.
  • Settings models often also carry Config migrations.
  • Teams want one pass that separates easy moves from hard ones.

What the product covers

  • Direct BaseSettings import moves.
  • Connected safe Config-to-model_config cleanup.
  • Cross-links to the model_config guide.

Manual-review boundary

  • Removed config keys.
  • Indirect imports and wrappers.
  • Files that already depend on unsupported validator signatures.

FAQ

Fast answers before you decide

What is the safest fix for BaseSettings moved pydantic v2?

Import BaseSettings from pydantic_settings and update supported Config keys when the settings class stays inside the safe subset.

Can BaseSettings moved pydantic v2 be automated?

Automate only the supported subset: Direct BaseSettings import moves. Connected safe Config-to-model_config cleanup. Cross-links to the model_config guide. Keep these cases in manual review: Removed config keys. Indirect imports and wrappers. Files that already depend on unsupported validator signatures.

When should I buy Pydantic v1 to v2 Migration Cleanup Pack?

Use Pydantic v1 to v2 Migration Cleanup Pack only when this pattern repeats across enough files that manual cleanup is still costly. Use the free report and upstream guide to evaluate fit. Buy only if repeated supported edits justify the price; no paid assessment is required.

Purchase fit

Choose the lowest-risk next step.

One matching page is not enough by itself. Run the local scan, then buy only when the same supported pattern appears often enough to matter.

Buy if

  • The repo has direct pydantic or pydantic.v1 imports, BaseSettings usage, safe Config blocks, or simple validators.
  • The migration pain is repetitive v1-to-v2 cleanup, not a custom semantic rewrite.
  • The team accepts manual-review findings for alias-heavy imports and signature-heavy validators.

What the workflow includes

  • Installable local CLI workflow, not a hosted black box.
  • Supported validator, settings, import, and config rewrites.
  • Demo report, public proof, coverage notes, rollback checklist, and buyer terms.

Before checkout

  • Stripe Checkout handles secure payment and receipts.
  • Download your purchased ZIP after payment.
  • Runs locally; no hosted API, repo upload, or production credentials needed.
  • The free report includes the evidence needed to evaluate fit. Paid summary and template add-ons are optional.
  • 14-day refund review for published-scope or delivery mismatches.