Skip to content

Commit 49383f3

Browse files
authored
Improve Wheel Building Process (#55)
- Pruned directories from external submodules in MANIFEST.in to reduce size of sdist to below one megabyte. - Use ninja as generator target on supported plattforms in setup.py to improve wheel build times - Stop building wheels for python3.6 as it's eol since a couple months
1 parent 5fbecf2 commit 49383f3

5 files changed

Lines changed: 39 additions & 18 deletions

File tree

.github/workflows/bindings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
submodules: recursive
7070
- uses: ilammy/msvc-dev-cmd@v1
7171
- name: Build wheels
72-
uses: pypa/cibuildwheel@v2.3.1
72+
uses: pypa/cibuildwheel@v2.4.0
7373
- uses: actions/upload-artifact@v2
7474
with:
7575
path: ./wheelhouse/*.whl

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14...3.22)
22

33
project(ddsim
44
LANGUAGES CXX
5-
VERSION 1.11.2
5+
VERSION 1.11.3
66
DESCRIPTION "DDSIM - A JKQ quantum simulator based on decision diagrams"
77
)
88

@@ -11,6 +11,8 @@ option(COVERAGE "Configure for coverage report generation")
1111
option(BINDINGS "Configure for building Python bindings")
1212
option(DEPLOY "Configure for deployment")
1313

14+
message("-- Generator is set to ${CMAKE_GENERATOR}")
15+
1416
if (DEFINED ENV{DEPLOY})
1517
set(DEPLOY $ENV{DEPLOY} CACHE BOOL "Use deployment configuration from environment" FORCE)
1618
message(STATUS "Setting deployment configuration to '${DEPLOY}' from environment")

MANIFEST.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ include include/*
44
include apps/*
55
graft jkq/*
66
graft mqt/*
7+
global-exclude __pycache__/
8+
global-exclude *.py[cod]
9+
global-exclude *.so
710

811
# Include relevant files from other JKQ projects
912
include extern/qfr/CMakeLists.txt
@@ -17,6 +20,9 @@ graft extern/qfr/extern/dd_package/include
1720
graft extern/qfr/extern/json
1821
prune extern/qfr/extern/json/doc
1922
prune extern/qfr/extern/json/test
23+
prune extern/qfr/extern/json/benchmarks
24+
prune extern/qfr/extern/json/third_party
25+
prune extern/qfr/extern/json/include
2026

2127
graft extern/qfr/extern/pybind11
2228
prune extern/qfr/extern/pybind11/docs
@@ -28,5 +34,13 @@ prune extern/qfr/extern/pybind11_json/test
2834
graft extern/taskflow
2935
prune extern/taskflow/docs
3036
prune extern/taskflow/image
37+
prune extern/taskflow/benchmarks
38+
prune extern/taskflow/doxygen
39+
prune extern/taskflow/3rd-party
40+
prune extern/taskflow/tfprof
41+
prune extern/taskflow/sandbox
42+
prune extern/taskflow/unittests
43+
prune extern/taskflow/examples
3144

3245
graft extern/cxxopts
46+
prune extern/cxxopts/test

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "cmake"]
2+
requires = [
3+
"setuptools>=45",
4+
"wheel>=0.37",
5+
"ninja>=1.10; sys_platform != 'win32'",
6+
"cmake>=3.14",
7+
]
38
build-backend = "setuptools.build_meta"
49

510
[tool.cibuildwheel]
611
build = "cp3*"
7-
skip = "*-win32 *-musllinux_i686 *-manylinux_i686"
12+
archs = "auto64"
813
test-skip = "*_arm64 *-musllinux_x86_64 *_universal2:arm64"
914
test-command = "python -c \"from mqt import ddsim\""
1015
test-requires = ["qiskit-terra"]

setup.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ def __init__(self, name, sourcedir='', namespace=''):
1616

1717

1818
class CMakeBuild(build_ext):
19-
def run(self):
20-
try:
21-
subprocess.check_output(['cmake', '--version'])
22-
except OSError:
23-
raise RuntimeError("CMake must be installed to build the following extensions: " +
24-
", ".join(e.name for e in self.extensions))
25-
26-
for ext in self.extensions:
27-
self.build_extension(ext)
28-
2919
def build_extension(self, ext):
3020
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.namespace+ext.name)))
3121
# required for auto-detection of auxiliary "native" libs
@@ -35,6 +25,15 @@ def build_extension(self, ext):
3525
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
3626
'-DPYTHON_EXECUTABLE=' + sys.executable,
3727
'-DBINDINGS=ON']
28+
if self.compiler.compiler_type != "msvc":
29+
# Using Ninja-build since it a) is available as a wheel and b)
30+
# multithreads automatically. MSVC would require all variables be
31+
# exported for Ninja to pick it up, which is a little tricky to do.
32+
# Users can override the generator with CMAKE_GENERATOR in CMake
33+
# 3.15+.
34+
cmake_generator = os.environ.get("CMAKE_GENERATOR", "")
35+
if not cmake_generator:
36+
cmake_args += ["-GNinja"]
3837

3938
cfg = 'Debug' if self.debug else 'Release'
4039
build_args = ['--config', cfg]
@@ -75,18 +74,19 @@ def build_extension(self, ext):
7574

7675
setup(
7776
name='mqt.ddsim',
78-
version='1.11.2',
77+
version='1.11.3',
7978
author='Stefan Hillmich',
8079
author_email='stefan.hillmich@jku.at',
8180
description='MQT DDSIM - A quantum simulator based on decision diagrams written in C++',
8281
long_description=README,
8382
long_description_content_type='text/markdown',
8483
license='MIT',
85-
url='https://iic.jku.at/eda/research/quantum_simulation/',
84+
url='https://www.cda.cit.tum.de/research/quantum_simulation/',
8685
ext_modules=[CMakeExtension('pyddsim', namespace='mqt.ddsim.')],
87-
cmdclass=dict(build_ext=CMakeBuild),
86+
cmdclass={"build_ext": CMakeBuild},
8887
zip_safe=False,
8988
packages=find_namespace_packages(include=['mqt.*']),
89+
python_requires=">=3.7",
9090
classifiers=[
9191
'Development Status :: 4 - Beta',
9292
'Programming Language :: Python :: 3',
@@ -103,7 +103,7 @@ def build_extension(self, ext):
103103
project_urls={
104104
'Source': 'https://github.com/cda-tum/ddsim/',
105105
'Tracker': 'https://github.com/cda-tum/ddsim/issues',
106-
'Research': 'https://iic.jku.at/eda/research/quantum_simulation/',
106+
'Research': 'https://www.cda.cit.tum.de/research/quantum_simulation/',
107107
},
108108
extras_require={
109109
"tnflow": ["sparse", "opt-einsum", "quimb", "pandas", "numpy"]

0 commit comments

Comments
 (0)