You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does anyone know off hand whether this one was ever resolved?
I'm kind of a Python noob and was trying to add type checking on a project's tests. I got almost all of it working, except for testcontainers:
tests/conftest.py:5: error: Skipping analyzing "testcontainers.postgres": module is installed, but missing library stubs or py.typed marker [import-untyped]
Looking in the file I'm using, it is typed, but I think the problem is that it's not declaring itself as such. Fixing this might be as simple as adding a py.typed file to the project.
there is a pr here but its not a top priority: #504 - almost immediately after i opened there were two pr's with minor typing fixes that conflicted with it, and i did not rebase in time. at this point it would be not only harder to rebase but also there are new modules that need types/mypy checking.
Thanks. My Python skills are such that I'm already having enough trouble just wrangling types in one much smaller package so I don't think I'll try my hand at this yet, but it's good to know I'm not missing something.
In case this helps anyone else, here's a block that can be placed in mypy.ini to flag it as ignored so that MyPy can pass for everything else:
# testcontainers is typed, but it doesn't correctly declare itself as such.# Hopefully it can be fixed one day:## https://github.com/testcontainers/testcontainers-python/issues/305[mypy-testcontainers.*]ignore_missing_imports = True
I forked the testcontainers repo and cloned it locally
In my working repo that is using testcontainers, I changed the dependency in pyproject.toml to not point to a release version but to instead point to a local directry. I did something like: uv pip install --editable "file:///Users/username/open-source/testcontainers-python[postgres]"
Type checker validation: Executed Pyright against all the code in my directory
Activity
tillahoffmann commentedon Feb 16, 2023
Yes, that should definitely be possible. Would you be up for setting up a PR? We could also add mypy checks in the same PR.
chore(lint): update typing and linting (#425)
alexanderankin commentedon Mar 30, 2024
@jooola if you have any feedback about #504 it is welcome!
brandur commentedon Jun 30, 2024
Does anyone know off hand whether this one was ever resolved?
I'm kind of a Python noob and was trying to add type checking on a project's tests. I got almost all of it working, except for testcontainers:
Looking in the file I'm using, it is typed, but I think the problem is that it's not declaring itself as such. Fixing this might be as simple as adding a
py.typedfile to the project.alexanderankin commentedon Jun 30, 2024
there is a pr here but its not a top priority: #504 - almost immediately after i opened there were two pr's with minor typing fixes that conflicted with it, and i did not rebase in time. at this point it would be not only harder to rebase but also there are new modules that need types/mypy checking.
contributions would be accepted for it.
brandur commentedon Jun 30, 2024
Thanks. My Python skills are such that I'm already having enough trouble just wrangling types in one much smaller package so I don't think I'll try my hand at this yet, but it's good to know I'm not missing something.
In case this helps anyone else, here's a block that can be placed in
mypy.inito flag it as ignored so that MyPy can pass for everything else:fix(core): Typing in auth (#691)
fix(core): Typing in config + utils (#692)
andres-ito-traversal commentedon Apr 25, 2025
Has there been any update on this issue? It's been close to a year since the last comment
fix(core): Typing in generic + network (#700)
fix(core): Typing in version (#701)
fix(core): Typing in docker_client (#702)
fix(core): Typing in generic + network (#700)
fix(core): Typing in generic + network (#700)
fix(core): Typing in generic + network (#700)
andres-ito-traversal commentedon Nov 12, 2025
It looks like the relevant PR is #810
andres-ito-traversal commentedon Nov 12, 2025
I attempted to resolve this with #918
I tested this PR locally by doing the following:
uv pip install --editable "file:///Users/username/open-source/testcontainers-python[postgres]"Add py.typed marker files to all packages (PEP 561)