From 27a928964c117b017532deec9a895c07c5d4771d Mon Sep 17 00:00:00 2001 From: Rohith Reddy Date: Thu, 23 Jul 2026 23:20:46 -0400 Subject: [PATCH] fix(packaging): ship PEP 561 py.typed marker so downstream type checkers see the annotations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDK is fully type-annotated, but the PEP 561 `py.typed` marker was neither present under `src/sochdb/` nor listed in `[tool.setuptools.package-data]`. As a result, downstream mypy / Pyright silently skipped analyzing `sochdb`: Skipping analyzing "sochdb": module is installed, but missing library stubs or py.typed marker [import-untyped] Every shipped type hint was invisible to consumers. Fix: - Add an empty `src/sochdb/py.typed` file (per PEP 561 §Packaging Type Information — an empty marker is sufficient and signals the package is fully typed). - Add `"py.typed"` to the `sochdb` list under `[tool.setuptools.package-data]` in `pyproject.toml` so it's included in the built wheel alongside the bundled native libraries. - CHANGELOG entry under a new `## [Unreleased]` -> `### Fixed`. No `.py` source is touched; no public API change; no ABI or FFI change; `__version__` / `__core_version__` unchanged. Reproduction (verified locally with mypy 2.3.0 on Python 3.13): # tiny downstream consumer $ cat consumer.py from sochdb import Database wrong: str = Database("/tmp/db") # BEFORE the fix (marker absent from installed sochdb): $ mypy consumer.py consumer.py:1: error: Skipping analyzing "sochdb": module is installed, but missing library stubs or py.typed marker [import-untyped] # -> Database is treated as Any, two real bugs missed. # AFTER the fix (marker present): $ mypy consumer.py consumer.py:2: error: Missing positional argument "_handle" in call to "Database" [call-arg] consumer.py:2: error: Incompatible types in assignment (expression has type "Database", variable has type "str") [assignment] # -> real class signatures resolved, real bugs caught. Wheel-content verification: $ pip wheel . --no-deps -w /tmp/wc && \ python -m zipfile -l /tmp/wc/sochdb-*.whl | grep py.typed sochdb/py.typed 0 --- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 ++ src/sochdb/py.typed | 0 3 files changed, 15 insertions(+) create mode 100644 src/sochdb/py.typed diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b6643a..ecda7d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to the SochDB Python SDK will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- **PEP 561 `py.typed` marker was missing from the built wheel.** The SDK is + fully type-annotated, but downstream `mypy` / Pyright silently skipped + analyzing `sochdb` (`"module is installed, but missing library stubs or + py.typed marker"`) because the marker was neither present under + `src/sochdb/` nor listed in `[tool.setuptools.package-data]`. Adds an empty + `src/sochdb/py.typed` and includes it in `package-data` so it lands inside + the wheel. Consumers now see the shipped type annotations. No API or ABI + change. + ## [0.8.1] - 2026-06-24 ### Changed diff --git a/pyproject.toml b/pyproject.toml index d0e4f43..6bda236 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,8 @@ where = ["src"] [tool.setuptools.package-data] # Include bundled native libraries for each platform sochdb = [ + # PEP 561 type-information marker (advertises this package as fully typed) + "py.typed", # Shared libraries (FFI) - platform-specific directories "lib/*/*.so", "lib/*/*.dylib", diff --git a/src/sochdb/py.typed b/src/sochdb/py.typed new file mode 100644 index 0000000..e69de29