Hi,
I have been trying unsuccessfully for a few days to package a stub project. The project is pyside2-stubs and the idea is to provide mypy stubs only for PySide2 also known as “Qt5 for Python”.
My project has the following layout
setup.cfg
pyproject.toml
README.md
LICENSE
version.py
update_latest_pyside2.py
tests/
qobject.py
... (several other python test files)
pyside2-stubs/
__init__.pyi
QtCore.pyi
... (more .pyi files)
My goal is to distribute a package containing only the *.pyi
files plus the usual README and LICENSE.
Content of pyproject.toml
:
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
Content of setup.cfg
:
[metadata]
name = PySide2-stubs
author = Philippe Fremy
author_email = phil.fremy@free.fr
description = PEP561 stub files for the *PySide2/Qt5 for Python* framework
long_description = file: README.md
long_description_content_type = text/markdown
version = attr: version.TOTO
license = LGPL v2.1
url = https://github.com/python-qt-tools/PySide2-stubs
project_urls =
Bug Tracker = https://github.com/bluebird75/pyside2-stubs/issues
classifiers =
Development Status :: 5 - Production/Stable
Programming Language :: Python :: 3
License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)
Operating System :: OS Independent
Intended Audience :: Developers
Typing :: Stubs Only
[options]
package_dir =
= .
python_requires = >=3.6
[options.exclude_package_data]
. = *.py
[options.package_data]
* = *.pyi
My main problem is that the generated wheel contains all the python files located in this directory whereas I don’t want to ship any of them.
I have been looking for documentation and examples, but the use case of a package without any python files is not so common. And the setup.cfg documentation has been unsufficient for me. I would really appreciate any guidance.
The full project is on GitHub, ready to be exercised : GitHub - python-qt-tools/PySide2-stubs: Mypy stubs for pyside2 / Qt5 for Python