diff --git a/MANIFEST.in b/MANIFEST.in index 0c094f0eb7..3b0c77c02d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,6 @@ graft artiq/firmware graft artiq/examples include artiq/gui/logo*.svg -include versioneer.py include artiq/_version.py include artiq/coredevice/coredevice_generic.schema.json include artiq/compiler/kernel.ld diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..cc906c5394 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,72 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools>=61"] + +[project] +name = "artiq" +description = "Advanced Real-Time Infrastructure for Quantum physics" +readme = "README.rst" +license = "LGPL-3.0-or-later" +license-files = ["LICENSE", "LICENSE.GPL-3"] +authors = [{ name = "M-Labs", email = "artiq@lists.m-labs.hk" }] +requires-python = ">=3.11" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: X11 Applications :: Qt", + "Intended Audience :: Science/Research", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: System :: Hardware", +] +dependencies = [ + "h5py", + "levenshtein", + "llvmlite", + "lmdb", + "numpy", + "platformdirs", + "prettytable", + "pygit2", + "pyqtgraph", + "python-dateutil", + "pythonparser", + "qasync", + "scipy", +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://m-labs.hk/artiq" + +[project.scripts] +artiq_client = "artiq.frontend.artiq_client:main" +artiq_compile = "artiq.frontend.artiq_compile:main" +artiq_coreanalyzer = "artiq.frontend.artiq_coreanalyzer:main" +artiq_coremgmt = "artiq.frontend.artiq_coremgmt:main" +artiq_rtiomap = "artiq.frontend.artiq_rtiomap:main" +artiq_ddb_template = "artiq.frontend.artiq_ddb_template:main" +artiq_master = "artiq.frontend.artiq_master:main" +artiq_mkfs = "artiq.frontend.artiq_mkfs:main" +artiq_rtiomon = "artiq.frontend.artiq_rtiomon:main" +artiq_sinara_tester = "artiq.frontend.artiq_sinara_tester:main" +artiq_session = "artiq.frontend.artiq_session:main" +artiq_route = "artiq.frontend.artiq_route:main" +artiq_run = "artiq.frontend.artiq_run:main" +artiq_flash = "artiq.frontend.artiq_flash:main" +aqctl_coreanalyzer_proxy = "artiq.frontend.aqctl_coreanalyzer_proxy:main" +aqctl_corelog = "artiq.frontend.aqctl_corelog:main" +aqctl_moninj_proxy = "artiq.frontend.aqctl_moninj_proxy:main" +afws_client = "artiq.frontend.afws_client:main" + +[project.gui-scripts] +artiq_browser = "artiq.frontend.artiq_browser:main" +artiq_dashboard = "artiq.frontend.artiq_dashboard:main" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +exclude = ["artiq.test.lit", "artiq.test.lit.*", "doc.manual"] diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index 23ff6707c8..8507b2520d --- a/setup.py +++ b/setup.py @@ -1,80 +1,62 @@ #!/usr/bin/env python3 -from setuptools import setup, find_namespace_packages -import sys +import os +from setuptools import setup +from setuptools.command.build_py import build_py as _build_py +from setuptools.command.sdist import sdist as _sdist -import versioneer +VERSION_FILE = """ +def get_version(): + return "{version}" -if sys.version_info[:2] < (3, 11): - raise Exception("You need Python 3.11+") +def get_rev(): + return "{rev}" +""" -# Depends on PyQt6, but setuptools cannot check for it. -requirements = [ - "numpy", "scipy", - "python-dateutil", "prettytable", "h5py", "lmdb", - "qasync", "pyqtgraph", "pygit2", - "llvmlite", "pythonparser", "levenshtein", - "platformdirs", -] +def get_version(): + return os.getenv("VERSIONEER_OVERRIDE", default="9.0+unknown.beta") -console_scripts = [ - "artiq_client = artiq.frontend.artiq_client:main", - "artiq_compile = artiq.frontend.artiq_compile:main", - "artiq_coreanalyzer = artiq.frontend.artiq_coreanalyzer:main", - "artiq_coremgmt = artiq.frontend.artiq_coremgmt:main", - "artiq_rtiomap = artiq.frontend.artiq_rtiomap:main", - "artiq_ddb_template = artiq.frontend.artiq_ddb_template:main", - "artiq_master = artiq.frontend.artiq_master:main", - "artiq_mkfs = artiq.frontend.artiq_mkfs:main", - "artiq_rtiomon = artiq.frontend.artiq_rtiomon:main", - "artiq_sinara_tester = artiq.frontend.artiq_sinara_tester:main", - "artiq_session = artiq.frontend.artiq_session:main", - "artiq_route = artiq.frontend.artiq_route:main", - "artiq_run = artiq.frontend.artiq_run:main", - "artiq_flash = artiq.frontend.artiq_flash:main", - "aqctl_coreanalyzer_proxy = artiq.frontend.aqctl_coreanalyzer_proxy:main", - "aqctl_corelog = artiq.frontend.aqctl_corelog:main", - "aqctl_moninj_proxy = artiq.frontend.aqctl_moninj_proxy:main", - "afws_client = artiq.frontend.afws_client:main", -] +def get_rev(): + return os.getenv("VERSIONEER_REV", default="unknown") -gui_scripts = [ - "artiq_browser = artiq.frontend.artiq_browser:main", - "artiq_dashboard = artiq.frontend.artiq_dashboard:main", -] +def write_to_version_file(filename, version, rev): + os.unlink(filename) + with open(filename, "w") as f: + f.write(VERSION_FILE.format(version=version, rev=rev)) + + +class cmd_build_py(_build_py): + def run(self): + _build_py.run(self) + target = os.path.join(self.build_lib, "artiq", "_version.py") + print("UPDATING %s" % target) + write_to_version_file(target, get_version(), get_rev()) + + +class cmd_sdist(_sdist): + def run(self): + version = get_version() + self._generated_version = version + self._rev = get_rev() + # unless we update this, the command will keep using the old + # version + self.distribution.metadata.version = version + return _sdist.run(self) + + def make_release_tree(self, base_dir, files): + _sdist.make_release_tree(self, base_dir, files) + target_versionfile = os.path.join(base_dir, "artiq", "_version.py") + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, + self._generated_version, + self._rev) setup( - name="artiq", - version=versioneer.get_version(), - cmdclass=versioneer.get_cmdclass(), - author="M-Labs", - author_email="artiq@lists.m-labs.hk", - url="https://m-labs.hk/artiq", - description="Advanced Real-Time Infrastructure for Quantum physics", - long_description=open("README.rst", encoding="utf-8").read(), - license="LGPLv3+", - classifiers="""\ -Development Status :: 5 - Production/Stable -Environment :: Console -Environment :: X11 Applications :: Qt -Intended Audience :: Science/Research -License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+) -Operating System :: Microsoft :: Windows -Operating System :: POSIX :: Linux -Programming Language :: Python :: 3.7 -Topic :: Scientific/Engineering :: Physics -Topic :: System :: Hardware -""".splitlines(), - install_requires=requirements, - extras_require={}, - packages=find_namespace_packages(exclude=["artiq.test.lit", "artiq.test.lit.*", "doc.manual"], ), - namespace_packages=[], - include_package_data=True, - ext_modules=[], - entry_points={ - "console_scripts": console_scripts, - "gui_scripts": gui_scripts, - } + version=get_version(), + cmdclass={ + "build_py": cmd_build_py, + "sdist": cmd_sdist, + }, ) diff --git a/versioneer.py b/versioneer.py deleted file mode 100644 index eae28b2c61..0000000000 --- a/versioneer.py +++ /dev/null @@ -1,71 +0,0 @@ -import os -import sys - - -VERSION_FILE = """ -def get_version(): - return "{version}" - -def get_rev(): - return "{rev}" -""" - -def get_version(): - return os.getenv("VERSIONEER_OVERRIDE", default="9.0+unknown.beta") - -def get_rev(): - return os.getenv("VERSIONEER_REV", default="unknown") - -def write_to_version_file(filename, version, rev): - os.unlink(filename) - with open(filename, "w") as f: - f.write(VERSION_FILE.format(version=version, rev=rev)) - - -def get_cmdclass(): - cmds = {} - - # we override different "build_py" commands for both environments - if "setuptools" in sys.modules: - from setuptools.command.build_py import build_py as _build_py - else: - from distutils.command.build_py import build_py as _build_py - - class cmd_build_py(_build_py): - def run(self): - version = get_version() - rev = get_rev() - _build_py.run(self) - target_versionfile = os.path.join(self.build_lib, - "artiq", "_version.py") - print("UPDATING %s" % target_versionfile) - write_to_version_file(target_versionfile, version, rev) - cmds["build_py"] = cmd_build_py - - - # we override different "sdist" commands for both environments - if "setuptools" in sys.modules: - from setuptools.command.sdist import sdist as _sdist - else: - from distutils.command.sdist import sdist as _sdist - - class cmd_sdist(_sdist): - def run(self): - version = get_version() - self._versioneer_generated_version = version - self._versioneer_rev = get_rev() - # unless we update this, the command will keep using the old - # version - self.distribution.metadata.version = version - return _sdist.run(self) - - def make_release_tree(self, base_dir, files): - _sdist.make_release_tree(self, base_dir, files) - target_versionfile = os.path.join(base_dir, "artiq", "_version.py") - print("UPDATING %s" % target_versionfile) - write_to_version_file(target_versionfile, - self._versioneer_generated_version, - self._versioneer_rev) - cmds["sdist"] = cmd_sdist - - return cmds