Skip to content

Replace deprecated Pydantic call#930

Merged
ogenstad merged 1 commit intostablefrom
pog-replace-deprecated-pydantic-call
Apr 16, 2026
Merged

Replace deprecated Pydantic call#930
ogenstad merged 1 commit intostablefrom
pog-replace-deprecated-pydantic-call

Conversation

@ogenstad
Copy link
Copy Markdown
Contributor

@ogenstad ogenstad commented Apr 9, 2026

Why

When you run "pytest test/unit" there's deprecation warnings regarding the use of the replaced method from Pydantic.

tests/unit/doc_generation/test_helpers.py::TestBuildConfigProperties::test_address_property_exists
tests/unit/doc_generation/test_helpers.py::TestBuildConfigProperties::test_address_has_env_vars
  /Users/patrick/Code/opsmill/infrahub-sdk-python/docs/docs_generation/helpers.py:21: PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
    for field_name, field in settings.model_fields.items():

What changed

  • Replace method call with class method.

Summary by CodeRabbit

  • Refactor
    • Improved environment variable extraction by using class-level field definitions instead of instance-level fields. No functional changes to output or public interfaces.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 592b2deb-90e0-4bcf-838b-a562bcb01ce9

📥 Commits

Reviewing files that changed from the base of the PR and between ba0a3bd and 2a45f05.

📒 Files selected for processing (1)
  • docs/docs_generation/helpers.py

Walkthrough

A modification was made to the get_env_vars() function in docs/docs_generation/helpers.py. The change updates the function to iterate over ConfigBase.model_fields (class-level fields) rather than settings.model_fields (instance-level fields) when extracting field environment-variable mappings through EnvSettingsSource._extract_field_info. The extraction logic and output structure remain unchanged. This constitutes a single line modification with no impact to exported or public entities.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing a deprecated Pydantic method call with the recommended approach.
Description check ✅ Passed The description covers the Why section with clear context about deprecation warnings, and the What changed section explains the fix. However, other important sections like testing instructions and impact/rollout are missing or incomplete.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2a45f05
Status: ✅  Deploy successful!
Preview URL: https://2fb698a6.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-replace-deprecated-pydan.infrahub-sdk-python.pages.dev

View logs

@github-actions github-actions bot added the type/documentation Improvements or additions to documentation label Apr 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##           stable     #930      +/-   ##
==========================================
- Coverage   80.94%   80.68%   -0.26%     
==========================================
  Files         132      119      -13     
  Lines       11087    10336     -751     
  Branches     1701     1551     -150     
==========================================
- Hits         8974     8340     -634     
+ Misses       1559     1473      -86     
+ Partials      554      523      -31     
Flag Coverage Δ
integration-tests 41.72% <ø> (-1.07%) ⬇️
python-3.10 51.84% <ø> (-2.11%) ⬇️
python-3.11 51.84% <ø> (-2.11%) ⬇️
python-3.12 51.84% <ø> (-2.11%) ⬇️
python-3.13 51.84% <ø> (-2.09%) ⬇️
python-3.14 53.52% <ø> (-2.02%) ⬇️
python-filler-3.12 24.04% <ø> (+1.62%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ogenstad ogenstad marked this pull request as ready for review April 9, 2026 08:52
@ogenstad ogenstad requested a review from a team April 15, 2026 14:03
@ogenstad ogenstad merged commit 06577ba into stable Apr 16, 2026
21 checks passed
@ogenstad ogenstad deleted the pog-replace-deprecated-pydantic-call branch April 16, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants