From 28cd0d3e59d6d6e6760255dcb720d53e94fd2730 Mon Sep 17 00:00:00 2001 From: Nils Quetschlich Date: Mon, 3 Oct 2022 20:18:04 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Proper=20Packaging=20(#115)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📦 removed init file and adjusted setup.py * 🎨 pre-commit fixes * 🔖 use setuptools-scm for versioning * 🔧 add `fetch-depth: 0` to checkout for versioning * 🔧 move to PEP 621 project metadata specification * 🔧 add coverage extra * 🔧 add `fetch-depth: 0` to coverage job Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lukas Burgholzer --- .github/workflows/coverage.yml | 8 ++-- .github/workflows/deploy.yml | 4 ++ mqt/__init__.py | 0 pyproject.toml | 77 +++++++++++++++++++++++++++++----- setup.py | 67 +---------------------------- 5 files changed, 76 insertions(+), 80 deletions(-) delete mode 100644 mqt/__init__.py diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1f888c644..3b0d79ee7 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,16 +12,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup Python uses: actions/setup-python@v4 with: python-version: "3.8" - name: Install MQT Bench - run: pip install -e . + run: pip install -e .[coverage] - name: Generate Report - run: | - pip install pytest-cov - pytest -v --cov=./ --cov-report=xml + run: pytest -v --cov=./ --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b0406db38..020600795 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,6 +15,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-python@v4 with: python-version: "3.8" @@ -36,6 +38,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-python@v4 with: python-version: "3.8" diff --git a/mqt/__init__.py b/mqt/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/pyproject.toml b/pyproject.toml index 1e08fae29..8dbc5e439 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,73 @@ [build-system] -# Minimum requirements for the build system to execute. -requires = ["setuptools>=45"] # PEP 508 specifications. +requires = [ + "setuptools>=61", + "setuptools_scm[toml]>=6.4", +] build-backend = "setuptools.build_meta" -[tool.cibuildwheel] -build = "cp3*" -archs = "auto64" -test-command = "python -c \"from mqt import bench\"" -build-verbosity = 3 +[project] +name = "mqt.bench" +description = "MQT Bench - A MQT tool for Benchmarking Quantum Software Tools" +readme = "README.md" +authors = [ + { name = "Nils Quetschlich", email = "nils.quetschlich@tum.de" }, + { name = "Lukas Burgholzer", email = "lukas.burgholzer@jku.at"}, +] +keywords = ["MQT", "quantum computing", "benchmarking", "performance", "testing"] +license = { file = "LICENSE" } +requires-python = ">=3.8" +dynamic = ["version"] -[tool.cibuildwheel.linux] +dependencies = [ + "qiskit==0.36.0", + "pytket==1.2.2", + "pytket-qiskit==0.25.0", + "pandas==1.3.5", + "flask==2.2.2", + "networkx==2.8.6", + "pytest==7.1.3", + "qiskit_finance==0.3.4", + "qiskit_machine-learning==0.4.0", + "qiskit-nature[pyscf]==0.3.1", + "qiskit_optimization==0.3.2", + "packaging==21.3", + "tqdm==4.64.1", + "importlib_metadata>=3.6; python_version < '3.10'", + "importlib_resources>=5.9; python_version < '3.10'", +] -[tool.cibuildwheel.macos] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", +] -[tool.cibuildwheel.windows] +[project.optional-dependencies] +test = ["pytest>=7"] +coverage = ["mqt.bench[test]", "coverage[toml]~=6.5.0", "pytest-cov~=4.0.0"] +dev = ["mqt.bench[coverage]"] + +[project.scripts] +"mqt.bench" = "mqt.benchviewer.main:start_server" + +[project.urls] +Homepage = "https://github.com/cda-tum/mqtbench" +"Bug Tracker" = "https://github.com/cda-tum/mqtbench/issues" +Discussions = "https://github.com/cda-tum/mqtbench/discussions" +Research = "https://www.cda.cit.tum.de/research/quantum/" + +[tool.setuptools.packages.find] +include = ["mqt.*"] + +[tool.setuptools_scm] diff --git a/setup.py b/setup.py index 86ee3d285..606849326 100644 --- a/setup.py +++ b/setup.py @@ -1,68 +1,3 @@ -import os - from setuptools import setup -README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "README.md") -with open(README_PATH) as readme_file: - README = readme_file.read() - -setup( - name="mqt.bench", - packages=[ - "mqt.benchviewer", - "mqt.benchviewer.src", - "mqt.benchviewer.src.tests", - "mqt.benchviewer.templates", - "mqt.bench", - "mqt.bench.utils", - "mqt.bench.tests", - "mqt.bench.benchmarks", - "mqt.bench.benchmarks.qiskit_application_finance", - "mqt.bench.benchmarks.qiskit_application_ml", - "mqt.bench.benchmarks.qiskit_application_optimization", - "mqt.bench.benchmarks.qiskit_application_nature", - ], - version="0.1.3", - python_requires=">=3.8", - license="MIT", - description="MQT Bench - A MQT tool for Benchmarking Quantum Software Tools", - long_description=README, - long_description_content_type="text/markdown", - author="Nils Quetschlich", - author_email="nils.quetschlich@tum.de", - url="https://github.com/cda-tum/mqtbench", - keywords="mqt quantum benchmarking performance testing", - entry_points={ - "console_scripts": ["mqt.bench=mqt.benchviewer.main:start_server"], - }, - include_package_data=True, - install_requires=[ - "qiskit==0.36.0", - "pytket==1.2.2", - "pytket-qiskit==0.25.0", - "pandas==1.3.5", - "flask==2.2.2", - "networkx==2.8.6", - "pytest==7.1.3", - "qiskit_finance==0.3.4", - "qiskit_machine-learning==0.4.0", - "qiskit-nature[pyscf]==0.3.1", - "qiskit_optimization==0.3.2", - "packaging==21.3", - "tqdm==4.64.1", - "importlib_metadata>=3.6; python_version < '3.10'", - "importlib_resources>=5.9; python_version < '3.10'", - ], - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS", - "Operating System :: POSIX :: Linux", - "Programming Language :: Python :: 3", - "Intended Audience :: Science/Research", - "Natural Language :: English", - "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", - ], -) +setup()