Skip to content

chore(docker): suppress pydantic v1 warning on Python 3.14#552

Merged
Aureliolo merged 1 commit intomainfrom
fix/suppress-pydantic-v1-warning
Mar 18, 2026
Merged

chore(docker): suppress pydantic v1 warning on Python 3.14#552
Aureliolo merged 1 commit intomainfrom
fix/suppress-pydantic-v1-warning

Conversation

@Aureliolo
Copy link
Copy Markdown
Owner

Summary

Litestar's pydantic plugin imports pydantic.v1 for version detection, triggering a noisy UserWarning on Python 3.14. This spams the container logs on every startup. The warning is harmless -- no actual pydantic v1 usage, just an import-time compatibility check.

Adds PYTHONWARNINGS="ignore::UserWarning:pydantic.v1" to the backend Dockerfile to filter it. Will be removed when Litestar v3 drops the v1 compat layer entirely.

Test plan

  • Rebuild backend image and verify warning no longer appears in logs
  • Verify other warnings and errors are NOT suppressed (only pydantic.v1 UserWarning filtered)

Ref: #551

Litestar's pydantic plugin imports pydantic.v1 for version detection,
triggering a noisy UserWarning on Python 3.14. This is harmless (no
actual v1 usage) and will be fixed when Litestar v3 drops the v1
compat layer. Filter it via PYTHONWARNINGS to keep logs useful.

Ref: #551
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: acd70945-f7b5-4898-a967-a1140129d7dc

📥 Commits

Reviewing files that changed from the base of the PR and between 9b5655b and dd169ce.

📒 Files selected for processing (1)
  • docker/backend/Dockerfile
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Sandbox
  • GitHub Check: Build Web
  • GitHub Check: Build Backend
  • GitHub Check: Analyze (python)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-18T11:08:24.271Z
Learning: Applies to docker/Dockerfile.backend : Docker: use 3-stage build pattern (builder → setup → distroless runtime) for Python backend; non-root user (UID 65532); CIS-hardened
📚 Learning: 2026-03-18T11:08:24.271Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-18T11:08:24.271Z
Learning: Applies to docker/Dockerfile.backend : Docker: use 3-stage build pattern (builder → setup → distroless runtime) for Python backend; non-root user (UID 65532); CIS-hardened

Applied to files:

  • docker/backend/Dockerfile
📚 Learning: 2026-03-18T11:08:24.271Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-18T11:08:24.271Z
Learning: Applies to docker/Dockerfile.sandbox : Docker: sandbox uses Python 3.14 + Node.js + git with non-root (UID 10001) for agent code execution isolation

Applied to files:

  • docker/backend/Dockerfile
📚 Learning: 2026-03-15T11:48:14.867Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T11:48:14.867Z
Learning: Applies to docker/{Dockerfile*,compose.yml} : Docker: Backend uses 3-stage build (builder → setup → distroless runtime), Chainguard Python, non-root (UID 65532), CIS-hardened. Web uses nginxinc/nginx-unprivileged, Vue 3 SPA with PrimeVue + Tailwind CSS, SPA routing, API/WebSocket proxy to backend.

Applied to files:

  • docker/backend/Dockerfile
