chore(docker): suppress pydantic v1 warning on Python 3.14#552
chore(docker): suppress pydantic v1 warning on Python 3.14#552
Conversation
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 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)
🧰 Additional context used🧠 Learnings (6)📓 Common learnings📚 Learning: 2026-03-18T11:08:24.271ZApplied to files:
📚 Learning: 2026-03-18T11:08:24.271ZApplied to files:
📚 Learning: 2026-03-15T11:48:14.867ZApplied to files:
📚 Learning: 2026-03-15T11:48:14.867ZApplied to files:
📚 Learning: 2026-03-15T11:48:14.867ZApplied to files:
🔇 Additional comments (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAn environment variable is added to the Docker runtime stage to suppress Pydantic v1 compatibility warnings during Python runtime. The change sets Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
📝 Coding Plan
Comment |
Summary of ChangesHello, 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 Highlights
Using Gemini Code AssistThe 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
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 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
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
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.
| # 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" | ||
|
|
There was a problem hiding this comment.
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.
🤖 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).
Summary
Litestar's pydantic plugin imports
pydantic.v1for version detection, triggering a noisyUserWarningon 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
Ref: #551