-
Notifications
You must be signed in to change notification settings - Fork 188
Fix #839 and move most setup.py metadata and config into pyproject.toml
#959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mhucka
wants to merge
2
commits into
quantumlib:main
Choose a base branch
from
mhucka:mh-more-pyproject
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,6 @@ | |
| import os | ||
| import platform | ||
| import re | ||
| import runpy | ||
| import shutil | ||
| import subprocess | ||
| import sys | ||
|
|
@@ -24,6 +23,8 @@ | |
| from setuptools import Extension, setup | ||
| from setuptools.command.build_ext import build_ext | ||
|
|
||
| __version__ = "0.23.0.dev0" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use tomllib to get version from pyproject.toml and avoid duplicate definition. That modules is builtin since Python 3.11 |
||
|
|
||
|
|
||
| class CMakeExtension(Extension): | ||
| def __init__(self, name, sourcedir=""): | ||
|
|
@@ -67,6 +68,8 @@ def build_extension(self, ext): | |
| "-DCMAKE_CUDA_COMPILER=nvcc", | ||
| ] | ||
|
|
||
| # Append additional CMake arguments from the environment variable. | ||
| # This is e.g. used by cibuildwheel to force a certain C++ standard. | ||
| additional_cmake_args = os.environ.get("CMAKE_ARGS", "") | ||
| if additional_cmake_args: | ||
| cmake_args += additional_cmake_args.split() | ||
|
|
@@ -110,9 +113,7 @@ def build_extension(self, ext): | |
|
|
||
| env = os.environ.copy() | ||
| cxxflags = env.get("CXXFLAGS", "") | ||
| env["CXXFLAGS"] = ( | ||
| f'{cxxflags} -DVERSION_INFO=\\"{self.distribution.get_version()}\\"' | ||
| ) | ||
| env["CXXFLAGS"] = f'{cxxflags} -DVERSION_INFO=\\"{__version__}\\"' | ||
mhucka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if not os.path.exists(self.build_temp): | ||
| os.makedirs(self.build_temp) | ||
| subprocess.check_call( | ||
|
|
@@ -124,42 +125,7 @@ def build_extension(self, ext): | |
| ) | ||
|
|
||
|
|
||
| with open("requirements.txt") as f: | ||
| requirements = [ | ||
| line.strip() for line in f if line.strip() and not line.strip().startswith("#") | ||
| ] | ||
| with open("dev-requirements.txt") as f: | ||
| dev_requirements = [ | ||
| line.strip() for line in f if line.strip() and not line.strip().startswith("#") | ||
| ] | ||
|
|
||
| description = "Schrödinger and Schrödinger-Feynman simulators for quantum circuits." | ||
|
|
||
| # README file as long_description. | ||
| with open("README.md", encoding="utf-8") as f: | ||
| long_description = f.read() | ||
|
|
||
| __version__ = runpy.run_path("qsimcirq/_version.py")["__version__"] | ||
| if not __version__: | ||
| raise ValueError("Version string cannot be empty") | ||
|
|
||
| setup( | ||
| name="qsimcirq", | ||
| version=__version__, | ||
| url="https://github.com/quantumlib/qsim", | ||
| author="The qsim/qsimh Developers", | ||
| author_email="qsim-qsimh-dev@googlegroups.com", | ||
| maintainer="Google Quantum AI", | ||
| maintainer_email="quantum-oss-maintainers@google.com", | ||
| python_requires=">=3.10.0", | ||
| install_requires=requirements, | ||
| extras_require={ | ||
| "dev": dev_requirements, | ||
| }, | ||
| license="Apache-2.0", | ||
| description=description, | ||
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| ext_modules=[ | ||
| CMakeExtension("qsimcirq/qsim_avx512"), | ||
| CMakeExtension("qsimcirq/qsim_avx2"), | ||
|
|
@@ -170,49 +136,5 @@ def build_extension(self, ext): | |
| CMakeExtension("qsimcirq/qsim_decide"), | ||
| CMakeExtension("qsimcirq/qsim_hip"), | ||
| ], | ||
| cmdclass=dict(build_ext=CMakeBuild), | ||
| zip_safe=False, | ||
| packages=["qsimcirq"], | ||
| package_data={"qsimcirq": ["py.typed"]}, | ||
| classifiers=[ | ||
| "Development Status :: 5 - Production/Stable", | ||
| "Environment :: GPU :: NVIDIA CUDA", | ||
| "Intended Audience :: Developers", | ||
| "Intended Audience :: Science/Research", | ||
| "Operating System :: MacOS :: MacOS X", | ||
| "Operating System :: Microsoft :: Windows", | ||
| "Operating System :: POSIX :: Linux", | ||
| "Programming Language :: C++", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Topic :: Scientific/Engineering :: Quantum Computing", | ||
| "Topic :: Software Development :: Libraries :: Python Modules", | ||
| "Typing :: Typed", | ||
| ], | ||
| keywords=[ | ||
| "algorithms", | ||
| "api", | ||
| "application programming interface", | ||
| "cirq", | ||
| "google quantum", | ||
| "google", | ||
| "nisq", | ||
| "python", | ||
| "quantum algorithm development", | ||
| "quantum circuit simulator", | ||
| "quantum computer simulator", | ||
| "quantum computing", | ||
| "quantum computing research", | ||
| "quantum programming", | ||
| "quantum simulation", | ||
| "quantum", | ||
| "schrödinger-feynman simulation", | ||
| "sdk", | ||
| "simulation", | ||
| "state vector simulator", | ||
| "software development kit", | ||
| ], | ||
| cmdclass={"build_ext": CMakeBuild}, | ||
| ) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicates
requirements.txt- do you plan on retiring that file together withdev-requirements.txtand only declare dependencies in pyproject.toml?You might want to check if qsim can be converted to a uv managed project which will support dependency-tree locking and a full development reproducibility.