Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 95 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,100 @@
# limitations under the License.

[build-system]
build-backend = "setuptools.build_meta"
requires = [
"packaging",
"setuptools>=78.1.1",
"wheel",
"pybind11[global]",
# "pip install" from sources needs to build Pybind, which needs CMake too.
"cmake~=3.28.1",
]
build-backend = "setuptools.build_meta"

[project]
name = "qsimcirq"
version = "0.23.0.dev0"
description = "High-performance quantum circuit simulator for C++ and Python."
authors = [
{ name = "The qsim/qsimh Developers", email = "qsim-qsimh-dev@googlegroups.com" }
]
maintainers = [
{ name = "Google Quantum AI", email = "quantum-oss-maintainers@google.com" }
]
license = "Apache-2.0"
requires-python = ">=3.10.0"
readme = "README.md"
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",
]
dependencies = [
"absl-py",
"cirq-core~=1.0",
"numpy>=1.26.0",
Comment on lines +81 to +83
Copy link
Collaborator

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 with dev-requirements.txt and 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.

]

[project.optional-dependencies]
dev = [
"cmake~=3.28.1",
"black~=25.9.0",
"flynt~=1.0",
"isort[colors]~=6.0.1",
"pybind11[global]",
"pylint~=4.0.2",
"pytest",
"pytest-xdist",
"py-cpuinfo",
"setuptools>=78.1.1",
]

[project.urls]
homepage = "https://quantumai.google/qsim"
documentation = "https://quantumai.google/qsim"
source = "https://github.com/quantumlib/qsim"
download = "https://pypi.org/project/qsimcirq/#files"
tracker = "https://github.com/quantumlib/qsim/issues"

[tool.setuptools]
packages = ["qsimcirq"]
package-data = {"qsimcirq" = ["py.typed"]}

[tool.cibuildwheel]
test-extras = "dev"
Expand All @@ -43,3 +129,11 @@ skip = "*musllinux*"
[tool.black]
target-version = ['py310', 'py311', 'py312', 'py313']
extend-exclude = 'third_party'

[tool.isort]
profile = 'black'
order_by_type = false # Sort alphabetically, irrespective of case.
skip_gitignore = true
combine_as_imports = true
known_first_party = ["cirq*"]
extend_skip = ["__init__.py"]
90 changes: 6 additions & 84 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import os
import platform
import re
import runpy
import shutil
import subprocess
import sys
Expand All @@ -24,6 +23,8 @@
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext

__version__ = "0.23.0.dev0"
Copy link
Collaborator

Choose a reason for hiding this comment

The 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=""):
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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__}\\"'
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
subprocess.check_call(
Expand All @@ -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"),
Expand All @@ -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},
)