Loading pyproject.toml +38 −1 Original line number Diff line number Diff line [build-system] requires = ["setuptools", "wheel"] requires = ["setuptools", "wheel", "numpy>=2.0.0", "cython>=3.0.11"] build-backend = "setuptools.build_meta" [project] name = "cpprb" version = "11.0.0" license = { file = "LICENSE" } authors = [{ name = "Yamada Hiroyuki" }] classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries", ] dependencies = ["numpy"] dynamic = [ "description", "readme", ] [project.urls] "Home Page" = "https://ymd_h.gitlab.io/cpprb/" "Source Code" = "https://gitlab.com/ymd_h/cpprb" "Mirror" = "https://github.com/ymd-h/cpprb" "Change Log" = "https://ymd_h.gitlab.io/cpprb/changelog/" "Bug Report & QA" = "https://github.com/ymd-h/cpprb/discussions" [tool.setuptools] packages = ["cpprb"] package-dir = { "" = "src" } include-package-data = false [tool.cibuildwheel] build = ["cp3{9,10,11,12,13}-{macosx_*,{win,????linux}_*64}"] build-frontend = "build[uv]" Loading setup.py +12 −93 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ import sysconfig import warnings from setuptools import Extension, setup from setuptools.command.build_ext import build_ext import numpy as np debug = os.getenv("DEBUG_CPPRB") Loading @@ -18,31 +18,6 @@ on_CI = ( # noqa: N816 or os.getenv("GITLAB_CI") ) arm_mac = (sysconfig.get_platform().split("-")[0] == "macosx") and (platform.machine() == "arm64") requires = ["numpy"] setup_requires = ["wheel"] if sys.version_info >= (3, 9): # NumPy 2.0 breaks ABI compatibility. # To support both NumPy 1.x and 2.x, build with NumPy 2.x # cf. https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-abi-handling setup_requires.append("numpy>=2.0.0") elif (sys.version_info < (3, 9)) and not arm_mac: # NumPy 1.20 breaks ABI compatibility. # To support both NumPy 1.19.x and 1.20+, build with NumPy 1.19 # This is necessary to work with old library which requires old NumPy. # NumPy 1.19.5 doesn't support Python 3.10+ # NumPy 1.19.5 doesn't distribute wheel for macOS aarch64, setup_requires.append("numpy<1.20") else: setup_requires.append("numpy") rb_source = "src/cpprb/PyReplayBuffer" cpp_ext = ".cpp" pyx_ext = ".pyx" # Set compiler flags depending on platform if platform.system() == "Windows": Loading @@ -61,19 +36,12 @@ else: if debug: extra_compile_args.append("-DCYTHON_TRACE_NOGIL=1") # Check cythonize or not pyx_file = rb_source + pyx_ext use_cython = os.path.exists(pyx_file) if use_cython: suffix = pyx_ext setup_requires.extend(["cython>=3.0.11"]) compiler_directives = {"language_level": "3"} compiler_directives = {"language_level": "3"} if debug: compiler_directives["linetrace"] = True else: suffix = cpp_ext # Set ext_module ext = [["cpprb", "PyReplayBuffer"], ["cpprb", "VectorWrapper"]] Loading @@ -81,39 +49,18 @@ ext = [["cpprb", "PyReplayBuffer"], ["cpprb", "VectorWrapper"]] ext_modules = [ Extension( ".".join(e), sources=["src/" + "/".join(e) + suffix], sources = ["src/" + "/".join(e) + ".pyx"], include_dirs = [np.get_include()], extra_compile_args = extra_compile_args, extra_link_args = extra_link_args, language = "c++", compiler_directives = compiler_directives, cython_include_dirs = ["."], ) for e in ext ] class LazyImportBuildExtCommand(build_ext): """ build_ext command class for lazy numpy and cython import """ def run(self): import numpy as np self.include_dirs.append(np.get_include()) build_ext.run(self) def finalize_options(self): if use_cython: from Cython.Build import cythonize self.distribution.ext_modules = cythonize( self.distribution.ext_modules, compiler_directives=compiler_directives, include_path=["."], annotate=True, ) super().finalize_options() description = "ReplayBuffer for Reinforcement Learning written by C++ and Cython" README = os.path.join(os.path.abspath(os.path.dirname(__file__)), "README.md") if os.path.exists(README): Loading @@ -126,36 +73,8 @@ else: long_description_content_type = "text/plain" setup( name="cpprb", author="Yamada Hiroyuki", description=description, version="11.0.0", install_requires=requires, setup_requires=setup_requires, cmdclass={"build_ext": LazyImportBuildExtCommand}, url="https://ymd_h.gitlab.io/cpprb/", project_urls={ "Source Code": "https://gitlab.com/ymd_h/cpprb", "Mirror": "https://github.com/ymd-h/cpprb", "Change Log": "https://ymd_h.gitlab.io/cpprb/changelog/", "Bug Report & QA": "https://github.com/ymd-h/cpprb/discussions", }, package_dir={"": "src"}, ext_modules=ext_modules, include_dirs=["cpprb"], packages=["cpprb"], classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries", ], long_description=long_description, long_description_content_type=long_description_content_type, ) Loading
pyproject.toml +38 −1 Original line number Diff line number Diff line [build-system] requires = ["setuptools", "wheel"] requires = ["setuptools", "wheel", "numpy>=2.0.0", "cython>=3.0.11"] build-backend = "setuptools.build_meta" [project] name = "cpprb" version = "11.0.0" license = { file = "LICENSE" } authors = [{ name = "Yamada Hiroyuki" }] classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries", ] dependencies = ["numpy"] dynamic = [ "description", "readme", ] [project.urls] "Home Page" = "https://ymd_h.gitlab.io/cpprb/" "Source Code" = "https://gitlab.com/ymd_h/cpprb" "Mirror" = "https://github.com/ymd-h/cpprb" "Change Log" = "https://ymd_h.gitlab.io/cpprb/changelog/" "Bug Report & QA" = "https://github.com/ymd-h/cpprb/discussions" [tool.setuptools] packages = ["cpprb"] package-dir = { "" = "src" } include-package-data = false [tool.cibuildwheel] build = ["cp3{9,10,11,12,13}-{macosx_*,{win,????linux}_*64}"] build-frontend = "build[uv]" Loading
setup.py +12 −93 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ import sysconfig import warnings from setuptools import Extension, setup from setuptools.command.build_ext import build_ext import numpy as np debug = os.getenv("DEBUG_CPPRB") Loading @@ -18,31 +18,6 @@ on_CI = ( # noqa: N816 or os.getenv("GITLAB_CI") ) arm_mac = (sysconfig.get_platform().split("-")[0] == "macosx") and (platform.machine() == "arm64") requires = ["numpy"] setup_requires = ["wheel"] if sys.version_info >= (3, 9): # NumPy 2.0 breaks ABI compatibility. # To support both NumPy 1.x and 2.x, build with NumPy 2.x # cf. https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-abi-handling setup_requires.append("numpy>=2.0.0") elif (sys.version_info < (3, 9)) and not arm_mac: # NumPy 1.20 breaks ABI compatibility. # To support both NumPy 1.19.x and 1.20+, build with NumPy 1.19 # This is necessary to work with old library which requires old NumPy. # NumPy 1.19.5 doesn't support Python 3.10+ # NumPy 1.19.5 doesn't distribute wheel for macOS aarch64, setup_requires.append("numpy<1.20") else: setup_requires.append("numpy") rb_source = "src/cpprb/PyReplayBuffer" cpp_ext = ".cpp" pyx_ext = ".pyx" # Set compiler flags depending on platform if platform.system() == "Windows": Loading @@ -61,19 +36,12 @@ else: if debug: extra_compile_args.append("-DCYTHON_TRACE_NOGIL=1") # Check cythonize or not pyx_file = rb_source + pyx_ext use_cython = os.path.exists(pyx_file) if use_cython: suffix = pyx_ext setup_requires.extend(["cython>=3.0.11"]) compiler_directives = {"language_level": "3"} compiler_directives = {"language_level": "3"} if debug: compiler_directives["linetrace"] = True else: suffix = cpp_ext # Set ext_module ext = [["cpprb", "PyReplayBuffer"], ["cpprb", "VectorWrapper"]] Loading @@ -81,39 +49,18 @@ ext = [["cpprb", "PyReplayBuffer"], ["cpprb", "VectorWrapper"]] ext_modules = [ Extension( ".".join(e), sources=["src/" + "/".join(e) + suffix], sources = ["src/" + "/".join(e) + ".pyx"], include_dirs = [np.get_include()], extra_compile_args = extra_compile_args, extra_link_args = extra_link_args, language = "c++", compiler_directives = compiler_directives, cython_include_dirs = ["."], ) for e in ext ] class LazyImportBuildExtCommand(build_ext): """ build_ext command class for lazy numpy and cython import """ def run(self): import numpy as np self.include_dirs.append(np.get_include()) build_ext.run(self) def finalize_options(self): if use_cython: from Cython.Build import cythonize self.distribution.ext_modules = cythonize( self.distribution.ext_modules, compiler_directives=compiler_directives, include_path=["."], annotate=True, ) super().finalize_options() description = "ReplayBuffer for Reinforcement Learning written by C++ and Cython" README = os.path.join(os.path.abspath(os.path.dirname(__file__)), "README.md") if os.path.exists(README): Loading @@ -126,36 +73,8 @@ else: long_description_content_type = "text/plain" setup( name="cpprb", author="Yamada Hiroyuki", description=description, version="11.0.0", install_requires=requires, setup_requires=setup_requires, cmdclass={"build_ext": LazyImportBuildExtCommand}, url="https://ymd_h.gitlab.io/cpprb/", project_urls={ "Source Code": "https://gitlab.com/ymd_h/cpprb", "Mirror": "https://github.com/ymd-h/cpprb", "Change Log": "https://ymd_h.gitlab.io/cpprb/changelog/", "Bug Report & QA": "https://github.com/ymd-h/cpprb/discussions", }, package_dir={"": "src"}, ext_modules=ext_modules, include_dirs=["cpprb"], packages=["cpprb"], classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries", ], long_description=long_description, long_description_content_type=long_description_content_type, )