Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the deprecated no_strict_optional = true option from the mypy configuration in pyproject.toml. The option has been deprecated by mypy and its removal eliminates linting errors.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
/packit rebuild-failed |
Contributor
|
I didn't find the deprecation notice but since "it's evil" let's remove it and work on fixing the type checks |
Member
|
It seems that disabling this option exposed several issues. I think we should address them. PTAL @jwhonce |
1b8d363 to
a25361b
Compare
a25361b to
9b4a822
Compare
Member
Author
inknos
reviewed
Mar 25, 2026
Honny1
reviewed
Mar 25, 2026
Member
Honny1
left a comment
There was a problem hiding this comment.
I have some nits about ignoring errors. Otherwise LGTM.
* "no_strict_optional = true" has been deprecated by mypy. This change removes the option and fixes all resulting type-checking errors. * podman/api/http_utils.py: Widen prepare_filters() signature to accept None and Mapping[str, Any], matching its runtime behavior. Resolves arg-type errors in volumes, quadlets, and networks_manager. * podman/domain/containers_manager.py: Make prune() filters parameter explicitly Optional per PEP 484 (no_implicit_optional=True). * podman/domain/containers_run.py: Use "command or []" when passing to ContainerError to handle the None case. * podman/domain/volumes.py: Add assertion to narrow path type after validation guards for pathlib.Path() call. * podman/tests/utils.py: Assert proc.stdout is not None before reading to narrow IO[bytes] | None type. * podman/tests/integration/utils.py: Type podman_exe as Optional[str] since podman_path parameter can be None. * podman/tests/integration/base.py: Type podman class variable as Optional[str] with import. * podman/tests/unit/test_api_utils.py: Add dict[str, Any] annotation to payload variable. Reviewer feedback: * podman/client.py: Introduce api_version Optional[str] variable instead of using a type: ignore pragma on version = None. * podman/domain/manager.py: Keep self.client honestly typed as Optional[APIClient]. Add an api property to both PodmanResource and Manager that narrows the type to APIClient, raising AttributeError if client is None. * All domain modules (pods, volumes, secrets, quadlets, images, containers, networks, manifests, pods_manager, images_manager, images_build, containers_create, networks_manager, containers_manager): Use self.api instead of self.client for API calls to get proper type narrowing without pragmas. * pyproject.toml: Consolidate ruff exclude into top-level [tool.ruff] section covering .history, _build, and other generated directories for both linting and formatting. Signed-off-by: Jhon Honce <jhonce@redhat.com> Made-with: Cursor
9b4a822 to
996dd51
Compare
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.
Signed-off-by: Jhon Honce jhonce@redhat.com