From 6da3edd547acc778d2d6e7767b62248d4fcaf99a Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 12 Dec 2022 03:22:37 -0500 Subject: [PATCH 1/4] build only one wheel for each platform The binary in our wheels do not link Python libraries, so we can create universal wheels. --- .github/workflows/build_wheel.yml | 27 --------------------------- pyproject.toml | 5 ++++- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 273aa8d71f..0173803cc0 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -13,41 +13,14 @@ jobs: matrix: include: # linux-64 - - os: ubuntu-latest - python: 37 - platform_id: manylinux_x86_64 - - os: ubuntu-latest - python: 38 - platform_id: manylinux_x86_64 - - os: ubuntu-latest - python: 39 - platform_id: manylinux_x86_64 - os: ubuntu-latest python: 310 platform_id: manylinux_x86_64 # macos-x86-64 - - os: macos-latest - python: 37 - platform_id: macosx_x86_64 - - os: macos-latest - python: 38 - platform_id: macosx_x86_64 - - os: macos-latest - python: 39 - platform_id: macosx_x86_64 - os: macos-latest python: 310 platform_id: macosx_x86_64 # win-64 - - os: windows-2019 - python: 37 - platform_id: win_amd64 - - os: windows-2019 - python: 38 - platform_id: win_amd64 - - os: windows-2019 - python: 39 - platform_id: win_amd64 - os: windows-2019 python: 310 platform_id: win_amd64 diff --git a/pyproject.toml b/pyproject.toml index 5e6b389653..bc0da47eef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,10 +48,13 @@ repository = "https://github.com/deepmodeling/deepmd-kit" [tool.setuptools_scm] write_to = "deepmd/_version.py" +[tool.distutils.bdist_wheel] +universal = true + [tool.cibuildwheel] test-command = "dp -h" test-requires = "tensorflow" -build = ["cp37-*", "cp38-*", "cp39-*", "cp310-*"] +build = ["cp310-*"] skip = ["*-win32", "*-manylinux_i686", "*-musllinux*"] # TODO: bump to "latest" tag when CUDA supports GCC 12 manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64:2022-11-19-1b19e81" From 15944a22b548e714260bf85af1e4327dbfdcb2b4 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 13 Dec 2022 06:39:28 -0500 Subject: [PATCH 2/4] Update pyproject.toml Signed-off-by: Jinzhe Zeng --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bc0da47eef..3447bd90a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ repository = "https://github.com/deepmodeling/deepmd-kit" write_to = "deepmd/_version.py" [tool.distutils.bdist_wheel] -universal = true +python-tag = "py3" [tool.cibuildwheel] test-command = "dp -h" From 7eb5d4916d4f44534305566e219483283671847e Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 13 Dec 2022 06:55:53 -0500 Subject: [PATCH 3/4] hack setuptools --- pyproject.toml | 3 --- setup.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3447bd90a3..66b1c724ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,9 +48,6 @@ repository = "https://github.com/deepmodeling/deepmd-kit" [tool.setuptools_scm] write_to = "deepmd/_version.py" -[tool.distutils.bdist_wheel] -python-tag = "py3" - [tool.cibuildwheel] test-command = "dp -h" test-requires = "tensorflow" diff --git a/setup.py b/setup.py index 89bb7a011f..abce686380 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ import sys from skbuild import setup +from wheel.bdist_wheel import bdist_wheel topdir = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(topdir, 'backend')) @@ -38,6 +39,14 @@ tf_version = get_tf_version(tf_install_dir) +class bdist_wheel_abi3(bdist_wheel): + def get_tag(self): + python, abi, plat = super().get_tag() + if python.startswith("cp"): + return "cp37", "none", plat + return python, abi, plat + + # TODO: migrate packages and entry_points to pyproject.toml after scikit-build supports it # See also https://scikit-build.readthedocs.io/en/latest/usage.html#setuptools-options setup( @@ -89,4 +98,7 @@ **get_tf_requirement(tf_version), }, entry_points={"console_scripts": ["dp = deepmd.entrypoints.main:main"]}, + cmdclass = { + "bdist_wheel": bdist_wheel_abi3, + }, ) From 2a9da00a027daa1cdaf7a9e511d584e55a733ac2 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 13 Dec 2022 07:08:22 -0500 Subject: [PATCH 4/4] change tag to py37 Signed-off-by: Jinzhe Zeng --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index abce686380..387ce9e6f9 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ class bdist_wheel_abi3(bdist_wheel): def get_tag(self): python, abi, plat = super().get_tag() if python.startswith("cp"): - return "cp37", "none", plat + return "py37", "none", plat return python, abi, plat