This is the project directory structure
.
├── meow.py
└── pyproject.toml
0 directories, 2 files
This is the meow.py
:
def main():
print("meow world")
This is the pyproject.toml
:
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "meowpkg"
version = "0.1"
description = "a package that meows"
[project.scripts]
meow_world = "meow:main"
When building this package, no matter whether with python3 -m pip wheel .
or using python3 -m build
, it creates a file named like meowpkg-0.1-py3-none-any.whl
which can not be installed on Python 2.
$ python2.7 -m pip install meowpkg-0.1-py3-none-any.whl
ERROR: meowpkg-0.1-py3-none-any.whl is not a supported wheel on this platform.
But "meowpkg" actually works on Python 2 as well. How to instruct setuptools and/or wheel to create a universal wheel tagged like meowpkg-0.1-py2.py3-none-any.whl
, without using the old setup.cfg
/setup.py
ways?
Current workaround:
echo "[bdist_wheel]\nuniversal=1" > setup.cfg && python3 -m build && rm setup.cfg
Add this section into the pyproject.toml
:
[tool.distutils.bdist_wheel]
universal = true