Skip to content

[MNT] Add py.typed marker file for PEP 561 compliance #528

@direkkakkar319-ops

Description

@direkkakkar319-ops

Describe the issue

skbase already includes type hints across its codebase (function
signatures, return types, etc.) but is missing the py.typed marker
file required by PEP 561.

Without this file, type checkers like mypy and pyright completely
ignore all type annotations in skbase when used as an installed package.
This means downstream packages (sktime, skpro, and any user building
on top of skbase) get zero benefit from the existing type hints — mypy
silently skips them and treats all skbase imports as Any.

You can verify the issue right now:
pip install scikit-base
python -m mypy your_script.py # skbase types are ignored

Mypy will report something like:
error: Skipping analyzing 'skbase': module is installed,
but missing library stubs or py.typed marker

Describe the fix

  1. Create an empty py.typed marker file at the root of the package:
    touch skbase/py.typed

  2. Ensure it is included in the distribution by verifying
    pyproject.toml includes it under package data. With modern
    setuptools and pyproject.toml, this is typically automatic,
    but should be explicitly confirmed:

    [tool.setuptools.package-data]
    skbase = ["py.typed"]

  3. Add a CI check or mypy config in pyproject.toml to prevent
    future regressions:

    [tool.mypy]
    python_version = "3.10"
    packages = ["skbase"]

That is the entire fix — a single empty file plus a config confirmation.

Additional context

PEP 561 states: "Package maintainers who wish to support type checking
of their code MUST add a marker file named py.typed to their package."

Since skbase is explicitly designed as a base framework for building
typed, scikit-learn-like packages, PEP 561 compliance is especially
important here — the entire downstream ecosystem of skbase users is
affected by this missing marker.

Reference: https://peps.python.org/pep-0561/

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceContinuous integration, unit testing & package distribution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions