使用 pyproject.toml 时不包括 py.typed

py.typed does not be included when use pyproject.toml

提问人:joe 提问时间:11/16/2023 最后编辑:joe 更新时间:11/16/2023 访问量:21

问:

我正在发布我的软件包,并得到支持。不幸的是,我无法将空白文件捆绑到py包中。这是我存储库中的目录结构。mypypy.typed

我已经遵循了答案,但没有用。

.
├── LICENSE
├── README.md
├── aga8
│   ├── __init__.py
│   ├── __pycache__
│   │   └── detail.cpython-311.pyc
│   ├── detail.py
│   ├── py.typed
│   └── tests.py
├── pyproject.toml
└── setup.cfg

2 directories, 9 files

pyproject.toml

[project]
name = "aga8-python"
version = "0.0.1"
authors = [
  { name="Sarit Ritwirune", email="s[email protected]" },
]
description = "American Gas Association Report No.8"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
]

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

[project.urls]
"Homepage" = "https://github.com/elcolie/AGA8-python"

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

[tool.setuptools.packages.find]
where = ["aga8"]

问:
如何在打包目录中包含哪个是空白文件?
py.typedaga8

临时解决方案:
我关注存储库。我认为它最终在发布之前添加。
humanizepy.typed

python 构建 mypy

评论


答:

0赞 joe 11/16/2023 #1

删除此行。

[tool.setuptools.packages.find]
where = ["aga8"]

然后运行python -m build

将在输出中看到此行。

copying aga8/py.typed -> aga8-python-0.0.1/aga8