📚 Learning: 2026-03-15T11:48:14.867Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T11:48:14.867Z
Learning: Applies to docker/** : Docker build context: single root .dockerignore (both images build with context: .). Tags: CI tags images with version from pyproject.toml ([tool.commitizen].version), semver, and SHA.

Applied to files:

  • docker/backend/Dockerfile
📚 Learning: 2026-03-15T11:48:14.867Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T11:48:14.867Z
Learning: Dependabot: auto-updates Docker image digests and versions daily.

Applied to files:

  • docker/backend/Dockerfile
🔇 Additional comments (1)
docker/backend/Dockerfile (1)

119-123: LGTM — well-documented temporary workaround.

The PYTHONWARNINGS filter syntax is correct and the comment clearly explains the rationale and tracks removal via issue #551.

One minor note: this filter suppresses all UserWarning emissions from pydantic.v1, not just the specific compatibility warning. Given that pydantic.v1 is a shim module with no direct usage in the codebase, this broader scope is acceptable. Just ensure the tracking issue is closed when Litestar v3 ships so this can be cleaned up.


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Suppressed Pydantic v1 compatibility warnings in the Docker runtime environment.

Walkthrough

An environment variable is added to the Docker runtime stage to suppress Pydantic v1 compatibility warnings during Python runtime. The change sets PYTHONWARNINGS="ignore::UserWarning:pydantic.v1" without altering entrypoint, command semantics, or control flow.

Changes

Cohort / File(s) Summary
Docker Configuration
docker/backend/Dockerfile
Added environment variable to suppress Pydantic v1 compatibility warnings in the runtime stage.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: suppressing a pydantic v1 warning in the Docker configuration for Python 3.14.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation (Litestar's pydantic plugin warning on Python 3.14), the solution (PYTHONWARNINGS environment variable), and the intended temporary nature of this change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/suppress-pydantic-v1-warning
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/suppress-pydantic-v1-warning
📝 Coding Plan
  • Generate coding plan for human review comments

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

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where a UserWarning from pydantic.v1 was spamming container logs on Python 3.14 due to Litestar's version detection mechanism. By adding a specific environment variable to the Dockerfile, this PR effectively suppresses the warning, improving log clarity without impacting the application's functionality, as the warning does not signify actual Pydantic v1 usage.

Highlights

  • Suppress Pydantic v1 Warning: An environment variable PYTHONWARNINGS="ignore::UserWarning:pydantic.v1" was added to the backend Dockerfile to suppress a noisy, but harmless, UserWarning related to Pydantic v1 compatibility checks in Litestar when running on Python 3.14.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to suppress a UserWarning from Pydantic's v1 compatibility layer that appears on Python 3.14. The change adds a PYTHONWARNINGS environment variable to the backend Dockerfile. While this approach is effective, I've suggested an alternative of handling this within the Python application code for better portability and encapsulation. This is a minor suggestion for improving code organization.

Comment on lines +119 to +123
# Suppress Pydantic v1 compatibility warning from Litestar's plugin detection
# on Python 3.14+ (harmless import-time check, not actual v1 usage).
# Tracked: Litestar v3 will drop the v1 compat layer entirely (#551).
ENV PYTHONWARNINGS="ignore::UserWarning:pydantic.v1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While setting PYTHONWARNINGS in the Dockerfile works, it's generally better to handle application-specific warning suppression within the application code itself. This improves portability and encapsulation, as the logic is co-located with the code that uses the dependency causing the warning.

Consider moving this logic into your application's entrypoint, for example at the top of src/synthorg/api/app.py:

import warnings

# Suppress Pydantic v1 compatibility warning from Litestar's plugin detection
# on Python 3.14+ (harmless import-time check, not actual v1 usage).
# Tracked: Litestar v3 will drop the v1 compat layer entirely (#551).
warnings.filterwarnings("ignore", category=UserWarning, module=r"pydantic\.v1")

If you apply this change in src/synthorg/api/app.py, you can remove these lines from the Dockerfile.

@Aureliolo Aureliolo merged commit cbe1f05 into main Mar 18, 2026
28 checks passed
@Aureliolo Aureliolo deleted the fix/suppress-pydantic-v1-warning branch March 18, 2026 16:38
Aureliolo added a commit that referenced this pull request Mar 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.5](v0.3.4...v0.3.5)
(2026-03-18)


### Features

* **api:** auto-wire backend services at startup
([#555](#555))
([0e52c47](0e52c47))


### Bug Fixes

* **api:** resolve WebSocket 403 rejection
([#549](#549))
([#556](#556))
([60453d2](60453d2))
* **cli:** verify SLSA provenance via GitHub attestation API
([#548](#548))
([91d4f79](91d4f79)),
closes [#532](#532)


### Performance

* **test:** speed up test suite -- reduce Hypothesis examples and
eliminate real sleeps
([#557](#557))
([d5f3a41](d5f3a41))


### Refactoring

* replace _ErrorResponseSpec NamedTuple with TypedDict
([#554](#554))
([71cc6e1](71cc6e1))


### Maintenance

* **docker:** suppress pydantic v1 warning on Python 3.14
([#552](#552))
([cbe1f05](cbe1f05)),
closes [#551](#551)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant