Skip to content

feat: add py.typed marker for PEP 561 compliance#1530

Open
kalichiruvelli-art wants to merge 1 commit intomicrosoft:mainfrom
kalichiruvelli-art:feat/add-py-typed-marker
Open

feat: add py.typed marker for PEP 561 compliance#1530
kalichiruvelli-art wants to merge 1 commit intomicrosoft:mainfrom
kalichiruvelli-art:feat/add-py-typed-marker

Conversation

@kalichiruvelli-art
Copy link
Copy Markdown

Summary

Adds an empty py.typed marker file to the flaml/ package directory as specified by PEP 561.

Problem

Type checkers (Pyright, Pylance, mypy) treat flaml as untyped because there is no py.typed marker, causing warnings like:
Stub file not found for "flaml" (reportMissingTypeStubs)

Fix

  • Add an empty flaml/py.typed marker file (zero bytes, no logic changes)
    • Add [tool.setuptools.package-data] entry in pyproject.toml so the file is included in the built distribution
      No logic changes, no new dependencies.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make flaml PEP 561-compliant so type checkers (Pyright/Pylance/mypy) recognize it as a typed package by shipping a py.typed marker in the distribution.

Changes:

  • Add flaml/py.typed marker file.
  • Add a pyproject.toml entry intended to include py.typed as package data during packaging.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
pyproject.toml Adds setuptools package-data config for shipping flaml/py.typed.
flaml/py.typed Adds the PEP 561 marker file to the package.

Comment thread pyproject.toml
Comment on lines +53 to +54
[tool.setuptools.package-data]
flaml = ["py.typed"] No newline at end of file
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

This [tool.setuptools.package-data] entry may not be applied in the current release/build pipeline, which runs python setup.py sdist bdist_wheel (see .github/workflows/CD.yml). Since setup.py currently only sets package_data for flaml.default, the built wheel may still omit flaml/py.typed, defeating the PEP 561 marker. Consider adding py.typed to package_data in setup.py (or switching packaging to a PEP 517/pyproject-based setuptools config) to ensure it is included in sdists/wheels.

Copilot uses AI. Check for mistakes.
@kalichiruvelli-art
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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