Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added inertia/py.typed
Empty file.
13 changes: 13 additions & 0 deletions inertia/tests/test_typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pathlib import Path
from unittest import TestCase


class PyTypedTestCase(TestCase):
def test_py_typed_marker_exists(self):
"""Verify that the py.typed marker file exists for PEP 561 compliance."""
package_dir = Path(__file__).resolve().parent.parent
py_typed = package_dir / "py.typed"
self.assertTrue(
py_typed.exists(),
f"py.typed marker file is missing from {package_dir}",
)
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ packages = [
{ include = "inertia" },
]

[tool.poetry.include]
include = ["inertia/py.typed"]
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The [tool.poetry.include] section syntax is incorrect. The include key should be placed directly under the [tool.poetry] section, not in a separate section. The current configuration will not work as intended and the py.typed file will not be included in the package distribution.

The correct configuration should be:

[tool.poetry]
packages = [
  { include = "inertia" },
]
include = ["inertia/py.typed"]

Move the include line to be directly under [tool.poetry] and remove the [tool.poetry.include] header.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This seems to be correct, after doing more research, I’ve removed the [tool.poetry.include] section entirely. Poetry already includes files that live inside the declared package directory, and py.typed lives inside inertia/, which is already configured as a package, so it gets packaged automatically. The fix has been pushed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does it include the py.typed file though? I think by default it only includes python files in the specified directory.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hey @sopelj, good question, I looked into this carefully.

Poetry includes all files in the package source tree by default, not just .py files. Since py.typed lives inside inertia/ which is already declared as a package, it ships in both the sdist and wheel automatically with no extra configuration needed.

This is confirmed by Jürgen Gmach (a well-known Python packaging contributor):

"Poetry actually includes everything that's part of the package source tree in your distribution, so py.typed is included out-of-the-box, no configuration needed."

Reference: https://jugmac00.github.io/blog/bite-my-shiny-type-annotated-library/

The confusion often comes from older Poetry issues (pre-1.0) where setup.py-based builds had this problem, but those are long resolved with the current poetry-core build backend.

If you have anything that contradicts this, I'm genuinely curious drop it in the next comment. I've gone through quite a bit of documentation on this and this is consistently what I find.

WORTH NOTING: This is also why I corrected my earlier commit to remove the [tool.poetry.include] section, py.typed comes packaged automatically, so the explicit include was unnecessary. That was the Copilot comment I addressed. If that's what you were referring to, then yes, it's already handled and the old PR has been updated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ok, thanks for the information. I have never used poetry personally. The other tools I've used only load Python files automatically. So thanks for the clarification. :)


[tool.poetry.group.dev.dependencies]
pytest = "^8.3.5"
pytest-cov = "^6.0.0"
Expand Down