Repository navigation
Fix mypy errors for optional Pydantic imports - #603
Merged
pjbull merged 2 commits intoOct 16, 2026
Merged
Conversation
terminalchai
requested a deployment
to
reviewed-live-cloud
October 14, 2026 21:27 — with
GitHub Actions
Waiting
terminalchai
requested a deployment
to
reviewed-live-cloud
October 14, 2026 21:27 — with
GitHub Actions
Waiting
terminalchai
requested a deployment
to
reviewed-live-cloud
October 14, 2026 21:27 — with
GitHub Actions
Waiting
terminalchai
requested a deployment
to
reviewed-live-cloud
October 14, 2026 21:27 — with
GitHub Actions
Waiting
terminalchai
requested a deployment
to
reviewed-live-cloud
October 14, 2026 21:27 — with
GitHub Actions
Waiting
terminalchai
had a problem deploying
to
reviewed-live-cloud
October 14, 2026 21:29 — with
GitHub Actions
Failure
terminalchai
had a problem deploying
to
reviewed-live-cloud
October 14, 2026 21:29 — with
GitHub Actions
Failure
terminalchai
had a problem deploying
to
reviewed-live-cloud
October 14, 2026 21:29 — with
GitHub Actions
Failure
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #603 +/- ##
========================================
- Coverage 96.1% 95.3% -0.8%
========================================
Files 30 30
Lines 2977 2977
========================================
- Hits 2861 2839 -22
- Misses 116 138 +22
🚀 New features to boost your workflow:
|
terminalchai
had a problem deploying
to
reviewed-live-cloud
October 16, 2026 14:59 — with
GitHub Actions
Failure
terminalchai
had a problem deploying
to
reviewed-live-cloud
October 16, 2026 14:59 — with
GitHub Actions
Failure
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running mypy with
ignore_missing_imports = falsewithout Pydantic installed reportsimport-not-foundat the guardedpydantic_coreimports in bothCloudPathandAnyPath. Mark those two imports with a narrow type ignore, following the maintainer's requested approach in #385. Suppressingunused-ignoreat the same locations also keeps these directives quiet when Pydantic is installed. The runtime guards and dependencies are unchanged.Closes #385.
Verified on Windows/Python 3.11: the explicit missing-Pydantic type check failed with two errors before this change and passes after it; the same check passes with Pydantic installed. Both schema hooks return
Nonesafely without Pydantic. The full mocked/local suite passed with 2,165 tests and 127 skipped, including existing Pydantic validation and serialization tests across provider rigs. Repository Black, flake8 and mypy checks pass, source and wheel distributions build, and MkDocs builds with existing link warnings. Codex reviewed the supplied diff and validation context. Live cloud backends were not tested. Upstream test and docs workflows require maintainer approval for this fork PR; live backend jobs also wait for maintainer approval.The reproducible type-check configuration used
follow_imports = silentwith missing imports left as errors, checkingcloudpathlib/cloudpath.pyandcloudpathlib/anypath.pyand pointing mypy's--python-executableat a minimal environment without Pydantic. A separate check with--warn-unused-ignoresconfirms no new warnings at these imports; six existing warnings elsewhere incloudpath.pyremain under that opt-in flag.Contributor checklist:
Prepared with AI assistance; the diff and verification results were reviewed before submission.