Skip to content

Add 'py.typed'#69

Merged
vadikko2 merged 1 commit into
masterfrom
pep-561-compliance-py-typed
May 21, 2026
Merged

Add 'py.typed'#69
vadikko2 merged 1 commit into
masterfrom
pep-561-compliance-py-typed

Conversation

@1owkeyme
Copy link
Copy Markdown
Collaborator

@1owkeyme 1owkeyme commented May 20, 2026

Reasoning: https://peps.python.org/pep-0561/#packaging-type-information

Linters like pylance in strict mode would not check for types if either stubs (pyi) or py.typed are not provided

Summary by CodeRabbit

  • Chores
    • Version bump to 4.10.3

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

The pull request updates the package version from 4.10.2 to 4.10.3 in pyproject.toml.

Changes

Package Version Update

Layer / File(s) Summary
Version increment
pyproject.toml
Package version in the [project] section is updated from 4.10.2 to 4.10.3.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~1 minute

Poem

A version bump hops into place,
From 4.10.2 to 4.10.3's embrace,
Tiny change, swift and neat,
One line update, small and sweet! 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Add py.typed' does not match the actual changes. The changeset only shows a version bump from 4.10.2 to 4.10.3 in pyproject.toml, with no evidence of adding a py.typed file. Update the PR title to accurately reflect the version bump, such as 'Bump version to 4.10.3' or verify that the py.typed file addition was included in the changeset.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pep-561-compliance-py-typed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@1owkeyme 1owkeyme force-pushed the pep-561-compliance-py-typed branch from 94cdfb5 to 178152f Compare May 20, 2026 13:00
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pyproject.toml (1)

84-85: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing package-data configuration to include py.typed file.

For PEP 561 compliance, the py.typed marker file must be included in the built distribution. Currently, the setuptools configuration lacks explicit directives to include non-Python files. By default, setuptools only packages .py files, so py.typed will be excluded from the wheel/sdist, defeating the purpose of this PR.

Add package-data configuration to ensure py.typed is bundled:

📦 Proposed fix to include py.typed in distribution

Add this section after line 85:

 [tool.setuptools.packages.find]
 where = ["src"]
+
+[tool.setuptools.package-data]
+"*" = ["py.typed"]

Alternatively, use:

 [tool.setuptools.packages.find]
 where = ["src"]
+
+[tool.setuptools]
+include-package-data = true

Run the following script to verify whether py.typed would be included in the built package:

#!/bin/bash
# Description: Check if py.typed exists and verify setuptools will include it

# Find py.typed file location
echo "=== Searching for py.typed file ==="
fd -t f '^py\.typed$' src/

# Check if package-data or include-package-data is configured
echo -e "\n=== Checking for package-data configuration ==="
rg -n 'package-data|include-package-data' pyproject.toml setup.py setup.cfg MANIFEST.in 2>/dev/null || echo "No package-data configuration found"

