fix: add PEP 561 py.typed markers for type checker support
Summary
Adds py.typed marker files to all testcontainers packages to comply with PEP 561 and enable type checking support.
Motivation
Without py.typed markers, type checkers like Pyright and mypy report "Stub file not found" errors when importing testcontainers modules, even though the code has inline type annotations.
Changes
- Added
py.typedmarker tocore/testcontainers/ - Added
py.typedmarkers to all module packages undermodules/*/testcontainers/ - Updated
pyproject.tomlto ensurepy.typedfiles are included in distributions
Testing
Verified that type checkers no longer report missing stub file errors:
pyright -c "from testcontainers.postgres import PostgresContainer"
# 0 errors, 0 warnings, 0 informations
Impact
- Enables proper type checking for projects using testcontainers
- No breaking changes or runtime behavior modifications
- Aligns with Python packaging best practices (PEP 561)
Github Issue=https://github.com/testcontainers/testcontainers-python/issues/305
@rnorth Apologies richard for the random tag, but do you have any idea how authors will get notified of this PR? It's my first time contributing to this open-source library
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 79.78%. Comparing base (5853d32) to head (468ede5).
Additional details and impacted files
@@ Coverage Diff @@
## main #918 +/- ##
=======================================
Coverage 79.78% 79.78%
=======================================
Files 14 14
Lines 1182 1182
Branches 184 184
=======================================
Hits 943 943
Misses 197 197
Partials 42 42
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.