# Verify what files would be included by setuptools (if setup.py exists)
echo -e "\n=== Simulating package build to check included files ==="
if [ -f "setup.py" ] || [ -f "pyproject.toml" ]; then
  python -m pip install build 2>/dev/null || pip install build 2>/dev/null
  python -m build --sdist --wheel --outdir /tmp/build_check 2>&1 | head -20
  
  # List contents of built wheel if successful
  if ls /tmp/build_check/*.whl 2>/dev/null; then
    echo -e "\n=== Contents of built wheel ==="
    unzip -l /tmp/build_check/*.whl 2>/dev/null | grep -E '(py\.typed|\.py$)' | head -30
  fi
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyproject.toml` around lines 84 - 85, The project is missing packaging
directives to include the py.typed marker in the built distribution; update
pyproject.toml to ensure py.typed is bundled by adding either an explicit
package-data mapping or enabling include-package-data and providing a
MANIFEST.in. Concretely, add a [tool.setuptools.package-data] section that maps
your package(s) (the packages discovered under src) to ["py.typed"] or set
[tool.setuptools] include-package-data = true and add a MANIFEST.in that
contains "recursive-include src *py.typed" (or equivalent path), then rebuild to
verify py.typed is present; reference the existing
[tool.setuptools.packages.find] block to locate the packages that need the
py.typed entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pyproject.toml`:
- Around line 84-85: The project is missing packaging directives to include the
py.typed marker in the built distribution; update pyproject.toml to ensure
py.typed is bundled by adding either an explicit package-data mapping or
enabling include-package-data and providing a MANIFEST.in. Concretely, add a
[tool.setuptools.package-data] section that maps your package(s) (the packages
discovered under src) to ["py.typed"] or set [tool.setuptools]
include-package-data = true and add a MANIFEST.in that contains
"recursive-include src *py.typed" (or equivalent path), then rebuild to verify
py.typed is present; reference the existing [tool.setuptools.packages.find]
block to locate the packages that need the py.typed entry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2058406f-105b-4e3b-8f19-8ba8a77646d0

📥 Commits

Reviewing files that changed from the base of the PR and between 2c58ceb and 178152f.

📒 Files selected for processing (2)
  • py.typed
  • pyproject.toml

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 20, 2026

Merging this PR will not alter performance

✅ 70 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing pep-561-compliance-py-typed (178152f) with master (2c58ceb)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@1owkeyme 1owkeyme requested a review from vadikko2 May 20, 2026 13:05
@1owkeyme
Copy link
Copy Markdown
Collaborator Author

1owkeyme commented May 21, 2026

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)

pyproject.toml (1)> 84-85: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing package-data configuration to include py.typed file.
For PEP 561 compliance, the py.typed marker file must be included in the built distribution. Currently, the setuptools configuration lacks explicit directives to include non-Python files. By default, setuptools only packages .py files, so py.typed will be excluded from the wheel/sdist, defeating the purpose of this PR.
Add package-data configuration to ensure py.typed is bundled:

📦 Proposed fix to include py.typed in distribution
Add this section after line 85:

 [tool.setuptools.packages.find]
 where = ["src"]
+
+[tool.setuptools.package-data]
+"*" = ["py.typed"]

Alternatively, use:

 [tool.setuptools.packages.find]
 where = ["src"]
+
+[tool.setuptools]
+include-package-data = true

Run the following script to verify whether py.typed would be included in the built package:

#!/bin/bash
# Description: Check if py.typed exists and verify setuptools will include it

# Find py.typed file location
echo "=== Searching for py.typed file ==="
fd -t f '^py\.typed$' src/

# Check if package-data or include-package-data is configured
echo -e "\n=== Checking for package-data configuration ==="
rg -n 'package-data|include-package-data' pyproject.toml setup.py setup.cfg MANIFEST.in 2>/dev/null || echo "No package-data configuration found"

# Verify what files would be included by setuptools (if setup.py exists)
echo -e "\n=== Simulating package build to check included files ==="
if [ -f "setup.py" ] || [ -f "pyproject.toml" ]; then
  python -m pip install build 2>/dev/null || pip install build 2>/dev/null
  python -m build --sdist --wheel --outdir /tmp/build_check 2>&1 | head -20
  
  # List contents of built wheel if successful
  if ls /tmp/build_check/*.whl 2>/dev/null; then
    echo -e "\n=== Contents of built wheel ==="
    unzip -l /tmp/build_check/*.whl 2>/dev/null | grep -E '(py\.typed|\.py$)' | head -30
  fi
fi

🤖 Prompt for AI Agents

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyproject.toml` around lines 84 - 85, The project is missing packaging
directives to include the py.typed marker in the built distribution; update
pyproject.toml to ensure py.typed is bundled by adding either an explicit
package-data mapping or enabling include-package-data and providing a
MANIFEST.in. Concretely, add a [tool.setuptools.package-data] section that maps
your package(s) (the packages discovered under src) to ["py.typed"] or set
[tool.setuptools] include-package-data = true and add a MANIFEST.in that
contains "recursive-include src *py.typed" (or equivalent path), then rebuild to
verify py.typed is present; reference the existing
[tool.setuptools.packages.find] block to locate the packages that need the
py.typed entry.

🤖 Prompt for all review comments with AI agents

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pyproject.toml`:
- Around line 84-85: The project is missing packaging directives to include the
py.typed marker in the built distribution; update pyproject.toml to ensure
py.typed is bundled by adding either an explicit package-data mapping or
enabling include-package-data and providing a MANIFEST.in. Concretely, add a
[tool.setuptools.package-data] section that maps your package(s) (the packages
discovered under src) to ["py.typed"] or set [tool.setuptools]
include-package-data = true and add a MANIFEST.in that contains
"recursive-include src *py.typed" (or equivalent path), then rebuild to verify
py.typed is present; reference the existing [tool.setuptools.packages.find]
block to locate the packages that need the py.typed entry.

ℹ️ Review info

Added in version v69.0.0: setuptools will attempt to include type information files by default in the distribution (.pyi and py.typed, as specified in PEP 561), as long as they are contained inside of a package directory (for the time being there is no automatic support for top-level .pyi files).

source: https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html

@vadikko2 vadikko2 merged commit f558e3d into master May 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants