From df258ae7137eca656ecb6458160ba0e033eb06ba Mon Sep 17 00:00:00 2001 From: davhofer Date: Wed, 11 Sep 2024 13:18:49 +0200 Subject: [PATCH] chore: fix naming of sample data for tests --- pyproject.toml | 1 - .../{test_data => sample_data}/CMakeLists.txt | 0 tests/sample_data/sample_archive.tar.gz | Bin 0 -> 409 bytes .../sample_archive}/pyproject.toml | 0 .../packages/py-test-pkg/package.py | 0 tests/sample_data/sample_repo/repo.yaml | 2 + tests/test_cmake_conversion.py | 2 +- tests/test_core.py | 4 +- tests/test_data/black/package.py | 91 ------ tests/test_data/black/pyproject23.12.0.toml | 262 ----------------- tests/test_data/black/pyproject23.12.1.toml | 262 ----------------- tests/test_data/black/pyproject24.2.0.toml | 266 ----------------- tests/test_data/black/pyproject24.4.0.toml | 266 ----------------- tests/test_data/black/pyproject24.4.1.toml | 266 ----------------- tests/test_data/black/pyproject24.4.2.toml | 266 ----------------- .../scikit-build-core/minimal/CMakeLists.txt | 9 - .../scikit-build-core/minimal/minimal.cpp | 7 - .../scikit-build-core/minimal/pyproject.toml | 7 - .../.pre-commit-config.yaml | 26 -- .../scikit-build-sample-projects/noxfile.py | 40 --- .../projects/core-c-hello/CMakeLists.txt | 9 - .../projects/core-c-hello/pyproject.toml | 8 - .../projects/core-c-hello/skcdpure.c | 27 -- .../core-pybind11-hello/CMakeLists.txt | 9 - .../core-pybind11-hello/pyproject.toml | 7 - .../projects/core-pybind11-hello/skcdemo.cpp | 9 - .../hatchling-pybind11-hello/CMakeLists.txt | 10 - .../hatchling-pybind11-hello/cpp/_core.cpp | 9 - .../hatchling-pybind11-hello/pyproject.toml | 10 - .../src/skcdemo/__init__.py | 3 - .../hello-cmake-package/CMakeLists.txt | 106 ------- .../projects/hello-cmake-package/README.md | 33 --- .../cmake/helloConfig.cmake.in | 3 - .../hello-cmake-package/include/hello.hpp | 14 - .../hello-cmake-package/pyproject.toml | 9 - .../projects/hello-cmake-package/setup.py | 14 - .../hello-cmake-package/src/hello.cpp | 9 - .../hello-cmake-package/src/hello/__init__.py | 3 - .../src/hello/__main__.py.in | 30 -- .../src/hello/hello_py.cpp | 9 - .../tests/cpp/CMakeLists.txt | 12 - .../hello-cmake-package/tests/cpp/test.cpp | 8 - .../hello-cmake-package/tests/test_hello.py | 9 - .../projects/hello-cpp/CMakeLists.txt | 9 - .../projects/hello-cpp/hello/__init__.py | 4 - .../projects/hello-cpp/hello/_hello.cxx | 65 ----- .../projects/hello-cpp/pyproject.toml | 8 - .../projects/hello-cpp/setup.py | 11 - .../hello-cpp/tests/test_hello_cpp.py | 11 - .../projects/hello-cython/CMakeLists.txt | 8 - .../hello-cython/hello/CMakeLists.txt | 7 - .../projects/hello-cython/hello/__init__.py | 3 - .../projects/hello-cython/hello/_hello.pyx | 8 - .../projects/hello-cython/pyproject.toml | 9 - .../projects/hello-cython/setup.py | 11 - .../hello-cython/tests/test_hello_cython.py | 11 - .../hello-free-threading/CMakeLists.txt | 19 -- .../hello-free-threading/pyproject.toml | 14 - .../src/freecomputepi/__init__.py | 0 .../src/freecomputepi/_core.cpp | 68 ----- .../src/freecomputepi/_pybcore.cpp | 25 -- .../src/freecomputepi/comp.py | 30 -- .../src/freecomputepi/pure.py | 44 --- .../src/freecomputepi/pybind.py | 30 -- .../hello-free-threading/tests/test_thread.py | 22 -- .../projects/hello-pure/hello/__init__.py | 7 - .../projects/hello-pure/pyproject.toml | 8 - .../projects/hello-pure/setup.py | 11 - .../projects/hello-pure/test_hello_pure.py | 11 - .../projects/hello-pybind11/CMakeLists.txt | 21 -- .../projects/hello-pybind11/README.md | 25 -- .../projects/hello-pybind11/pyproject.toml | 11 - .../projects/hello-pybind11/setup.py | 13 - .../hello-pybind11/src/hello/__init__.py | 3 - .../hello-pybind11/src/hello/hello_py.cpp | 18 -- .../tests/test_hello_pybind11.py | 19 -- .../projects/hello-pybind11/tox.ini | 2 - .../projects/pen2-cython/CMakeLists.txt | 11 - .../projects/pen2-cython/pyproject.toml | 9 - .../projects/pen2-cython/requirements-dev.txt | 2 - .../pen2-cython/scripts/CMakeLists.txt | 9 - .../projects/pen2-cython/scripts/pen2_cython | 5 - .../projects/pen2-cython/setup.py | 13 - .../projects/pen2-cython/src/CMakeLists.txt | 9 - .../projects/pen2-cython/src/__init__.py | 270 ------------------ .../projects/pen2-cython/src/__main__.py | 4 - .../projects/pen2-cython/src/_pen2.pyx | 172 ----------- .../projects/pi-fortran/CMakeLists.txt | 44 --- .../projects/pi-fortran/README.md | 25 -- .../projects/pi-fortran/pi/_pi.f | 17 -- .../projects/pi-fortran/pi/pi.pyf | 10 - .../projects/pi-fortran/pyproject.toml | 16 -- .../projects/pi-fortran/tests/test_pi.py | 9 - .../projects/tower-of-babel/CMakeLists.txt | 72 ----- .../tower-of-babel/requirements-dev.txt | 2 - .../tower-of-babel/scripts/CMakeLists.txt | 20 -- .../tower-of-babel/scripts/tbabel.pyx | 56 ---- .../projects/tower-of-babel/setup.py | 12 - .../tower-of-babel/tbabel_boost_common.h | 16 -- .../tower-of-babel/tbabel_boost_common_imp.h | 65 ----- .../tower-of-babel/tbabel_boost_module.cxx | 4 - .../tower-of-babel/tbabel_boost_module.h | 9 - .../tower-of-babel/tbabel_boost_module.pxd | 9 - .../tower-of-babel/tbabel_boost_shared.cxx | 4 - .../tower-of-babel/tbabel_boost_shared.h | 9 - .../tower-of-babel/tbabel_boost_shared.pxd | 9 - .../tower-of-babel/tbabel_boost_static.cxx | 4 - .../tower-of-babel/tbabel_boost_static.h | 9 - .../tower-of-babel/tbabel_boost_static.pxd | 9 - .../tower-of-babel/tbabel_cython_common.pxi | 8 - .../tbabel_cython_common_imp.pxi | 40 --- .../tower-of-babel/tbabel_cython_module.pxd | 2 - .../tower-of-babel/tbabel_cython_module.pyx | 3 - .../tower-of-babel/tbabel_cython_shared.pxd | 2 - .../tower-of-babel/tbabel_cython_shared.pyx | 3 - .../tower-of-babel/tbabel_cython_static.pxd | 2 - .../tower-of-babel/tbabel_cython_static.pyx | 3 - .../projects/tower-of-babel/tbabel_python.py | 17 -- .../requirements-test.txt | 11 - .../scikit-build-sample-projects/ruff.toml | 32 --- .../scikit-build-core/scikit_build_example | 1 - tests/test_data/test_archive.tar.gz | Bin 401 -> 0 bytes tests/test_data/test_repo/repo.yaml | 2 - tests/test_spack_utils.py | 8 +- tests/test_utils.py | 28 +- 125 files changed, 13 insertions(+), 3786 deletions(-) rename tests/{test_data => sample_data}/CMakeLists.txt (100%) create mode 100644 tests/sample_data/sample_archive.tar.gz rename tests/{test_data/test_archive => sample_data/sample_archive}/pyproject.toml (100%) rename tests/{test_data/test_repo => sample_data/sample_repo}/packages/py-test-pkg/package.py (100%) create mode 100644 tests/sample_data/sample_repo/repo.yaml delete mode 100644 tests/test_data/black/package.py delete mode 100644 tests/test_data/black/pyproject23.12.0.toml delete mode 100644 tests/test_data/black/pyproject23.12.1.toml delete mode 100644 tests/test_data/black/pyproject24.2.0.toml delete mode 100644 tests/test_data/black/pyproject24.4.0.toml delete mode 100644 tests/test_data/black/pyproject24.4.1.toml delete mode 100644 tests/test_data/black/pyproject24.4.2.toml delete mode 100644 tests/test_data/scikit-build-core/minimal/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/minimal/minimal.cpp delete mode 100644 tests/test_data/scikit-build-core/minimal/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/.pre-commit-config.yaml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/noxfile.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/skcdpure.c delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/skcdemo.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/cpp/_core.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/src/skcdemo/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/README.md delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/cmake/helloConfig.cmake.in delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/include/hello.hpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/setup.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__main__.py.in delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/hello_py.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/test.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/test_hello.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/_hello.cxx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/setup.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/tests/test_hello_cpp.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/_hello.pyx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/setup.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/tests/test_hello_cython.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_core.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_pybcore.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/comp.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pure.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pybind.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/tests/test_thread.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/hello/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/setup.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/test_hello_pure.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/README.md delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/setup.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/hello_py.cpp delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tests/test_hello_pybind11.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tox.ini delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/requirements-dev.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/CMakeLists.txt delete mode 100755 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/pen2_cython delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/setup.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__init__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__main__.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/_pen2.pyx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/README.md delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/_pi.f delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/pi.pyf delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pyproject.toml delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/tests/test_pi.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/requirements-dev.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/CMakeLists.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/tbabel.pyx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/setup.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common.h delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common_imp.h delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.cxx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.h delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.pxd delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.cxx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.h delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.pxd delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.cxx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.h delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.pxd delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common.pxi delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common_imp.pxi delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pxd delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pyx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pxd delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pyx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pxd delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pyx delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_python.py delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/requirements-test.txt delete mode 100644 tests/test_data/scikit-build-core/scikit-build-sample-projects/ruff.toml delete mode 160000 tests/test_data/scikit-build-core/scikit_build_example delete mode 100644 tests/test_data/test_archive.tar.gz delete mode 100644 tests/test_data/test_repo/repo.yaml diff --git a/pyproject.toml b/pyproject.toml index 6ea9f74..d434e34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -204,6 +204,5 @@ addopts = [ "--showlocals", "--strict-markers", "--strict-config", - "--ignore=tests/test_data/", ] testpaths = ["tests"] diff --git a/tests/test_data/CMakeLists.txt b/tests/sample_data/CMakeLists.txt similarity index 100% rename from tests/test_data/CMakeLists.txt rename to tests/sample_data/CMakeLists.txt diff --git a/tests/sample_data/sample_archive.tar.gz b/tests/sample_data/sample_archive.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..d94507c5c244e13476080eab88312d6d03ef3eda GIT binary patch literal 409 zcmV;K0cQRmiwFP!000001MSkmZk#X>24K#93X5Ee%fbSC+1z^Qp{Mp1p~`C}i(4=h zdskUiefJJ*+a#5mUJ_MJ{!d6?Gqz_m_PQTC`lu(<+9SP=o}oU*y%?|DveYdAanTzp_ZCk97WnUU>g6}!Yr8*8I@rNUaUtIi{XE None: """Test end-to-end conversion of black package.""" cwd = pathlib.Path.cwd() - repo = cwd / "tests" / "test_data" / "test_repo" + repo = cwd / "tests" / "sample_data" / "sample_repo" core.convert_package( package, max_conversions=1, versions_per_package=5, repo=str(repo), allow_duplicate=True diff --git a/tests/test_data/black/package.py b/tests/test_data/black/package.py deleted file mode 100644 index ef18953..0000000 --- a/tests/test_data/black/package.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) -from __future__ import annotations - -from spack.package import * - - -class PyBlack(PythonPackage): - """Black is the uncompromising Python code formatter. By using it, you agree to - cede control over minutiae of hand-formatting. In return, Black gives you - speed, determinism, and freedom from pycodestyle nagging about formatting. - """ - - homepage = "https://github.com/psf/black" - pypi = "black/black-22.1.0.tar.gz" - - license("MIT", checked_by="tgamblin") - maintainers("spack/spack-releasers") - - version("24.3.0", sha256="a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f") - version("24.2.0", sha256="bce4f25c27c3435e4dace4815bcb2008b87e167e3bf4ee47ccdc5ce906eb4894") - version("24.1.1", sha256="48b5760dcbfe5cf97fd4fba23946681f3a81514c6ab8a45b50da67ac8fbc6c7b") - version("24.1.0", sha256="30fbf768cd4f4576598b1db0202413fafea9a227ef808d1a12230c643cefe9fc") - version("23.12.1", sha256="4ce3ef14ebe8d9509188014d96af1c456a910d5b5cbf434a09fef7e024b3d0d5") - version("23.12.0", sha256="330a327b422aca0634ecd115985c1c7fd7bdb5b5a2ef8aa9888a82e2ebe9437a") - version("23.11.0", sha256="4c68855825ff432d197229846f971bc4d6666ce90492e5b02013bcaca4d9ab05") - version("23.10.1", sha256="1f8ce316753428ff68749c65a5f7844631aa18c8679dfd3ca9dc1a289979c258") - version("23.10.0", sha256="31b9f87b277a68d0e99d2905edae08807c007973eaa609da5f0c62def6b7c0bd") - version("23.9.1", sha256="24b6b3ff5c6d9ea08a8888f6977eae858e1f340d7260cf56d70a49823236b62d") - version("23.9.0", sha256="3511c8a7e22ce653f89ae90dfddaf94f3bb7e2587a245246572d3b9c92adf066") - version("23.7.0", sha256="022a582720b0d9480ed82576c920a8c1dde97cc38ff11d8d8859b3bd6ca9eedb") - version("23.3.0", sha256="1c7b8d606e728a41ea1ccbd7264677e494e87cf630e399262ced92d4a8dac940") - version("23.1.0", sha256="b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac") - version("22.12.0", sha256="229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f") - version("22.10.0", sha256="f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1") - version("22.8.0", sha256="792f7eb540ba9a17e8656538701d3eb1afcb134e3b45b71f20b25c77a8db7e6e") - version("22.6.0", sha256="6c6d39e28aed379aec40da1c65434c77d75e65bb59a1e1c283de545fb4e7c6c9") - version("22.3.0", sha256="35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79") - version("22.1.0", sha256="a7c0192d35635f6fc1174be575cb7915e92e5dd629ee79fdaf0dcfa41a80afb5") - - variant("colorama", default=False, description="enable colorama support") - variant("uvloop", default=False, description="enable uvloop support") - variant("d", default=False, description="enable blackd HTTP server") - variant("jupyter", default=False, description="enable Jupyter support") - - depends_on("py-hatchling@1.20:", when="@23.12.1:", type="build") - depends_on("py-hatchling@1.8:", when="@22.10:", type="build") - depends_on("py-hatch-vcs", when="@22.10:", type="build") - depends_on("py-hatch-fancy-pypi-readme", when="@22.10:", type="build") - - with default_args(type=("build", "run")): - depends_on("python@3.8:", when="@23.7:") - depends_on("python@3.7:", when="@22.10:") - depends_on("py-click@8:") - depends_on("py-mypy-extensions@0.4.3:") - depends_on("py-packaging@22:", when="@23.1:") - depends_on("py-pathspec@0.9:") - depends_on("py-platformdirs@2:") - depends_on("py-tomli@1.1:", when="@22.8: ^python@:3.10") - depends_on("py-tomli@1.1:", when="@21.7:22.6") - depends_on("py-typing-extensions@4.0.1:", when="@23.9: ^python@:3.10") - depends_on("py-typing-extensions@3.10:", when="@:23.7 ^python@:3.9") - - depends_on("py-colorama@0.4.3:", when="+colorama") - depends_on("py-uvloop@0.15.2:", when="+uvloop") - depends_on("py-aiohttp@3.7.4:", when="+d") - depends_on("py-ipython@7.8:", when="+jupyter") - depends_on("py-tokenize-rt@3.2:", when="+jupyter") - - # Historical dependencies - depends_on("py-setuptools@45:", when="@:22.8", type=("build", "run")) - depends_on("py-setuptools-scm@6.3.1:+toml", when="@:22.8", type="build") - depends_on("py-typed-ast@1.4.2:", when="^python@:3.7", type=("build", "run")) - - # Needed because this package is used to bootstrap Spack (Spack supports Python 3.6+) - depends_on("py-dataclasses@0.6:", when="^python@:3.6", type=("build", "run")) - - # see: https://github.com/psf/black/issues/2964 - # note that pip doesn't know this constraint. - depends_on("py-click@:8.0", when="@:22.2", type=("build", "run")) - - @property - def import_modules(self): - modules = ["blib2to3", "blib2to3.pgen2", "black"] - - if "+d" in self.spec: - modules.append("blackd") - - return modules diff --git a/tests/test_data/black/pyproject23.12.0.toml b/tests/test_data/black/pyproject23.12.0.toml deleted file mode 100644 index 1098412..0000000 --- a/tests/test_data/black/pyproject23.12.0.toml +++ /dev/null @@ -1,262 +0,0 @@ -# Example configuration for Black. - -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. - -[tool.black] -line-length = 88 -target-version = ['py38'] -include = '\.pyi?$' -extend-exclude = ''' -/( - # The following are specific to Black, you probably don't want those. - tests/data - | profiling -)/ -''' -# We use preview style for formatting Black itself. If you -# want stable formatting across releases, you should keep -# this off. -preview = true - -# Build system information and other project-specific configuration below. -# NOTE: You don't need this in your own Black configuration. - -[build-system] -requires = ["hatchling>=1.8.0", "hatch-vcs", "hatch-fancy-pypi-readme"] -build-backend = "hatchling.build" - -[project] -name = "black" -description = "The uncompromising code formatter." -license = { text = "MIT" } -requires-python = ">=3.8" -authors = [ - { name = "Łukasz Langa", email = "lukasz@langa.pl" }, -] -keywords = [ - "automation", - "autopep8", - "formatter", - "gofmt", - "pyfmt", - "rustfmt", - "yapf", -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "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", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", -] -dependencies = [ - "click>=8.0.0", - "mypy_extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < '3.11'", - "typing_extensions>=4.0.1; python_version < '3.11'", -] -dynamic = ["readme", "version"] - -[project.optional-dependencies] -colorama = ["colorama>=0.4.3"] -uvloop = ["uvloop>=0.15.2"] -d = [ - "aiohttp>=3.7.4; sys_platform != 'win32' or implementation_name != 'pypy'", - "aiohttp>=3.7.4, !=3.9.0; sys_platform == 'win32' and implementation_name == 'pypy'", -] -jupyter = [ - "ipython>=7.8.0", - "tokenize-rt>=3.2.0", -] - -[project.scripts] -black = "black:patched_main" -blackd = "blackd:patched_main [d]" - -[project.urls] -Changelog = "https://github.com/psf/black/blob/main/CHANGES.md" -Homepage = "https://github.com/psf/black" - -[tool.hatch.metadata.hooks.fancy-pypi-readme] -content-type = "text/markdown" -fragments = [ - { path = "README.md" }, - { path = "CHANGES.md" }, -] - -[tool.hatch.version] -source = "vcs" - -[tool.hatch.build.hooks.vcs] -version-file = "src/_black_version.py" -template = ''' -version = "{version}" -''' - -[tool.hatch.build.targets.sdist] -exclude = ["/profiling"] - -[tool.hatch.build.targets.wheel] -only-include = ["src"] -sources = ["src"] -# Note that we change the behaviour of this flag below -macos-max-compat = true - -[tool.hatch.build.targets.wheel.hooks.mypyc] -enable-by-default = false -dependencies = [ - "hatch-mypyc>=0.16.0", - "mypy==1.7.1", - "click==8.1.3", # avoid https://github.com/pallets/click/issues/2558 -] -require-runtime-dependencies = true -exclude = [ - # There's no good reason for blackd to be compiled. - "/src/blackd", - # Not performance sensitive, so save bytes + compilation time: - "/src/blib2to3/__init__.py", - "/src/blib2to3/pgen2/__init__.py", - "/src/black/output.py", - "/src/black/concurrency.py", - "/src/black/files.py", - "/src/black/report.py", - # Breaks the test suite when compiled (and is also useless): - "/src/black/debug.py", - # Compiled modules can't be run directly and that's a problem here: - "/src/black/__main__.py", -] -mypy-args = ["--ignore-missing-imports"] -options = { debug_level = "0" } - -[tool.cibuildwheel] -build-verbosity = 1 -# So these are the environments we target: -# - Python: CPython 3.8+ only -# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64 -# - OS: Linux (no musl), Windows, and macOS -build = "cp3*" -skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp*"] -# This is the bare minimum needed to run the test suite. Pulling in the full -# test_requirements.txt would download a bunch of other packages not necessary -# here and would slow down the testing step a fair bit. -test-requires = ["pytest>=6.1.1"] -test-command = 'pytest {project} -k "not incompatible_with_mypyc"' -test-extras = ["d"," jupyter"] -# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't -# straight up crash) -test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"] - -[tool.cibuildwheel.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -# CPython 3.11 wheels aren't available for aiohttp and building a Cython extension -# from source also doesn't work. -AIOHTTP_NO_EXTENSIONS = "1" - -[tool.cibuildwheel.linux] -before-build = [ - "yum install -y clang gcc", -] - -[tool.cibuildwheel.linux.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -AIOHTTP_NO_EXTENSIONS = "1" - -# Black needs Clang to compile successfully on Linux. -CC = "clang" - -[tool.cibuildwheel.macos] -build-frontend = { name = "build", args = ["--no-isolation"] } -# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET -before-build = [ - "python -m pip install 'hatchling==1.18.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'", - """sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """, -] - -[tool.isort] -atomic = true -profile = "black" -line_length = 88 -skip_gitignore = true -skip_glob = ["tests/data", "profiling"] -known_first_party = ["black", "blib2to3", "blackd", "_black_version"] - -[tool.pytest.ini_options] -# Option below requires `tests/optional.py` -addopts = "--strict-config --strict-markers" -optional-tests = [ - "no_blackd: run when `d` extra NOT installed", - "no_jupyter: run when `jupyter` extra NOT installed", -] -markers = [ - "incompatible_with_mypyc: run when testing mypyc compiled black" -] -xfail_strict = true -filterwarnings = [ - "error", - # this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/ - # this ignore can be removed when support for aiohttp 3.7 is dropped. - '''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''', - # this is mitigated by a try/catch in https://github.com/psf/black/pull/3198/ - # this ignore can be removed when support for aiohttp 3.x is dropped. - '''ignore:Middleware decorator is deprecated since 4\.0 and its behaviour is default, you can simply remove this decorator:DeprecationWarning''', - # aiohttp is using deprecated cgi modules - Safe to remove when fixed: - # https://github.com/aio-libs/aiohttp/issues/6905 - '''ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning''', - # Work around https://github.com/pytest-dev/pytest/issues/10977 for Python 3.12 - '''ignore:(Attribute s|Attribute n|ast.Str|ast.Bytes|ast.NameConstant|ast.Num) is deprecated and will be removed in Python 3.14:DeprecationWarning''', - # Will be fixed with aiohttp 3.9.0 - # https://github.com/aio-libs/aiohttp/pull/7302 - "ignore:datetime.*utcfromtimestamp\\(\\) is deprecated and scheduled for removal:DeprecationWarning", -] -[tool.coverage.report] -omit = [ - "src/blib2to3/*", - "tests/data/*", - "*/site-packages/*", - ".tox/*" -] -[tool.coverage.run] -relative_files = true -branch = true - -[tool.mypy] -# Specify the target platform details in config, so your developers are -# free to run mypy on Windows, Linux, or macOS and get consistent -# results. -python_version = "3.8" -mypy_path = "src" -strict = true -# Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place. -warn_unreachable = true -implicit_reexport = true -show_error_codes = true -show_column_numbers = true - -[[tool.mypy.overrides]] -module = ["pathspec.*", "IPython.*", "colorama.*", "tokenize_rt.*", "uvloop.*", "_black_version.*"] -ignore_missing_imports = true - -# CI only checks src/, but in case users are running LSP or similar we explicitly ignore -# errors in test data files. -[[tool.mypy.overrides]] -module = ["tests.data.*"] -ignore_errors = true diff --git a/tests/test_data/black/pyproject23.12.1.toml b/tests/test_data/black/pyproject23.12.1.toml deleted file mode 100644 index 24b9c07..0000000 --- a/tests/test_data/black/pyproject23.12.1.toml +++ /dev/null @@ -1,262 +0,0 @@ -# Example configuration for Black. - -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. - -[tool.black] -line-length = 88 -target-version = ['py38'] -include = '\.pyi?$' -extend-exclude = ''' -/( - # The following are specific to Black, you probably don't want those. - tests/data - | profiling -)/ -''' -# We use preview style for formatting Black itself. If you -# want stable formatting across releases, you should keep -# this off. -preview = true - -# Build system information and other project-specific configuration below. -# NOTE: You don't need this in your own Black configuration. - -[build-system] -requires = ["hatchling>=1.20.0", "hatch-vcs", "hatch-fancy-pypi-readme"] -build-backend = "hatchling.build" - -[project] -name = "black" -description = "The uncompromising code formatter." -license = { text = "MIT" } -requires-python = ">=3.8" -authors = [ - { name = "Łukasz Langa", email = "lukasz@langa.pl" }, -] -keywords = [ - "automation", - "autopep8", - "formatter", - "gofmt", - "pyfmt", - "rustfmt", - "yapf", -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "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", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", -] -dependencies = [ - "click>=8.0.0", - "mypy_extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < '3.11'", - "typing_extensions>=4.0.1; python_version < '3.11'", -] -dynamic = ["readme", "version"] - -[project.optional-dependencies] -colorama = ["colorama>=0.4.3"] -uvloop = ["uvloop>=0.15.2"] -d = [ - "aiohttp>=3.7.4; sys_platform != 'win32' or implementation_name != 'pypy'", - "aiohttp>=3.7.4, !=3.9.0; sys_platform == 'win32' and implementation_name == 'pypy'", -] -jupyter = [ - "ipython>=7.8.0", - "tokenize-rt>=3.2.0", -] - -[project.scripts] -black = "black:patched_main" -blackd = "blackd:patched_main [d]" - -[project.urls] -Changelog = "https://github.com/psf/black/blob/main/CHANGES.md" -Homepage = "https://github.com/psf/black" - -[tool.hatch.metadata.hooks.fancy-pypi-readme] -content-type = "text/markdown" -fragments = [ - { path = "README.md" }, - { path = "CHANGES.md" }, -] - -[tool.hatch.version] -source = "vcs" - -[tool.hatch.build.hooks.vcs] -version-file = "src/_black_version.py" -template = ''' -version = "{version}" -''' - -[tool.hatch.build.targets.sdist] -exclude = ["/profiling"] - -[tool.hatch.build.targets.wheel] -only-include = ["src"] -sources = ["src"] -# Note that we change the behaviour of this flag below -macos-max-compat = true - -[tool.hatch.build.targets.wheel.hooks.mypyc] -enable-by-default = false -dependencies = [ - "hatch-mypyc>=0.16.0", - "mypy==1.7.1", - "click==8.1.3", # avoid https://github.com/pallets/click/issues/2558 -] -require-runtime-dependencies = true -exclude = [ - # There's no good reason for blackd to be compiled. - "/src/blackd", - # Not performance sensitive, so save bytes + compilation time: - "/src/blib2to3/__init__.py", - "/src/blib2to3/pgen2/__init__.py", - "/src/black/output.py", - "/src/black/concurrency.py", - "/src/black/files.py", - "/src/black/report.py", - # Breaks the test suite when compiled (and is also useless): - "/src/black/debug.py", - # Compiled modules can't be run directly and that's a problem here: - "/src/black/__main__.py", -] -mypy-args = ["--ignore-missing-imports"] -options = { debug_level = "0" } - -[tool.cibuildwheel] -build-verbosity = 1 -# So these are the environments we target: -# - Python: CPython 3.8+ only -# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64 -# - OS: Linux (no musl), Windows, and macOS -build = "cp3*" -skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp*"] -# This is the bare minimum needed to run the test suite. Pulling in the full -# test_requirements.txt would download a bunch of other packages not necessary -# here and would slow down the testing step a fair bit. -test-requires = ["pytest>=6.1.1"] -test-command = 'pytest {project} -k "not incompatible_with_mypyc"' -test-extras = ["d"," jupyter"] -# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't -# straight up crash) -test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"] - -[tool.cibuildwheel.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -# CPython 3.11 wheels aren't available for aiohttp and building a Cython extension -# from source also doesn't work. -AIOHTTP_NO_EXTENSIONS = "1" - -[tool.cibuildwheel.linux] -before-build = [ - "yum install -y clang gcc", -] - -[tool.cibuildwheel.linux.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -AIOHTTP_NO_EXTENSIONS = "1" - -# Black needs Clang to compile successfully on Linux. -CC = "clang" - -[tool.cibuildwheel.macos] -build-frontend = { name = "build", args = ["--no-isolation"] } -# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET -before-build = [ - "python -m pip install 'hatchling==1.20.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'", - """sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """, -] - -[tool.isort] -atomic = true -profile = "black" -line_length = 88 -skip_gitignore = true -skip_glob = ["tests/data", "profiling"] -known_first_party = ["black", "blib2to3", "blackd", "_black_version"] - -[tool.pytest.ini_options] -# Option below requires `tests/optional.py` -addopts = "--strict-config --strict-markers" -optional-tests = [ - "no_blackd: run when `d` extra NOT installed", - "no_jupyter: run when `jupyter` extra NOT installed", -] -markers = [ - "incompatible_with_mypyc: run when testing mypyc compiled black" -] -xfail_strict = true -filterwarnings = [ - "error", - # this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/ - # this ignore can be removed when support for aiohttp 3.7 is dropped. - '''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''', - # this is mitigated by a try/catch in https://github.com/psf/black/pull/3198/ - # this ignore can be removed when support for aiohttp 3.x is dropped. - '''ignore:Middleware decorator is deprecated since 4\.0 and its behaviour is default, you can simply remove this decorator:DeprecationWarning''', - # aiohttp is using deprecated cgi modules - Safe to remove when fixed: - # https://github.com/aio-libs/aiohttp/issues/6905 - '''ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning''', - # Work around https://github.com/pytest-dev/pytest/issues/10977 for Python 3.12 - '''ignore:(Attribute s|Attribute n|ast.Str|ast.Bytes|ast.NameConstant|ast.Num) is deprecated and will be removed in Python 3.14:DeprecationWarning''', - # Will be fixed with aiohttp 3.9.0 - # https://github.com/aio-libs/aiohttp/pull/7302 - "ignore:datetime.*utcfromtimestamp\\(\\) is deprecated and scheduled for removal:DeprecationWarning", -] -[tool.coverage.report] -omit = [ - "src/blib2to3/*", - "tests/data/*", - "*/site-packages/*", - ".tox/*" -] -[tool.coverage.run] -relative_files = true -branch = true - -[tool.mypy] -# Specify the target platform details in config, so your developers are -# free to run mypy on Windows, Linux, or macOS and get consistent -# results. -python_version = "3.8" -mypy_path = "src" -strict = true -# Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place. -warn_unreachable = true -implicit_reexport = true -show_error_codes = true -show_column_numbers = true - -[[tool.mypy.overrides]] -module = ["pathspec.*", "IPython.*", "colorama.*", "tokenize_rt.*", "uvloop.*", "_black_version.*"] -ignore_missing_imports = true - -# CI only checks src/, but in case users are running LSP or similar we explicitly ignore -# errors in test data files. -[[tool.mypy.overrides]] -module = ["tests.data.*"] -ignore_errors = true diff --git a/tests/test_data/black/pyproject24.2.0.toml b/tests/test_data/black/pyproject24.2.0.toml deleted file mode 100644 index 143c484..0000000 --- a/tests/test_data/black/pyproject24.2.0.toml +++ /dev/null @@ -1,266 +0,0 @@ -# Example configuration for Black. - -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. - -[tool.black] -line-length = 88 -target-version = ['py38'] -include = '\.pyi?$' -extend-exclude = ''' -/( - # The following are specific to Black, you probably don't want those. - tests/data - | profiling -)/ -''' -# We use the unstable style for formatting Black itself. If you -# want bug-free formatting, you should keep this off. If you want -# stable formatting across releases, you should also keep `preview = true` -# (which is implied by this flag) off. -unstable = true - -# Build system information and other project-specific configuration below. -# NOTE: You don't need this in your own Black configuration. - -[build-system] -requires = ["hatchling>=1.20.0", "hatch-vcs", "hatch-fancy-pypi-readme"] -build-backend = "hatchling.build" - -[project] -name = "black" -description = "The uncompromising code formatter." -license = { text = "MIT" } -requires-python = ">=3.8" -authors = [ - { name = "Łukasz Langa", email = "lukasz@langa.pl" }, -] -keywords = [ - "automation", - "autopep8", - "formatter", - "gofmt", - "pyfmt", - "rustfmt", - "yapf", -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "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", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", -] -dependencies = [ - "click>=8.0.0", - "mypy_extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < '3.11'", - "typing_extensions>=4.0.1; python_version < '3.11'", -] -dynamic = ["readme", "version"] - -[project.optional-dependencies] -colorama = ["colorama>=0.4.3"] -uvloop = ["uvloop>=0.15.2"] -d = [ - "aiohttp>=3.7.4; sys_platform != 'win32' or implementation_name != 'pypy'", - "aiohttp>=3.7.4, !=3.9.0; sys_platform == 'win32' and implementation_name == 'pypy'", -] -jupyter = [ - "ipython>=7.8.0", - "tokenize-rt>=3.2.0", -] - -[project.scripts] -black = "black:patched_main" -blackd = "blackd:patched_main [d]" - -[project.entry-points."validate_pyproject.tool_schema"] -black = "black.schema:get_schema" - -[project.urls] -Changelog = "https://github.com/psf/black/blob/main/CHANGES.md" -Homepage = "https://github.com/psf/black" - -[tool.hatch.metadata.hooks.fancy-pypi-readme] -content-type = "text/markdown" -fragments = [ - { path = "README.md" }, - { path = "CHANGES.md" }, -] - -[tool.hatch.version] -source = "vcs" - -[tool.hatch.build.hooks.vcs] -version-file = "src/_black_version.py" -template = ''' -version = "{version}" -''' - -[tool.hatch.build.targets.sdist] -exclude = ["/profiling"] - -[tool.hatch.build.targets.wheel] -only-include = ["src"] -sources = ["src"] -# Note that we change the behaviour of this flag below -macos-max-compat = true - -[tool.hatch.build.targets.wheel.hooks.mypyc] -enable-by-default = false -dependencies = [ - "hatch-mypyc>=0.16.0", - "mypy==1.7.1", - "click==8.1.3", # avoid https://github.com/pallets/click/issues/2558 -] -require-runtime-dependencies = true -exclude = [ - # There's no good reason for blackd to be compiled. - "/src/blackd", - # Not performance sensitive, so save bytes + compilation time: - "/src/blib2to3/__init__.py", - "/src/blib2to3/pgen2/__init__.py", - "/src/black/output.py", - "/src/black/concurrency.py", - "/src/black/files.py", - "/src/black/report.py", - # Breaks the test suite when compiled (and is also useless): - "/src/black/debug.py", - # Compiled modules can't be run directly and that's a problem here: - "/src/black/__main__.py", -] -mypy-args = ["--ignore-missing-imports"] -options = { debug_level = "0" } - -[tool.cibuildwheel] -build-verbosity = 1 -# So these are the environments we target: -# - Python: CPython 3.8+ only -# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64 -# - OS: Linux (no musl), Windows, and macOS -build = "cp3*" -skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp*"] -# This is the bare minimum needed to run the test suite. Pulling in the full -# test_requirements.txt would download a bunch of other packages not necessary -# here and would slow down the testing step a fair bit. -test-requires = ["pytest>=6.1.1"] -test-command = 'pytest {project} -k "not incompatible_with_mypyc"' -test-extras = ["d"," jupyter"] -# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't -# straight up crash) -test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"] - -[tool.cibuildwheel.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -# CPython 3.11 wheels aren't available for aiohttp and building a Cython extension -# from source also doesn't work. -AIOHTTP_NO_EXTENSIONS = "1" - -[tool.cibuildwheel.linux] -before-build = [ - "yum install -y clang gcc", -] - -[tool.cibuildwheel.linux.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -AIOHTTP_NO_EXTENSIONS = "1" - -# Black needs Clang to compile successfully on Linux. -CC = "clang" - -[tool.cibuildwheel.macos] -build-frontend = { name = "build", args = ["--no-isolation"] } -# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET -before-build = [ - "python -m pip install 'hatchling==1.20.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'", - """sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """, -] - -[tool.isort] -atomic = true -profile = "black" -line_length = 88 -skip_gitignore = true -skip_glob = ["tests/data", "profiling"] -known_first_party = ["black", "blib2to3", "blackd", "_black_version"] - -[tool.pytest.ini_options] -# Option below requires `tests/optional.py` -addopts = "--strict-config --strict-markers" -optional-tests = [ - "no_blackd: run when `d` extra NOT installed", - "no_jupyter: run when `jupyter` extra NOT installed", -] -markers = [ - "incompatible_with_mypyc: run when testing mypyc compiled black" -] -xfail_strict = true -filterwarnings = [ - "error", - # this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/ - # this ignore can be removed when support for aiohttp 3.7 is dropped. - '''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''', - # this is mitigated by a try/catch in https://github.com/psf/black/pull/3198/ - # this ignore can be removed when support for aiohttp 3.x is dropped. - '''ignore:Middleware decorator is deprecated since 4\.0 and its behaviour is default, you can simply remove this decorator:DeprecationWarning''', - # aiohttp is using deprecated cgi modules - Safe to remove when fixed: - # https://github.com/aio-libs/aiohttp/issues/6905 - '''ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning''', - # Work around https://github.com/pytest-dev/pytest/issues/10977 for Python 3.12 - '''ignore:(Attribute s|Attribute n|ast.Str|ast.Bytes|ast.NameConstant|ast.Num) is deprecated and will be removed in Python 3.14:DeprecationWarning''', - # Will be fixed with aiohttp 3.9.0 - # https://github.com/aio-libs/aiohttp/pull/7302 - "ignore:datetime.*utcfromtimestamp\\(\\) is deprecated and scheduled for removal:DeprecationWarning", -] -[tool.coverage.report] -omit = [ - "src/blib2to3/*", - "tests/data/*", - "*/site-packages/*", - ".tox/*" -] -[tool.coverage.run] -relative_files = true -branch = true - -[tool.mypy] -# Specify the target platform details in config, so your developers are -# free to run mypy on Windows, Linux, or macOS and get consistent -# results. -python_version = "3.8" -mypy_path = "src" -strict = true -# Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place. -warn_unreachable = true -implicit_reexport = true -show_error_codes = true -show_column_numbers = true - -[[tool.mypy.overrides]] -module = ["pathspec.*", "IPython.*", "colorama.*", "tokenize_rt.*", "uvloop.*", "_black_version.*"] -ignore_missing_imports = true - -# CI only checks src/, but in case users are running LSP or similar we explicitly ignore -# errors in test data files. -[[tool.mypy.overrides]] -module = ["tests.data.*"] -ignore_errors = true diff --git a/tests/test_data/black/pyproject24.4.0.toml b/tests/test_data/black/pyproject24.4.0.toml deleted file mode 100644 index 143c484..0000000 --- a/tests/test_data/black/pyproject24.4.0.toml +++ /dev/null @@ -1,266 +0,0 @@ -# Example configuration for Black. - -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. - -[tool.black] -line-length = 88 -target-version = ['py38'] -include = '\.pyi?$' -extend-exclude = ''' -/( - # The following are specific to Black, you probably don't want those. - tests/data - | profiling -)/ -''' -# We use the unstable style for formatting Black itself. If you -# want bug-free formatting, you should keep this off. If you want -# stable formatting across releases, you should also keep `preview = true` -# (which is implied by this flag) off. -unstable = true - -# Build system information and other project-specific configuration below. -# NOTE: You don't need this in your own Black configuration. - -[build-system] -requires = ["hatchling>=1.20.0", "hatch-vcs", "hatch-fancy-pypi-readme"] -build-backend = "hatchling.build" - -[project] -name = "black" -description = "The uncompromising code formatter." -license = { text = "MIT" } -requires-python = ">=3.8" -authors = [ - { name = "Łukasz Langa", email = "lukasz@langa.pl" }, -] -keywords = [ - "automation", - "autopep8", - "formatter", - "gofmt", - "pyfmt", - "rustfmt", - "yapf", -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "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", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", -] -dependencies = [ - "click>=8.0.0", - "mypy_extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < '3.11'", - "typing_extensions>=4.0.1; python_version < '3.11'", -] -dynamic = ["readme", "version"] - -[project.optional-dependencies] -colorama = ["colorama>=0.4.3"] -uvloop = ["uvloop>=0.15.2"] -d = [ - "aiohttp>=3.7.4; sys_platform != 'win32' or implementation_name != 'pypy'", - "aiohttp>=3.7.4, !=3.9.0; sys_platform == 'win32' and implementation_name == 'pypy'", -] -jupyter = [ - "ipython>=7.8.0", - "tokenize-rt>=3.2.0", -] - -[project.scripts] -black = "black:patched_main" -blackd = "blackd:patched_main [d]" - -[project.entry-points."validate_pyproject.tool_schema"] -black = "black.schema:get_schema" - -[project.urls] -Changelog = "https://github.com/psf/black/blob/main/CHANGES.md" -Homepage = "https://github.com/psf/black" - -[tool.hatch.metadata.hooks.fancy-pypi-readme] -content-type = "text/markdown" -fragments = [ - { path = "README.md" }, - { path = "CHANGES.md" }, -] - -[tool.hatch.version] -source = "vcs" - -[tool.hatch.build.hooks.vcs] -version-file = "src/_black_version.py" -template = ''' -version = "{version}" -''' - -[tool.hatch.build.targets.sdist] -exclude = ["/profiling"] - -[tool.hatch.build.targets.wheel] -only-include = ["src"] -sources = ["src"] -# Note that we change the behaviour of this flag below -macos-max-compat = true - -[tool.hatch.build.targets.wheel.hooks.mypyc] -enable-by-default = false -dependencies = [ - "hatch-mypyc>=0.16.0", - "mypy==1.7.1", - "click==8.1.3", # avoid https://github.com/pallets/click/issues/2558 -] -require-runtime-dependencies = true -exclude = [ - # There's no good reason for blackd to be compiled. - "/src/blackd", - # Not performance sensitive, so save bytes + compilation time: - "/src/blib2to3/__init__.py", - "/src/blib2to3/pgen2/__init__.py", - "/src/black/output.py", - "/src/black/concurrency.py", - "/src/black/files.py", - "/src/black/report.py", - # Breaks the test suite when compiled (and is also useless): - "/src/black/debug.py", - # Compiled modules can't be run directly and that's a problem here: - "/src/black/__main__.py", -] -mypy-args = ["--ignore-missing-imports"] -options = { debug_level = "0" } - -[tool.cibuildwheel] -build-verbosity = 1 -# So these are the environments we target: -# - Python: CPython 3.8+ only -# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64 -# - OS: Linux (no musl), Windows, and macOS -build = "cp3*" -skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp*"] -# This is the bare minimum needed to run the test suite. Pulling in the full -# test_requirements.txt would download a bunch of other packages not necessary -# here and would slow down the testing step a fair bit. -test-requires = ["pytest>=6.1.1"] -test-command = 'pytest {project} -k "not incompatible_with_mypyc"' -test-extras = ["d"," jupyter"] -# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't -# straight up crash) -test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"] - -[tool.cibuildwheel.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -# CPython 3.11 wheels aren't available for aiohttp and building a Cython extension -# from source also doesn't work. -AIOHTTP_NO_EXTENSIONS = "1" - -[tool.cibuildwheel.linux] -before-build = [ - "yum install -y clang gcc", -] - -[tool.cibuildwheel.linux.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -AIOHTTP_NO_EXTENSIONS = "1" - -# Black needs Clang to compile successfully on Linux. -CC = "clang" - -[tool.cibuildwheel.macos] -build-frontend = { name = "build", args = ["--no-isolation"] } -# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET -before-build = [ - "python -m pip install 'hatchling==1.20.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'", - """sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """, -] - -[tool.isort] -atomic = true -profile = "black" -line_length = 88 -skip_gitignore = true -skip_glob = ["tests/data", "profiling"] -known_first_party = ["black", "blib2to3", "blackd", "_black_version"] - -[tool.pytest.ini_options] -# Option below requires `tests/optional.py` -addopts = "--strict-config --strict-markers" -optional-tests = [ - "no_blackd: run when `d` extra NOT installed", - "no_jupyter: run when `jupyter` extra NOT installed", -] -markers = [ - "incompatible_with_mypyc: run when testing mypyc compiled black" -] -xfail_strict = true -filterwarnings = [ - "error", - # this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/ - # this ignore can be removed when support for aiohttp 3.7 is dropped. - '''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''', - # this is mitigated by a try/catch in https://github.com/psf/black/pull/3198/ - # this ignore can be removed when support for aiohttp 3.x is dropped. - '''ignore:Middleware decorator is deprecated since 4\.0 and its behaviour is default, you can simply remove this decorator:DeprecationWarning''', - # aiohttp is using deprecated cgi modules - Safe to remove when fixed: - # https://github.com/aio-libs/aiohttp/issues/6905 - '''ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning''', - # Work around https://github.com/pytest-dev/pytest/issues/10977 for Python 3.12 - '''ignore:(Attribute s|Attribute n|ast.Str|ast.Bytes|ast.NameConstant|ast.Num) is deprecated and will be removed in Python 3.14:DeprecationWarning''', - # Will be fixed with aiohttp 3.9.0 - # https://github.com/aio-libs/aiohttp/pull/7302 - "ignore:datetime.*utcfromtimestamp\\(\\) is deprecated and scheduled for removal:DeprecationWarning", -] -[tool.coverage.report] -omit = [ - "src/blib2to3/*", - "tests/data/*", - "*/site-packages/*", - ".tox/*" -] -[tool.coverage.run] -relative_files = true -branch = true - -[tool.mypy] -# Specify the target platform details in config, so your developers are -# free to run mypy on Windows, Linux, or macOS and get consistent -# results. -python_version = "3.8" -mypy_path = "src" -strict = true -# Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place. -warn_unreachable = true -implicit_reexport = true -show_error_codes = true -show_column_numbers = true - -[[tool.mypy.overrides]] -module = ["pathspec.*", "IPython.*", "colorama.*", "tokenize_rt.*", "uvloop.*", "_black_version.*"] -ignore_missing_imports = true - -# CI only checks src/, but in case users are running LSP or similar we explicitly ignore -# errors in test data files. -[[tool.mypy.overrides]] -module = ["tests.data.*"] -ignore_errors = true diff --git a/tests/test_data/black/pyproject24.4.1.toml b/tests/test_data/black/pyproject24.4.1.toml deleted file mode 100644 index 143c484..0000000 --- a/tests/test_data/black/pyproject24.4.1.toml +++ /dev/null @@ -1,266 +0,0 @@ -# Example configuration for Black. - -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. - -[tool.black] -line-length = 88 -target-version = ['py38'] -include = '\.pyi?$' -extend-exclude = ''' -/( - # The following are specific to Black, you probably don't want those. - tests/data - | profiling -)/ -''' -# We use the unstable style for formatting Black itself. If you -# want bug-free formatting, you should keep this off. If you want -# stable formatting across releases, you should also keep `preview = true` -# (which is implied by this flag) off. -unstable = true - -# Build system information and other project-specific configuration below. -# NOTE: You don't need this in your own Black configuration. - -[build-system] -requires = ["hatchling>=1.20.0", "hatch-vcs", "hatch-fancy-pypi-readme"] -build-backend = "hatchling.build" - -[project] -name = "black" -description = "The uncompromising code formatter." -license = { text = "MIT" } -requires-python = ">=3.8" -authors = [ - { name = "Łukasz Langa", email = "lukasz@langa.pl" }, -] -keywords = [ - "automation", - "autopep8", - "formatter", - "gofmt", - "pyfmt", - "rustfmt", - "yapf", -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "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", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", -] -dependencies = [ - "click>=8.0.0", - "mypy_extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < '3.11'", - "typing_extensions>=4.0.1; python_version < '3.11'", -] -dynamic = ["readme", "version"] - -[project.optional-dependencies] -colorama = ["colorama>=0.4.3"] -uvloop = ["uvloop>=0.15.2"] -d = [ - "aiohttp>=3.7.4; sys_platform != 'win32' or implementation_name != 'pypy'", - "aiohttp>=3.7.4, !=3.9.0; sys_platform == 'win32' and implementation_name == 'pypy'", -] -jupyter = [ - "ipython>=7.8.0", - "tokenize-rt>=3.2.0", -] - -[project.scripts] -black = "black:patched_main" -blackd = "blackd:patched_main [d]" - -[project.entry-points."validate_pyproject.tool_schema"] -black = "black.schema:get_schema" - -[project.urls] -Changelog = "https://github.com/psf/black/blob/main/CHANGES.md" -Homepage = "https://github.com/psf/black" - -[tool.hatch.metadata.hooks.fancy-pypi-readme] -content-type = "text/markdown" -fragments = [ - { path = "README.md" }, - { path = "CHANGES.md" }, -] - -[tool.hatch.version] -source = "vcs" - -[tool.hatch.build.hooks.vcs] -version-file = "src/_black_version.py" -template = ''' -version = "{version}" -''' - -[tool.hatch.build.targets.sdist] -exclude = ["/profiling"] - -[tool.hatch.build.targets.wheel] -only-include = ["src"] -sources = ["src"] -# Note that we change the behaviour of this flag below -macos-max-compat = true - -[tool.hatch.build.targets.wheel.hooks.mypyc] -enable-by-default = false -dependencies = [ - "hatch-mypyc>=0.16.0", - "mypy==1.7.1", - "click==8.1.3", # avoid https://github.com/pallets/click/issues/2558 -] -require-runtime-dependencies = true -exclude = [ - # There's no good reason for blackd to be compiled. - "/src/blackd", - # Not performance sensitive, so save bytes + compilation time: - "/src/blib2to3/__init__.py", - "/src/blib2to3/pgen2/__init__.py", - "/src/black/output.py", - "/src/black/concurrency.py", - "/src/black/files.py", - "/src/black/report.py", - # Breaks the test suite when compiled (and is also useless): - "/src/black/debug.py", - # Compiled modules can't be run directly and that's a problem here: - "/src/black/__main__.py", -] -mypy-args = ["--ignore-missing-imports"] -options = { debug_level = "0" } - -[tool.cibuildwheel] -build-verbosity = 1 -# So these are the environments we target: -# - Python: CPython 3.8+ only -# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64 -# - OS: Linux (no musl), Windows, and macOS -build = "cp3*" -skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp*"] -# This is the bare minimum needed to run the test suite. Pulling in the full -# test_requirements.txt would download a bunch of other packages not necessary -# here and would slow down the testing step a fair bit. -test-requires = ["pytest>=6.1.1"] -test-command = 'pytest {project} -k "not incompatible_with_mypyc"' -test-extras = ["d"," jupyter"] -# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't -# straight up crash) -test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"] - -[tool.cibuildwheel.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -# CPython 3.11 wheels aren't available for aiohttp and building a Cython extension -# from source also doesn't work. -AIOHTTP_NO_EXTENSIONS = "1" - -[tool.cibuildwheel.linux] -before-build = [ - "yum install -y clang gcc", -] - -[tool.cibuildwheel.linux.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -AIOHTTP_NO_EXTENSIONS = "1" - -# Black needs Clang to compile successfully on Linux. -CC = "clang" - -[tool.cibuildwheel.macos] -build-frontend = { name = "build", args = ["--no-isolation"] } -# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET -before-build = [ - "python -m pip install 'hatchling==1.20.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'", - """sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """, -] - -[tool.isort] -atomic = true -profile = "black" -line_length = 88 -skip_gitignore = true -skip_glob = ["tests/data", "profiling"] -known_first_party = ["black", "blib2to3", "blackd", "_black_version"] - -[tool.pytest.ini_options] -# Option below requires `tests/optional.py` -addopts = "--strict-config --strict-markers" -optional-tests = [ - "no_blackd: run when `d` extra NOT installed", - "no_jupyter: run when `jupyter` extra NOT installed", -] -markers = [ - "incompatible_with_mypyc: run when testing mypyc compiled black" -] -xfail_strict = true -filterwarnings = [ - "error", - # this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/ - # this ignore can be removed when support for aiohttp 3.7 is dropped. - '''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''', - # this is mitigated by a try/catch in https://github.com/psf/black/pull/3198/ - # this ignore can be removed when support for aiohttp 3.x is dropped. - '''ignore:Middleware decorator is deprecated since 4\.0 and its behaviour is default, you can simply remove this decorator:DeprecationWarning''', - # aiohttp is using deprecated cgi modules - Safe to remove when fixed: - # https://github.com/aio-libs/aiohttp/issues/6905 - '''ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning''', - # Work around https://github.com/pytest-dev/pytest/issues/10977 for Python 3.12 - '''ignore:(Attribute s|Attribute n|ast.Str|ast.Bytes|ast.NameConstant|ast.Num) is deprecated and will be removed in Python 3.14:DeprecationWarning''', - # Will be fixed with aiohttp 3.9.0 - # https://github.com/aio-libs/aiohttp/pull/7302 - "ignore:datetime.*utcfromtimestamp\\(\\) is deprecated and scheduled for removal:DeprecationWarning", -] -[tool.coverage.report] -omit = [ - "src/blib2to3/*", - "tests/data/*", - "*/site-packages/*", - ".tox/*" -] -[tool.coverage.run] -relative_files = true -branch = true - -[tool.mypy] -# Specify the target platform details in config, so your developers are -# free to run mypy on Windows, Linux, or macOS and get consistent -# results. -python_version = "3.8" -mypy_path = "src" -strict = true -# Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place. -warn_unreachable = true -implicit_reexport = true -show_error_codes = true -show_column_numbers = true - -[[tool.mypy.overrides]] -module = ["pathspec.*", "IPython.*", "colorama.*", "tokenize_rt.*", "uvloop.*", "_black_version.*"] -ignore_missing_imports = true - -# CI only checks src/, but in case users are running LSP or similar we explicitly ignore -# errors in test data files. -[[tool.mypy.overrides]] -module = ["tests.data.*"] -ignore_errors = true diff --git a/tests/test_data/black/pyproject24.4.2.toml b/tests/test_data/black/pyproject24.4.2.toml deleted file mode 100644 index 143c484..0000000 --- a/tests/test_data/black/pyproject24.4.2.toml +++ /dev/null @@ -1,266 +0,0 @@ -# Example configuration for Black. - -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. - -[tool.black] -line-length = 88 -target-version = ['py38'] -include = '\.pyi?$' -extend-exclude = ''' -/( - # The following are specific to Black, you probably don't want those. - tests/data - | profiling -)/ -''' -# We use the unstable style for formatting Black itself. If you -# want bug-free formatting, you should keep this off. If you want -# stable formatting across releases, you should also keep `preview = true` -# (which is implied by this flag) off. -unstable = true - -# Build system information and other project-specific configuration below. -# NOTE: You don't need this in your own Black configuration. - -[build-system] -requires = ["hatchling>=1.20.0", "hatch-vcs", "hatch-fancy-pypi-readme"] -build-backend = "hatchling.build" - -[project] -name = "black" -description = "The uncompromising code formatter." -license = { text = "MIT" } -requires-python = ">=3.8" -authors = [ - { name = "Łukasz Langa", email = "lukasz@langa.pl" }, -] -keywords = [ - "automation", - "autopep8", - "formatter", - "gofmt", - "pyfmt", - "rustfmt", - "yapf", -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "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", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", -] -dependencies = [ - "click>=8.0.0", - "mypy_extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < '3.11'", - "typing_extensions>=4.0.1; python_version < '3.11'", -] -dynamic = ["readme", "version"] - -[project.optional-dependencies] -colorama = ["colorama>=0.4.3"] -uvloop = ["uvloop>=0.15.2"] -d = [ - "aiohttp>=3.7.4; sys_platform != 'win32' or implementation_name != 'pypy'", - "aiohttp>=3.7.4, !=3.9.0; sys_platform == 'win32' and implementation_name == 'pypy'", -] -jupyter = [ - "ipython>=7.8.0", - "tokenize-rt>=3.2.0", -] - -[project.scripts] -black = "black:patched_main" -blackd = "blackd:patched_main [d]" - -[project.entry-points."validate_pyproject.tool_schema"] -black = "black.schema:get_schema" - -[project.urls] -Changelog = "https://github.com/psf/black/blob/main/CHANGES.md" -Homepage = "https://github.com/psf/black" - -[tool.hatch.metadata.hooks.fancy-pypi-readme] -content-type = "text/markdown" -fragments = [ - { path = "README.md" }, - { path = "CHANGES.md" }, -] - -[tool.hatch.version] -source = "vcs" - -[tool.hatch.build.hooks.vcs] -version-file = "src/_black_version.py" -template = ''' -version = "{version}" -''' - -[tool.hatch.build.targets.sdist] -exclude = ["/profiling"] - -[tool.hatch.build.targets.wheel] -only-include = ["src"] -sources = ["src"] -# Note that we change the behaviour of this flag below -macos-max-compat = true - -[tool.hatch.build.targets.wheel.hooks.mypyc] -enable-by-default = false -dependencies = [ - "hatch-mypyc>=0.16.0", - "mypy==1.7.1", - "click==8.1.3", # avoid https://github.com/pallets/click/issues/2558 -] -require-runtime-dependencies = true -exclude = [ - # There's no good reason for blackd to be compiled. - "/src/blackd", - # Not performance sensitive, so save bytes + compilation time: - "/src/blib2to3/__init__.py", - "/src/blib2to3/pgen2/__init__.py", - "/src/black/output.py", - "/src/black/concurrency.py", - "/src/black/files.py", - "/src/black/report.py", - # Breaks the test suite when compiled (and is also useless): - "/src/black/debug.py", - # Compiled modules can't be run directly and that's a problem here: - "/src/black/__main__.py", -] -mypy-args = ["--ignore-missing-imports"] -options = { debug_level = "0" } - -[tool.cibuildwheel] -build-verbosity = 1 -# So these are the environments we target: -# - Python: CPython 3.8+ only -# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64 -# - OS: Linux (no musl), Windows, and macOS -build = "cp3*" -skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp*"] -# This is the bare minimum needed to run the test suite. Pulling in the full -# test_requirements.txt would download a bunch of other packages not necessary -# here and would slow down the testing step a fair bit. -test-requires = ["pytest>=6.1.1"] -test-command = 'pytest {project} -k "not incompatible_with_mypyc"' -test-extras = ["d"," jupyter"] -# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't -# straight up crash) -test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"] - -[tool.cibuildwheel.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -# CPython 3.11 wheels aren't available for aiohttp and building a Cython extension -# from source also doesn't work. -AIOHTTP_NO_EXTENSIONS = "1" - -[tool.cibuildwheel.linux] -before-build = [ - "yum install -y clang gcc", -] - -[tool.cibuildwheel.linux.environment] -HATCH_BUILD_HOOKS_ENABLE = "1" -MYPYC_OPT_LEVEL = "3" -MYPYC_DEBUG_LEVEL = "0" -AIOHTTP_NO_EXTENSIONS = "1" - -# Black needs Clang to compile successfully on Linux. -CC = "clang" - -[tool.cibuildwheel.macos] -build-frontend = { name = "build", args = ["--no-isolation"] } -# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET -before-build = [ - "python -m pip install 'hatchling==1.20.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'", - """sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """, -] - -[tool.isort] -atomic = true -profile = "black" -line_length = 88 -skip_gitignore = true -skip_glob = ["tests/data", "profiling"] -known_first_party = ["black", "blib2to3", "blackd", "_black_version"] - -[tool.pytest.ini_options] -# Option below requires `tests/optional.py` -addopts = "--strict-config --strict-markers" -optional-tests = [ - "no_blackd: run when `d` extra NOT installed", - "no_jupyter: run when `jupyter` extra NOT installed", -] -markers = [ - "incompatible_with_mypyc: run when testing mypyc compiled black" -] -xfail_strict = true -filterwarnings = [ - "error", - # this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/ - # this ignore can be removed when support for aiohttp 3.7 is dropped. - '''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''', - # this is mitigated by a try/catch in https://github.com/psf/black/pull/3198/ - # this ignore can be removed when support for aiohttp 3.x is dropped. - '''ignore:Middleware decorator is deprecated since 4\.0 and its behaviour is default, you can simply remove this decorator:DeprecationWarning''', - # aiohttp is using deprecated cgi modules - Safe to remove when fixed: - # https://github.com/aio-libs/aiohttp/issues/6905 - '''ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning''', - # Work around https://github.com/pytest-dev/pytest/issues/10977 for Python 3.12 - '''ignore:(Attribute s|Attribute n|ast.Str|ast.Bytes|ast.NameConstant|ast.Num) is deprecated and will be removed in Python 3.14:DeprecationWarning''', - # Will be fixed with aiohttp 3.9.0 - # https://github.com/aio-libs/aiohttp/pull/7302 - "ignore:datetime.*utcfromtimestamp\\(\\) is deprecated and scheduled for removal:DeprecationWarning", -] -[tool.coverage.report] -omit = [ - "src/blib2to3/*", - "tests/data/*", - "*/site-packages/*", - ".tox/*" -] -[tool.coverage.run] -relative_files = true -branch = true - -[tool.mypy] -# Specify the target platform details in config, so your developers are -# free to run mypy on Windows, Linux, or macOS and get consistent -# results. -python_version = "3.8" -mypy_path = "src" -strict = true -# Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place. -warn_unreachable = true -implicit_reexport = true -show_error_codes = true -show_column_numbers = true - -[[tool.mypy.overrides]] -module = ["pathspec.*", "IPython.*", "colorama.*", "tokenize_rt.*", "uvloop.*", "_black_version.*"] -ignore_missing_imports = true - -# CI only checks src/, but in case users are running LSP or similar we explicitly ignore -# errors in test data files. -[[tool.mypy.overrides]] -module = ["tests.data.*"] -ignore_errors = true diff --git a/tests/test_data/scikit-build-core/minimal/CMakeLists.txt b/tests/test_data/scikit-build-core/minimal/CMakeLists.txt deleted file mode 100644 index 9d75b33..0000000 --- a/tests/test_data/scikit-build-core/minimal/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) -project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX) - -set(PYBIND11_NEWPYTHON ON) -find_package(pybind11 CONFIG REQUIRED) - -pybind11_add_module(minimal minimal.cpp) - -install(TARGETS minimal LIBRARY DESTINATION .) diff --git a/tests/test_data/scikit-build-core/minimal/minimal.cpp b/tests/test_data/scikit-build-core/minimal/minimal.cpp deleted file mode 100644 index c4ed199..0000000 --- a/tests/test_data/scikit-build-core/minimal/minimal.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -namespace py = pybind11; - -float square(float x) { return x * x; } - -PYBIND11_MODULE(minimal, m) { m.def("square", &square); } diff --git a/tests/test_data/scikit-build-core/minimal/pyproject.toml b/tests/test_data/scikit-build-core/minimal/pyproject.toml deleted file mode 100644 index 76a2f36..0000000 --- a/tests/test_data/scikit-build-core/minimal/pyproject.toml +++ /dev/null @@ -1,7 +0,0 @@ -[build-system] -requires = ["scikit-build-core", "pybind11"] -build-backend = "scikit_build_core.build" - -[project] -name = "minimal" -version = "0.0.1" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/.pre-commit-config.yaml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/.pre-commit-config.yaml deleted file mode 100644 index 36b8313..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/.pre-commit-config.yaml +++ /dev/null @@ -1,26 +0,0 @@ -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 - hooks: - - id: check-added-large-files - - id: check-case-conflict - - id: check-merge-conflict - - id: check-symlinks - - id: check-yaml - - id: debug-statements - - id: end-of-file-fixer - - id: mixed-line-ending - - id: requirements-txt-fixer - - id: trailing-whitespace - -- repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.10" - hooks: - - id: ruff - args: [--fix, --show-fixes] - - id: ruff-format - -- repo: https://github.com/codespell-project/codespell - rev: "v2.3.0" - hooks: - - id: codespell diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/noxfile.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/noxfile.py deleted file mode 100644 index a7403e9..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/noxfile.py +++ /dev/null @@ -1,40 +0,0 @@ -import sys - -import nox - -nox.needs_version = ">=2024.4.15" -nox.options.default_venv_backend = "uv|virtualenv" - -hello_list = ["hello-pure", "hello-cpp", "hello-pybind11", "hello-cython"] -if not sys.platform.startswith("win"): - hello_list.extend(["hello-cmake-package", "pi-fortran"]) -long_hello_list = [ - *hello_list, - "pen2-cython", - "core-c-hello", - "core-pybind11-hello", - "hatchling-pybind11-hello", -] -if sys.version_info >= (3, 13): - hello_list.append("hello-free-threading") - - -@nox.session -@nox.parametrize("module", long_hello_list, ids=long_hello_list) -def dist(session: nox.Session, module: str) -> None: - session.cd(f"projects/{module}") - session.install("build") - - # Builds SDist and wheel - opt = ["--installer=uv"] if session.venv_backend == "uv" else [] - session.run("python", "-m", "build", *opt) - - -@nox.session -@nox.parametrize("module", hello_list, ids=hello_list) -def test(session: nox.Session, module: str) -> None: - session.cd(f"projects/{module}") - session.install("pytest", "pytest-cov") - - session.install(".") - session.run("pytest") diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/CMakeLists.txt deleted file mode 100644 index df278dc..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES C) - -find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) - -Python_add_library(skcdpure MODULE WITH_SOABI skcdpure.c) - -install(TARGETS skcdpure DESTINATION .) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/pyproject.toml deleted file mode 100644 index 6d05ac6..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/pyproject.toml +++ /dev/null @@ -1,8 +0,0 @@ -[build-system] -requires = ["scikit-build-core[rich,pyproject]"] -build-backend = "scikit_build_core.build" - -[project] -name = "skcdpure" -version = "0.1.0" -requires-python = ">=3.9" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/skcdpure.c b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/skcdpure.c deleted file mode 100644 index 18541cd..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-c-hello/skcdpure.c +++ /dev/null @@ -1,27 +0,0 @@ -#define PY_SSIZE_T_CLEAN -#include - -static PyObject *hello_function(PyObject *self, PyObject *args) { - PyObject* builtins = PyImport_ImportModule("builtins"); - PyObject* print = PyObject_GetAttrString(builtins, "print"); - PyObject* msg = PyUnicode_FromString("Hello, scikit-build-core CAPI fans!"); - PyObject* none = PyObject_CallOneArg(print, msg); - - Py_XDECREF(print); - Py_XDECREF(builtins); - Py_XDECREF(msg); - Py_XDECREF(none); - - Py_RETURN_NONE; -} - -static PyMethodDef skcdpure_methods[] = { - {"hello", hello_function, METH_NOARGS, "Hello function"}, - {NULL, NULL, 0, NULL}}; - -static struct PyModuleDef skcdpure_module = {PyModuleDef_HEAD_INIT, "skcdpure", - NULL, -1, skcdpure_methods}; - -PyMODINIT_FUNC PyInit_skcdpure(void) { - return PyModule_Create(&skcdpure_module); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/CMakeLists.txt deleted file mode 100644 index aa7a3da..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES CXX) - -find_package(pybind11 CONFIG REQUIRED) - -pybind11_add_module(skcdemo MODULE skcdemo.cpp) - -install(TARGETS skcdemo DESTINATION .) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/pyproject.toml deleted file mode 100644 index e4bb7e7..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/pyproject.toml +++ /dev/null @@ -1,7 +0,0 @@ -[build-system] -requires = ["scikit-build-core", "pybind11"] -build-backend = "scikit_build_core.build" - -[project] -name = "skcdemo" -version = "0.1.0" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/skcdemo.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/skcdemo.cpp deleted file mode 100644 index 0a19166..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/core-pybind11-hello/skcdemo.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -namespace py = pybind11; - -PYBIND11_MODULE(skcdemo, m) { - m.def("hello", [](){ - py::print("Hello, scikit-build!"); - }); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/CMakeLists.txt deleted file mode 100644 index 2bca40f..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.29) - -project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES CXX) - -set(PYBIND11_FINDPYTHON ON) -find_package(pybind11 CONFIG REQUIRED) - -pybind11_add_module(_core MODULE cpp/_core.cpp) - -install(TARGETS _core DESTINATION skcdemo) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/cpp/_core.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/cpp/_core.cpp deleted file mode 100644 index 24700c2..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/cpp/_core.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -namespace py = pybind11; - -PYBIND11_MODULE(_core, m) { - m.def("hello", [](){ - py::print("Hello, scikit-build!"); - }); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/pyproject.toml deleted file mode 100644 index 6ab794e..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/pyproject.toml +++ /dev/null @@ -1,10 +0,0 @@ -[build-system] -requires = ["hatchling", "scikit-build-core~=0.9.0", "pybind11"] -build-backend = "hatchling.build" - -[project] -name = "skcdemo" -version = "0.1.0" - -[tool.hatch.build.targets.wheel.hooks.scikit-build] -experimental = true diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/src/skcdemo/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/src/skcdemo/__init__.py deleted file mode 100644 index 2f11250..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hatchling-pybind11-hello/src/skcdemo/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from ._core import hello - -__all__ = ["hello"] diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/CMakeLists.txt deleted file mode 100644 index ed4a47f..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/CMakeLists.txt +++ /dev/null @@ -1,106 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project( - hello - VERSION "0.1.0" - LANGUAGES CXX) - -include(GNUInstallDirs) - -# define the C++ library "hello" -add_library(hello SHARED "${PROJECT_SOURCE_DIR}/src/hello.cpp") - -target_include_directories( - hello PUBLIC $ - $) - -install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -# Standard installation subdirs for the C++ library are used. The files will end -# up in the specified subdirectories under the Python package root. For example, -# "/hello/lib/" if the destination is "lib/". -# -# Installing the objects in the package provides encapsulation and will become -# important later for binary redistribution reasons. -install( - TARGETS hello - EXPORT helloTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -# The CMake package config and target files are installed under the Python -# package root. This is necessary to ensure that all the relative paths in the -# helloTargets.cmake resolve correctly. It also provides encapsulation. -# -# The actual path used must be selected so that consuming projects can locate it -# via `find_package`. To support finding CMake packages in the Python package -# prefix, using `find_package`s default search path of -# `//share/*/cmake/` is reasonable. Adding the Python -# package installation prefix to CMAKE_PREFIX_PATH in combination with this path -# will allow `find_package` to find this package and any other package installed -# via a Python package if the CMake and Python packages are named the same. -set(HELLO_CMAKE_PACKAGE_INSTALL_SUBDIR "share/hello/cmake") - -install( - EXPORT helloTargets - NAMESPACE hello:: - DESTINATION ${HELLO_CMAKE_PACKAGE_INSTALL_SUBDIR}) - -include(CMakePackageConfigHelpers) - -write_basic_package_version_file( - helloConfigVersion.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMinorVersion) - -configure_package_config_file( - "${PROJECT_SOURCE_DIR}/cmake/helloConfig.cmake.in" helloConfig.cmake - INSTALL_DESTINATION ${HELLO_CMAKE_PACKAGE_INSTALL_SUBDIR}) - -install(FILES "${PROJECT_BINARY_DIR}/helloConfig.cmake" - "${PROJECT_BINARY_DIR}/helloConfigVersion.cmake" - DESTINATION ${HELLO_CMAKE_PACKAGE_INSTALL_SUBDIR}) - -# We are using the SKBUILD variable, which is defined when scikit-build is -# running the CMake build, to control building the Python wrapper. This allows -# the C++ project to be installed, standalone, when using the standard CMake -# build flow. -if(DEFINED SKBUILD) - - # call pybind11-config to obtain the root of the cmake package - execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pybind11 --cmakedir - OUTPUT_VARIABLE pybind11_ROOT_RAW) - string(STRIP ${pybind11_ROOT_RAW} pybind11_ROOT) - find_package(pybind11) - - pybind11_add_module(_hello MODULE - "${PROJECT_SOURCE_DIR}/src/hello/hello_py.cpp") - - target_link_libraries(_hello PRIVATE hello) - - # Installing the extension module to the root of the package - install(TARGETS _hello DESTINATION .) - - configure_file("${PROJECT_SOURCE_DIR}/src/hello/__main__.py.in" - "${PROJECT_BINARY_DIR}/src/hello/__main__.py") - - install(FILES "${PROJECT_BINARY_DIR}/src/hello/__main__.py" DESTINATION .) - - # The extension module must load the hello library as a dependency when the - # extension module is loaded. The easiest way to locate the hello library is - # via RPATH. Absolute RPATHs are possible, but they make the resulting - # binaries not redistributable to other Python installations (conda is broke, - # wheel reuse is broke, and more!). - # - # Placing the hello library in the package and using relative RPATHs that - # doesn't point outside of the package means that the built package is - # relocatable. This allows for safe binary redistribution. - if(APPLE) - set_target_properties( - _hello PROPERTIES INSTALL_RPATH "@loader_path/${CMAKE_INSTALL_LIBDIR}") - else() - set_target_properties(_hello PROPERTIES INSTALL_RPATH - "$ORIGIN/${CMAKE_INSTALL_LIBDIR}") - endif() - -endif() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/README.md b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/README.md deleted file mode 100644 index 6fef2d3..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Hello - -This is an example project demonstrating the use of scikit-build for distributing a standalone C library, *hello*; -a CMake package for that library; and a Python wrapper implemented in pybind11. - -The example assume some familiarity with CMake and pybind11, only really going into detail on the scikit-build parts. -pybind11 is used to implement the binding, but anything is possible: swig, C API library, etc. - -To install the package run in the project directory - -```bash -pip install . -``` - -To run the Python tests, first install the package then in the project directory run - -```bash -pytest -``` - -To run the C++ test, first install the package, then configure and build the project - -```bash -cmake -S test/cpp -B build/ -Dhello_ROOT=$(python -m hello --cmakefiles) -cmake --build build/ -``` - -Then run ctest in the build dir - -```bash -cd build/ -ctest -``` diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/cmake/helloConfig.cmake.in b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/cmake/helloConfig.cmake.in deleted file mode 100644 index 7b21d03..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/cmake/helloConfig.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -@PACKAGE_INIT@ - -include("${CMAKE_CURRENT_LIST_DIR}/helloTargets.cmake") diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/include/hello.hpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/include/hello.hpp deleted file mode 100644 index bb96d65..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/include/hello.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef HELLO_HPP -#define HELLO_HPP - -#include - -namespace hello { - -void hello(); - -int return_two(); - -} // namespace hello - -#endif diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/pyproject.toml deleted file mode 100644 index 61f2876..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/pyproject.toml +++ /dev/null @@ -1,9 +0,0 @@ -[build-system] -requires = [ - "setuptools>=42", - "scikit-build", - "cmake>=3.14", - "ninja", - "pybind11>=2.6" -] -build-backend = "setuptools.build_meta" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/setup.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/setup.py deleted file mode 100644 index 9f162c8..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/setup.py +++ /dev/null @@ -1,14 +0,0 @@ -from skbuild import setup - -setup( - name="hello-cmake-package", - version="0.1.0", - packages=["hello"], - package_dir={"": "src"}, - cmake_install_dir="src/hello", -) - -# When building extension modules `cmake_install_dir` should always be set to the -# location of the package you are building extension modules for. -# Specifying the installation directory in the CMakeLists subtley breaks the relative -# paths in the helloTargets.cmake file to all of the library components. diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello.cpp deleted file mode 100644 index c4f7462..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "hello.hpp" - -namespace hello { - -void hello() { std::cout << "Hello, World!" << std::endl; } - -int return_two() { return 2; } - -} // namespace hello diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__init__.py deleted file mode 100644 index 9218bdc..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from ._hello import hello, return_two - -__all__ = ("hello", "return_two") diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__main__.py.in b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__main__.py.in deleted file mode 100644 index 85ab513..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/__main__.py.in +++ /dev/null @@ -1,30 +0,0 @@ -import argparse -import sys -from typing import List, Any -from pathlib import Path -import hello - - -def main(argv: List[Any]) -> int: - - parser = argparse.ArgumentParser() - parser.add_argument("--cmakefiles", action='store_true', help="Print hello project CMake module directory. Useful for setting hello_ROOT in CMake.") - parser.add_argument("--prefix", action='store_true', help="Print hello package installation prefix. Useful for setting CMAKE_PREFIX_PATH in CMake.") - - args = parser.parse_args(args=argv[1:]) - - if not argv[1:]: - parser.print_help() - return - - prefix = Path(hello.__file__).parent - - if args.cmakefiles: - print(prefix / "@HELLO_CMAKE_PACKAGE_INSTALL_SUBDIR@") - - if args.prefix: - print(prefix) - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/hello_py.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/hello_py.cpp deleted file mode 100644 index 8bfce75..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/src/hello/hello_py.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "hello.hpp" -#include - - -PYBIND11_MODULE(_hello, m) { - m.doc() = "Example module"; - m.def("hello", &hello::hello, "Prints \"Hello, World!\""); - m.def("return_two", &hello::return_two, "Returns 2"); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/CMakeLists.txt deleted file mode 100644 index 5837a40..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.14...3.19) - -project(hello-user VERSION 0.1.0) - -find_package(hello REQUIRED) - -add_executable(hello_user "${PROJECT_SOURCE_DIR}/test.cpp") -target_link_libraries(hello_user PRIVATE hello::hello) - -include(CTest) - -add_test(NAME hello_test COMMAND hello_user) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/test.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/test.cpp deleted file mode 100644 index 86af5ea..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/cpp/test.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "hello.hpp" - - -int main() -{ - hello::hello(); - return (hello::return_two() != 2); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/test_hello.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/test_hello.py deleted file mode 100644 index 16ebe9b..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cmake-package/tests/test_hello.py +++ /dev/null @@ -1,9 +0,0 @@ -import hello - - -def test_hello(): - hello.hello() - - -def test_return_two(): - assert hello.return_two() == 2 diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/CMakeLists.txt deleted file mode 100644 index 0885632..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project(hello) - -find_package(PythonExtensions REQUIRED) - -add_library(_hello MODULE hello/_hello.cxx) -python_extension_module(_hello) -install(TARGETS _hello LIBRARY DESTINATION hello) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/__init__.py deleted file mode 100644 index 9fe5195..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from ._hello import ( - elevation, # noqa: F401 - hello, # noqa: F401 -) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/_hello.cxx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/_hello.cxx deleted file mode 100644 index a3c570a..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/hello/_hello.cxx +++ /dev/null @@ -1,65 +0,0 @@ - -// Python includes -#include - -// STD includes -#include - -//----------------------------------------------------------------------------- -static PyObject *hello_example(PyObject *self, PyObject *args) -{ - // Unpack a string from the arguments - const char *strArg; - if (!PyArg_ParseTuple(args, "s", &strArg)) - return NULL; - - // Print message and return None - PySys_WriteStdout("Hello, %s!\n", strArg); - Py_RETURN_NONE; -} - -//----------------------------------------------------------------------------- -static PyObject *elevation_example(PyObject *self, PyObject *args) -{ - // Return an integer - return PyLong_FromLong(21463L); -} - -//----------------------------------------------------------------------------- -static PyMethodDef hello_methods[] = { - { - "hello", - hello_example, - METH_VARARGS, - "Prints back 'Hello ', for example example: hello.hello('you')" - }, - - { - "elevation", - elevation_example, - METH_VARARGS, - "Returns elevation of Nevado Sajama." - }, - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -//----------------------------------------------------------------------------- -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC init_hello(void) -{ - (void) Py_InitModule("_hello", hello_methods); -} -#else /* PY_MAJOR_VERSION >= 3 */ -static struct PyModuleDef hello_module_def = { - PyModuleDef_HEAD_INIT, - "_hello", - "Internal \"_hello\" module", - -1, - hello_methods -}; - -PyMODINIT_FUNC PyInit__hello(void) -{ - return PyModule_Create(&hello_module_def); -} -#endif /* PY_MAJOR_VERSION >= 3 */ diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/pyproject.toml deleted file mode 100644 index 6a895b8..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/pyproject.toml +++ /dev/null @@ -1,8 +0,0 @@ -[build-system] -requires = [ - "setuptools>=42", - "scikit-build>=0.13", - "cmake>=3.18", - "ninja", -] -build-backend = "setuptools.build_meta" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/setup.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/setup.py deleted file mode 100644 index aa5d2eb..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -from skbuild import setup - -setup( - name="hello-cpp", - version="1.2.3", - description="a minimal example package (cpp version)", - author="The scikit-build team", - license="MIT", - packages=["hello"], - python_requires=">=3.7", -) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/tests/test_hello_cpp.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/tests/test_hello_cpp.py deleted file mode 100644 index 8c0927f..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cpp/tests/test_hello_cpp.py +++ /dev/null @@ -1,11 +0,0 @@ -import hello - - -def test_hello(capfd): - hello.hello("World") - captured = capfd.readouterr() - assert captured.out == "Hello, World!\n" - - -def test_elevation(): - assert hello.elevation() == 21463 diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/CMakeLists.txt deleted file mode 100644 index abaf2ae..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project(hello_cython) - -find_package(PythonExtensions REQUIRED) -find_package(Cython REQUIRED) - -add_subdirectory(hello) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/CMakeLists.txt deleted file mode 100644 index 261b2dd..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ - - -add_cython_target(_hello CXX) -add_library(_hello MODULE ${_hello}) -python_extension_module(_hello) - -install(TARGETS _hello LIBRARY DESTINATION hello) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/__init__.py deleted file mode 100644 index c6909c7..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from ._hello import elevation, hello - -__all__ = ("hello", "elevation") diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/_hello.pyx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/_hello.pyx deleted file mode 100644 index 22a41fa..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/hello/_hello.pyx +++ /dev/null @@ -1,8 +0,0 @@ - -cpdef void hello(str strArg): - "Prints back 'Hello ', for example example: hello.hello('you')" - print("Hello, {}!".format(strArg)) - -cpdef long elevation(): - "Returns elevation of Nevado Sajama." - return 21463L diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/pyproject.toml deleted file mode 100644 index 94e9c96..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/pyproject.toml +++ /dev/null @@ -1,9 +0,0 @@ -[build-system] -requires = [ - "setuptools>=42", - "scikit-build>=0.13", - "cmake>=3.18", - "ninja", - "cython", -] -build-backend = "setuptools.build_meta" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/setup.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/setup.py deleted file mode 100644 index 4357458..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -from skbuild import setup - -setup( - name="hello-cython", - version="1.2.3", - description="a minimal example package (cython version)", - author="The scikit-build team", - license="MIT", - packages=["hello"], - python_requires=">=3.7", -) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/tests/test_hello_cython.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/tests/test_hello_cython.py deleted file mode 100644 index 8c0927f..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-cython/tests/test_hello_cython.py +++ /dev/null @@ -1,11 +0,0 @@ -import hello - - -def test_hello(capfd): - hello.hello("World") - captured = capfd.readouterr() - assert captured.out == "Hello, World!\n" - - -def test_elevation(): - assert hello.elevation() == 21463 diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/CMakeLists.txt deleted file mode 100644 index a55a252..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.29) - -project(FreeComputePi LANGUAGES CXX) - -set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use") -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -find_package( - Python - COMPONENTS Interpreter Development.Module - REQUIRED) - -python_add_library(_core MODULE src/freecomputepi/_core.cpp WITH_SOABI) - -find_package(pybind11 REQUIRED) -pybind11_add_module(_pybcore MODULE src/freecomputepi/_pybcore.cpp) - -install(TARGETS _core _pybcore DESTINATION freecomputepi) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/pyproject.toml deleted file mode 100644 index b3ecbf0..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/pyproject.toml +++ /dev/null @@ -1,14 +0,0 @@ -[build-system] -requires = ["scikit-build-core >=0.9.5", "pybind11 >=2.13.1"] -build-backend = "scikit_build_core.build" - -[project] -name = "freecomputepi" -version = "0.0.1" - -[tool.cibuildwheel] -build-frontend = "build[uv]" -build = "cp313*" -free-threaded-support = true -test-command = "pytest {package} --durations=0" -test-requires = ["pytest"] diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_core.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_core.cpp deleted file mode 100644 index dc98c66..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_core.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#define PY_SSIZE_T_CLEAN -#include - -#include - - -static PyObject * pi(PyObject *self, PyObject *arg) { - int n = PyLong_AsLong(arg); - if (n == -1 && PyErr_Occurred()) { - return NULL; - } - double sum = 0.0; - - std::random_device r; - std::default_random_engine e1(r()); - std::uniform_real_distribution uniform_dist(-1, 1); - - for (int i = 0; i < n; i++) { - double x = uniform_dist(e1); - double y = uniform_dist(e1); - if (x * x + y * y <= 1.0) { - sum += 1.0; - } - } - - return Py_BuildValue("d", 4.0 * sum / n); -} - -extern "C" { - -static PyMethodDef core_methods[] = { - {"pi", pi, METH_O, "Compute pi"}, - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -static int _core_exec(PyObject *m) { - if (PyModule_AddFunctions(m, core_methods) < 0) - return -1; - return 0; -} - -static PyModuleDef_Slot module_slots[] = { - {Py_mod_exec, (void*) _core_exec}, - {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, - #ifdef Py_GIL_DISABLED - {Py_mod_gil, Py_MOD_GIL_NOT_USED}, - #endif - {0, NULL}, -}; - -static struct PyModuleDef coremodule = { - PyModuleDef_HEAD_INIT, - "_core", - NULL, - 0, - core_methods, - module_slots, - NULL, - NULL, - NULL, -}; - - -PyMODINIT_FUNC PyInit__core(void) { - return PyModuleDef_Init(&coremodule); -} - -}; diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_pybcore.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_pybcore.cpp deleted file mode 100644 index 765d2f6..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/_pybcore.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -namespace py = pybind11; - -double pi(int n) { - double sum = 0.0; - - std::random_device r; - std::default_random_engine e1(r()); - std::uniform_real_distribution uniform_dist(-1, 1); - - for (int i = 0; i < n; i++) { - double x = uniform_dist(e1); - double y = uniform_dist(e1); - if (x * x + y * y <= 1.0) { - sum += 1.0; - } - } - return 4.0 * sum / n; -} - -PYBIND11_MODULE(_pybcore, m, py::mod_gil_not_used()) { - m.def("pi", &pi); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/comp.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/comp.py deleted file mode 100644 index 0a1181d..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/comp.py +++ /dev/null @@ -1,30 +0,0 @@ -import argparse -import statistics -import time -from concurrent.futures import ThreadPoolExecutor - -from ._core import pi - - -def pi_in_threads(threads: int, trials: int) -> float: - if threads == 0: - return pi(trials) - with ThreadPoolExecutor(max_workers=threads) as executor: - return statistics.mean(executor.map(pi, [trials // threads] * threads)) - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("--threads", type=int, default=0) - parser.add_argument("--trials", type=int, default=100_000_000) - args = parser.parse_args() - - start = time.monotonic() - π = pi_in_threads(args.threads, args.trials) - stop = time.monotonic() - - print(f"{args.trials} trials, {π = }, {stop - start:.4} s") - - -if __name__ == "__main__": - main() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pure.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pure.py deleted file mode 100644 index b509cda..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pure.py +++ /dev/null @@ -1,44 +0,0 @@ -import argparse -import random -import statistics -import time -from concurrent.futures import ThreadPoolExecutor - - -def pi(trials: int) -> float: - Ncirc = 0 - ran = random.Random() - - for _ in range(trials): - x = ran.uniform(-1, 1) - y = ran.uniform(-1, 1) - - test = x * x + y * y - if test <= 1: - Ncirc += 1 - - return 4.0 * (Ncirc / trials) - - -def pi_in_threads(threads: int, trials: int) -> float: - if threads == 0: - return pi(trials) - with ThreadPoolExecutor(max_workers=threads) as executor: - return statistics.mean(executor.map(pi, [trials // threads] * threads)) - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("--threads", type=int, default=0) - parser.add_argument("--trials", type=int, default=10_000_000) - args = parser.parse_args() - - start = time.monotonic() - π = pi_in_threads(args.threads, args.trials) - stop = time.monotonic() - - print(f"{args.trials} trials, {π = }, {stop - start:.4} s") - - -if __name__ == "__main__": - main() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pybind.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pybind.py deleted file mode 100644 index 141b852..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/src/freecomputepi/pybind.py +++ /dev/null @@ -1,30 +0,0 @@ -import argparse -import statistics -import time -from concurrent.futures import ThreadPoolExecutor - -from ._pybcore import pi - - -def pi_in_threads(threads: int, trials: int) -> float: - if threads == 0: - return pi(trials) - with ThreadPoolExecutor(max_workers=threads) as executor: - return statistics.mean(executor.map(pi, [trials // threads] * threads)) - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("--threads", type=int, default=0) - parser.add_argument("--trials", type=int, default=100_000_000) - args = parser.parse_args() - - start = time.monotonic() - π = pi_in_threads(args.threads, args.trials) - stop = time.monotonic() - - print(f"{args.trials} trials, {π = }, {stop - start:.4} s") - - -if __name__ == "__main__": - main() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/tests/test_thread.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/tests/test_thread.py deleted file mode 100644 index 996aada..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-free-threading/tests/test_thread.py +++ /dev/null @@ -1,22 +0,0 @@ -import freecomputepi.comp -import freecomputepi.pure -import freecomputepi.pybind -import pytest - - -@pytest.mark.parametrize("threads", [0, 1, 2, 4]) -def test_pure(threads): - π = freecomputepi.pure.pi_in_threads(threads, 10_000_000) - assert π == pytest.approx(3.1415926535, rel=0.01) - - -@pytest.mark.parametrize("threads", [0, 1, 2, 4]) -def test_comp(threads): - π = freecomputepi.comp.pi_in_threads(threads, 100_000_000) - assert π == pytest.approx(3.1415926535, rel=0.01) - - -@pytest.mark.parametrize("threads", [0, 1, 2, 4]) -def test_pybind(threads): - π = freecomputepi.pybind.pi_in_threads(threads, 100_000_000) - assert π == pytest.approx(3.1415926535, rel=0.01) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/hello/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/hello/__init__.py deleted file mode 100644 index c718e4b..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/hello/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -def hello(txt): - print(f"Hello, {txt}!") - - -def elevation(): - """Returns elevation of Nevado Sajama.""" - return 21463 diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/pyproject.toml deleted file mode 100644 index 6a895b8..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/pyproject.toml +++ /dev/null @@ -1,8 +0,0 @@ -[build-system] -requires = [ - "setuptools>=42", - "scikit-build>=0.13", - "cmake>=3.18", - "ninja", -] -build-backend = "setuptools.build_meta" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/setup.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/setup.py deleted file mode 100644 index d9940b7..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -from skbuild import setup - -setup( - name="hello-pure", - version="1.2.3", - description="a minimal example package (pure python version)", - author="The scikit-build team", - license="MIT", - packages=["hello"], - python_requires=">=3.7", -) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/test_hello_pure.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/test_hello_pure.py deleted file mode 100644 index 8c0927f..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pure/test_hello_pure.py +++ /dev/null @@ -1,11 +0,0 @@ -import hello - - -def test_hello(capfd): - hello.hello("World") - captured = capfd.readouterr() - assert captured.out == "Hello, World!\n" - - -def test_elevation(): - assert hello.elevation() == 21463 diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/CMakeLists.txt deleted file mode 100644 index bdf8675..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project(hello-pybind11 VERSION "0.1") - -# Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR -include(GNUInstallDirs) -include(FetchContent) - -FetchContent_Declare( - pybind11 - URL https://github.com/pybind/pybind11/archive/refs/tags/v2.10.4.tar.gz - URL_HASH SHA256=832e2f309c57da9c1e6d4542dedd34b24e4192ecb4d62f6f4866a737454c9970 -) -FetchContent_MakeAvailable(pybind11) - -set(python_module_name _hello) -pybind11_add_module(${python_module_name} MODULE - src/hello/hello_py.cpp -) - -install(TARGETS ${python_module_name} DESTINATION .) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/README.md b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/README.md deleted file mode 100644 index 92e0e01..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# PyBind11 + Scikit Build example - - -## Building - -To build, you must have pip 10 or greater, *or* you need to manually install -`scikit-build` and `cmake`. Once you create a wheel, that wheel can be used in -earlier versions of pip. - -Example build and install sequence: - -```bash -pip install . -python -c "import hello; hello.hello()" -``` - -This should print "Hello, World!". - -## Testing - -Testing is managed by tox. This will build the package in a temp directory and runs the tests in the test dir. - -```shell -tox -``` diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/pyproject.toml deleted file mode 100644 index 76b5984..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/pyproject.toml +++ /dev/null @@ -1,11 +0,0 @@ -[build-system] -requires = [ - "setuptools", - "scikit-build>=0.13", - "cmake", - "ninja", -] -build-backend = "setuptools.build_meta" - -[tool.pytest.ini_options] -testpaths = ["tests"] diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/setup.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/setup.py deleted file mode 100644 index 9d2bf4d..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from skbuild import setup - -setup( - name="hello-pybind11", - version="1.2.3", - description="a minimal example package (with pybind11)", - author="Pablo Hernandez-Cerdan", - license="MIT", - packages=["hello"], - package_dir={"": "src"}, - cmake_install_dir="src/hello", - python_requires=">=3.7", -) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/__init__.py deleted file mode 100644 index 9218bdc..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from ._hello import hello, return_two - -__all__ = ("hello", "return_two") diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/hello_py.cpp b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/hello_py.cpp deleted file mode 100644 index 75253c5..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/src/hello/hello_py.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -namespace py = pybind11; - -void hello() { - std::cout << "Hello, World!" << std::endl; -} - -int return_two() { - return 2; -} - -PYBIND11_MODULE(_hello, m) { - m.doc() = "_hello"; - m.def("hello", &hello, "Prints \"Hello, World!\""); - m.def("return_two", &return_two, "Returns 2"); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tests/test_hello_pybind11.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tests/test_hello_pybind11.py deleted file mode 100644 index f426360..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tests/test_hello_pybind11.py +++ /dev/null @@ -1,19 +0,0 @@ -# This kind of import is automatically done when importing hello from outside -import unittest - -import hello - - -class TestHello(unittest.TestCase): - def test_hello(self): - hello.hello() - - def test_return_two(self): - self.assertEqual(hello.return_two(), 2) - - -if __name__ == "__main__": - unittest.main() - # You can run all python test with: - # ctest -R python -V - # from the build folder diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tox.ini b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tox.ini deleted file mode 100644 index 311cae8..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/hello-pybind11/tox.ini +++ /dev/null @@ -1,2 +0,0 @@ -[testenv] -commands = python -m unittest discover -s tests/ diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/CMakeLists.txt deleted file mode 100644 index bdf44bd..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project(pen2_cython) - -enable_testing() - -find_package(PythonExtensions REQUIRED) -find_package(Cython REQUIRED) - -add_subdirectory(src) -add_subdirectory(scripts) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/pyproject.toml deleted file mode 100644 index 94e9c96..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/pyproject.toml +++ /dev/null @@ -1,9 +0,0 @@ -[build-system] -requires = [ - "setuptools>=42", - "scikit-build>=0.13", - "cmake>=3.18", - "ninja", - "cython", -] -build-backend = "setuptools.build_meta" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/requirements-dev.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/requirements-dev.txt deleted file mode 100644 index bcc19bc..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/requirements-dev.txt +++ /dev/null @@ -1,2 +0,0 @@ -cython -skbuild diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/CMakeLists.txt deleted file mode 100644 index 52eb79c..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ - -install(FILES pen2_cython DESTINATION scripts) -file(COPY pen2_cython DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - -add_test(NAME pen2_cython - COMMAND ${PYTHON_EXECUTABLE} - "${CMAKE_INSTALL_PREFIX}/scripts/pen2_cython" -d 2) -set_property(TEST pen2_cython PROPERTY ENVIRONMENT - "PYTHONPATH=${CMAKE_SOURCE_DIR}/src${PYTHON_PATH_SEPARATOR}${CMAKE_BINARY_DIR}") diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/pen2_cython b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/pen2_cython deleted file mode 100755 index 6d7c864..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/scripts/pen2_cython +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env python - -from pen2_cython import main - -main() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/setup.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/setup.py deleted file mode 100644 index 3a42b8b..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from skbuild import setup - -setup( - name="pen2_cython", - version="0.0.1", - description="double pendulum simulation (cython version)", - author="The scikit-build team", - license="MIT", - packages=["pen2_cython"], - package_dir={"pen2_cython": "src"}, - scripts=["scripts/pen2_cython"], - python_requires=">=3.7", -) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/CMakeLists.txt deleted file mode 100644 index 1675732..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ - -# add_cython_target(_pen2) -add_cython_target(_pen2 OUTPUT_VAR X) -add_library(_pen2 MODULE ${X}) -python_extension_module(_pen2) - -install(TARGETS _pen2 LIBRARY DESTINATION src) -install(FILES __main__.py DESTINATION src) -install(FILES __init__.py DESTINATION src) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__init__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__init__.py deleted file mode 100644 index 28702c8..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__init__.py +++ /dev/null @@ -1,270 +0,0 @@ -from math import pi - -from _pen2 import Pen2Sim - -DEFAULT_M0 = 1.0 -DEFAULT_M1 = 1.2 -DEFAULT_L0 = 1.00 -DEFAULT_L1 = 0.75 -DEFAULT_ITH0 = 0.001 * int(1000 * pi) -DEFAULT_ITH1 = DEFAULT_ITH0 - 0.001 -DEFAULT_IW0 = 0.0 -DEFAULT_IW1 = 0.0 -# NOTE(opadron): Simulation seems to go in slow motion with the standard gravity -# constant, so just use a default at 10X strength. -DEFAULT_G = 98.1 -DEFAULT_DT = 0.001 * int(1000.0 / 60.0) -DEFAULT_DURATION = None - - -def main(): - from argparse import ArgumentParser - - parser = ArgumentParser(description="run a double pendulum simulation") - parser.add_argument( - "--mass0", - "-m0", - type=float, - default=DEFAULT_M0, - metavar="M0", - help="Mass of the first pendulum weight (kg).", - ) - parser.add_argument( - "--mass1", - "-m1", - type=float, - default=DEFAULT_M1, - metavar="M1", - help="Mass of the second pendulum weight (kg).", - ) - parser.add_argument( - "--length0", - "-L0", - type=float, - default=DEFAULT_L0, - metavar="L0", - help="Length of the first pendulum arm (m).", - ) - parser.add_argument( - "--length1", - "-L1", - type=float, - default=DEFAULT_L1, - metavar="L1", - help="Length of the second pendulum arm (m).", - ) - parser.add_argument( - "--theta0", - "-th0", - type=float, - default=DEFAULT_ITH0, - metavar="TH0", - help=( - "Initial angle of the first pendulum arm (radians). " - "Zero (0.0) is pointing straight down." - ), - ) - parser.add_argument( - "--theta1", - "-th1", - type=float, - default=DEFAULT_ITH1, - metavar="TH0", - help=( - "Initial angle of the second pendulum arm (radians). " - "Zero (0.0) is pointing parallel to the first arm." - ), - ) - parser.add_argument( - "--omega0", - "-w0", - type=float, - default=DEFAULT_IW0, - metavar="W0", - help="Initial anglular velocity of the first pendulum arm (radians/s).", - ) - parser.add_argument( - "--omega1", - "-w1", - type=float, - default=DEFAULT_IW1, - metavar="W1", - help=("Initial anglular velocity of the second pendulum arm (radians/s)."), - ) - parser.add_argument( - "--gravity", - "-g", - type=float, - default=DEFAULT_G, - metavar="G", - help=( - "Strength of the constant downward acceleration " - "felt by both pendulum weights due to gravity (m/s^2)." - ), - ) - parser.add_argument( - "--time_step", - "-dt", - type=float, - default=DEFAULT_DT, - metavar="DT", - help="Simulation time step size (s).", - ) - parser.add_argument( - "--duration", - "-d", - type=float, - default=DEFAULT_DURATION, - metavar="D", - help="Simulation duration (s).", - ) - - args = parser.parse_args() - run_simulation( - mass0=args.mass0, - mass1=args.mass1, - length0=args.length0, - length1=args.length1, - theta0=args.theta0, - theta1=args.theta1, - omega0=args.omega0, - omega1=args.omega1, - gravity=args.gravity, - time_step=args.time_step, - duration=args.duration, - ) - - -def run_simulation(**kwds): - from math import pi, sqrt - - from vtk import ( - vtkActor, - vtkCylinderSource, - vtkInteractorStyleTerrain, - vtkPolyDataMapper, - vtkRenderer, - vtkRenderWindow, - vtkRenderWindowInteractor, - vtkSphereSource, - vtkTransform, - ) - from vtk.util.colors import blue, brown, red - - M0 = kwds.get("mass0", DEFAULT_M0) - M1 = kwds.get("mass1", DEFAULT_M1) - L0 = kwds.get("length0", DEFAULT_L0) - L1 = kwds.get("length1", DEFAULT_L1) - iTH0 = kwds.get("theta0", DEFAULT_ITH0) - iTH1 = kwds.get("theta1", DEFAULT_ITH1) - iW0 = kwds.get("omega0", DEFAULT_IW0) - iW1 = kwds.get("omega1", DEFAULT_IW1) - G = kwds.get("gravity", DEFAULT_G) - dt = kwds.get("time_step", DEFAULT_DT) - duration = kwds.get("duration", DEFAULT_DURATION) - - sim = Pen2Sim(iTH0, iTH1, iW0, iW1, M0, M1, L0, L1, G, dt) - - sphere0 = vtkSphereSource() - sphere1 = vtkSphereSource() - - cylinder0 = vtkCylinderSource() - cylinder1 = vtkCylinderSource() - - sphere0.SetCenter(0.0, 0.0, 0.0) - sphere1.SetCenter(0.0, 0.0, 0.0) - - sphere0.SetRadius(0.25 * sqrt(M0 / pi)) - sphere1.SetRadius(0.25 * sqrt(M1 / pi)) - - cylinder0.SetRadius(0.04) - cylinder1.SetRadius(0.04) - - cTran0 = vtkTransform() - cTran1 = vtkTransform() - - sMap0 = vtkPolyDataMapper() - sMap1 = vtkPolyDataMapper() - - cMap0 = vtkPolyDataMapper() - cMap1 = vtkPolyDataMapper() - - sMap0.SetInputConnection(sphere0.GetOutputPort()) - sMap1.SetInputConnection(sphere1.GetOutputPort()) - - cMap0.SetInputConnection(cylinder0.GetOutputPort()) - cMap1.SetInputConnection(cylinder1.GetOutputPort()) - - sAct0 = vtkActor() - sAct1 = vtkActor() - sAct0.SetMapper(sMap0) - sAct1.SetMapper(sMap1) - sAct0.GetProperty().SetColor(red) - sAct1.GetProperty().SetColor(blue) - - cAct0 = vtkActor() - cAct1 = vtkActor() - cAct0.SetMapper(cMap0) - cAct1.SetMapper(cMap1) - cAct0.GetProperty().SetColor(brown) - cAct1.GetProperty().SetColor(brown) - - renderer = vtkRenderer() - renderWindow = vtkRenderWindow() - renderWindow.AddRenderer(renderer) - - interactor = vtkRenderWindowInteractor() - interactor.SetInteractorStyle(vtkInteractorStyleTerrain()) - interactor.SetRenderWindow(renderWindow) - - renderer.AddActor(sAct0) - renderer.AddActor(sAct1) - renderer.AddActor(cAct0) - renderer.AddActor(cAct1) - renderer.SetBackground(0.1, 0.2, 0.4) - renderer.GetActiveCamera().Dolly(0.125) - - renderWindow.SetSize(800, 600) - - renderWindow.Render() - interactor.Initialize() - - state = [None] - - def callback(*args, **kwds): - if state[0] is None: - state[0] = list(sim.initial_state()) - cylinder0.SetHeight(state[0][5]) - cylinder1.SetHeight(state[0][6]) - - else: - state[0][:] = sim.advance() - - x0, x1, y0, y1, t, L0, L1, th0, th1 = state[0][:9] - - cTran0.Identity() - cTran1.Identity() - - cTran1.Translate(x0, y0, 0.0) - - cTran0.RotateZ(180.0 * th0 / pi) - cTran1.RotateZ(180.0 * th1 / pi) - - cTran0.Translate(0.0, -0.5 * L0, 0.0) - cTran1.Translate(0.0, -0.5 * L1, 0.0) - - cAct0.SetUserTransform(cTran0) - cAct1.SetUserTransform(cTran1) - - sAct0.SetPosition(x0, y0, 0.0) - sAct1.SetPosition(x1, y1, 0.0) - renderWindow.Render() - - if duration is not None and t >= duration: - interactor.RemoveObserver(timerid) - interactor.ExitCallback() - - interactor.AddObserver("TimerEvent", callback) - timerid = interactor.CreateRepeatingTimer(int(1000 * dt)) - - interactor.Start() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__main__.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__main__.py deleted file mode 100644 index 6c9051f..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -if __name__ == "__main__": - from . import main - - main() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/_pen2.pyx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/_pen2.pyx deleted file mode 100644 index 997047b..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pen2-cython/src/_pen2.pyx +++ /dev/null @@ -1,172 +0,0 @@ - -#cython: boundscheck=False -#cython: cdivision=True -#cython: cdivision_warnings=True -#cython: profile=True - -from libc.math cimport sin, cos - -cdef class Pen2Sim: - cdef: - double th0, th1, w0, w1 - double M0, M1, L0, L1, G, dt, t - double th0_dot, th1_dot, w0_dot, w1_dot - - double U_th0, U_th1, U_w0, U_w1 - double k0_th0, k0_th1, k0_w0, k0_w1 - double k1_th0, k1_th1, k1_w0, k1_w1 - double k2_th0, k2_th1, k2_w0, k2_w1 - double k3_th0, k3_th1, k3_w0, k3_w1 - - double Ix0, Ix1, Iy0, Iy1, Ith0, Ith1 - - def __init__(self, double th0, double th1, - double w0, double w1, - double M0, double M1, - double L0, double L1, - double G, double dt): - self.th0 = th0 - self.th1 = th1 - self.w0 = w0 - self.w1 = w1 - self.M0 = M0 - self.M1 = M1 - self.L0 = L0 - self.L1 = L1 - self.G = G - self.dt = dt - self.t = 0.0 - - self.Ith0 = self.th0 - self.Ith1 = self.th1 - - self.Ix0 = self.L0*sin(self.Ith0) - self.Ix1 = self.Ix0 + self.L1*sin(self.Ith1) - - self.Iy0 = -self.L0*cos(self.Ith0) - self.Iy1 = self.Iy0 - self.L1*cos(self.Ith1) - - def initial_state(self): - return (self.Ix0, self.Ix1, self.Iy0, self.Iy1, 0.0, self.L0, self.L1, self.Ith0, self.Ith1) - - cdef void eval_rhs(self): - cdef: - double th0 = self.U_th0 - double th1 = self.U_th1 - double w0 = self.U_w0 - double w1 = self.U_w1 - double M0 = self.M0 - double M1 = self.M1 - double L0 = self.L0 - double L1 = self.L1 - double G = self.G - - self.th0_dot = w0 - self.th1_dot = w1 - - self.w0_dot = -( - 4.0*G *M0 *sin( th0 ) - + 3.0*G *M1 *sin( th0 ) - + G *M1 *sin( th0 - 2.0*th1) - + L0*M1*(w0**2)*sin(2.0*th0 - 2.0*th1) - + 4.0*L1*M1*(w1**2)*sin( th0 - th1) - )/( - 2.0*L0*(4.0*M0 - M1*cos(th0 - th1)**2 + 2.0*M1) - ) - - self.w1_dot = ( - -(2.0*M0 + M1)*( - G *sin( th1) - - L0*(w0**2)*sin(th0 - th1) - ) - - + cos(th0 - th1)*( - G *M0 *sin(th0 ) - + G *M1 *sin(th0 ) - + L1*M1*(w1**2)*sin(th0 - th1) - ) - )/( - L1*( - 4.0*M0 - - M1*cos(th0 - th1)**2 - + 2.0*M1 - ) - ) - - cdef simulate(self): - # classical runge-kutta - self.U_th0 = self.th0 - self.U_th1 = self.th1 - self.U_w0 = self.w0 - self.U_w1 = self.w1 - self.eval_rhs() - self.k0_th0 = self.th0_dot - self.k0_th1 = self.th1_dot - self.k0_w0 = self.w0_dot - self.k0_w1 = self.w1_dot - - self.U_th0 = self.th0 + 0.5*self.dt*self.k0_th0 - self.U_th1 = self.th1 + 0.5*self.dt*self.k0_th1 - self.U_w0 = self.w0 + 0.5*self.dt*self.k0_w0 - self.U_w1 = self.w1 + 0.5*self.dt*self.k0_w1 - self.eval_rhs() - self.k1_th0 = self.th0_dot - self.k1_th1 = self.th1_dot - self.k1_w0 = self.w0_dot - self.k1_w1 = self.w1_dot - - self.U_th0 = self.th0 + 0.5*self.dt*self.k1_th0 - self.U_th1 = self.th1 + 0.5*self.dt*self.k1_th1 - self.U_w0 = self.w0 + 0.5*self.dt*self.k1_w0 - self.U_w1 = self.w1 + 0.5*self.dt*self.k1_w1 - self.eval_rhs() - self.k2_th0 = self.th0_dot - self.k2_th1 = self.th1_dot - self.k2_w0 = self.w0_dot - self.k2_w1 = self.w1_dot - - self.U_th0 = self.th0 + self.dt*self.k2_th0 - self.U_th1 = self.th1 + self.dt*self.k2_th1 - self.U_w0 = self.w0 + self.dt*self.k2_w0 - self.U_w1 = self.w1 + self.dt*self.k2_w1 - self.eval_rhs() - self.k3_th0 = self.th0_dot - self.k3_th1 = self.th1_dot - self.k3_w0 = self.w0_dot - self.k3_w1 = self.w1_dot - - cdef double dth0, dth1, dw0, dw1 - dth0 = self.k0_th0 + 2.0*(self.k1_th0 + self.k2_th0) + self.k3_th0 - dth1 = self.k0_th1 + 2.0*(self.k1_th1 + self.k2_th1) + self.k3_th1 - dw0 = self.k0_w0 + 2.0*(self.k1_w0 + self.k2_w0 ) + self.k3_w0 - dw1 = self.k0_w1 + 2.0*(self.k1_w1 + self.k2_w1 ) + self.k3_w1 - - dth0 *= self.dt - dth1 *= self.dt - dw0 *= self.dt - dw1 *= self.dt - - dth0 /= 6.0 - dth1 /= 6.0 - dw0 /= 6.0 - dw1 /= 6.0 - - self.th0 += dth0 - self.th1 += dth1 - self.w0 += dw0 - self.w1 += dw1 - - self.t += self.dt - - cdef double x0, x1, y0, y1 - - x0 = self.L0*sin(self.th0) - x1 = x0 + self.L1*sin(self.th1) - - y0 = -self.L0*cos(self.th0) - y1 = y0 - self.L1*cos(self.th1) - - return (x0, x1, y0, y1, self.t, self.L0, self.L1, self.th0, self.th1) - - def advance(self): - return self.simulate() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/CMakeLists.txt deleted file mode 100644 index b04d74a..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -cmake_minimum_required(VERSION 3.17.2...3.26) - -project(pi - VERSION 1.0.1 - DESCRIPTION "pi estimator" - LANGUAGES C Fortran -) - -find_package(Python REQUIRED COMPONENTS Interpreter Development.Module NumPy) - -# F2PY headers -execute_process( - COMMAND "${Python_EXECUTABLE}" - -c "import numpy.f2py; print(numpy.f2py.get_include())" - OUTPUT_VARIABLE F2PY_INCLUDE_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE -) - -set(f2py_module_name "pi") -set(fortran_src_file "${CMAKE_SOURCE_DIR}/pi/_pi.f") -set(f2py_module_c "${f2py_module_name}module.c") - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" - COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" - "${fortran_src_file}" - "${CMAKE_SOURCE_DIR}/pi/pi.pyf" # Must include custom .pyf file - -m "pi" - --lower # Important - DEPENDS pi/_pi.f # Fortran source -) - -python_add_library(${CMAKE_PROJECT_NAME} MODULE - "${f2py_module_name}module.c" - "${F2PY_INCLUDE_DIR}/fortranobject.c" - "${fortran_src_file}" WITH_SOABI) - -target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC - ${F2PY_INCLUDE_DIR} - ) - -target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC Python::NumPy) - -install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION pi) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/README.md b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/README.md deleted file mode 100644 index 72bb506..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Pi - -This is an example project demonstrating the use of scikit-build for distributing a standalone FORTRAN library, *pi*; -a CMake package for that library; and a Python wrapper implemented in f2py. - -The example assume some familiarity with CMake and f2py, only really going into detail on the scikit-build parts. - -To install the package run in the project directory - -```bash -pip install . -``` - -To run the Python tests, first install the package, then in the project directory run - -```bash -pytest -``` - -This is slightly modified from the example in the [numpy docs](https://numpy.org/devdocs/f2py/buildtools/skbuild.html), but we are using Monte Carlo to estimate the value of $\pi$. - -A few surprises: -1. The dreaded underscore problem has a way of cropping up. One solution is explicitly writing out the interface in a [signature (`.pyf`) file](https://numpy.org/devdocs/f2py/signature-file.html). -2. The module will require numpy to work. -3. Between failed builds, it is best to clear out the `_skbuild` folder. diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/_pi.f b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/_pi.f deleted file mode 100644 index be09dc9..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/_pi.f +++ /dev/null @@ -1,17 +0,0 @@ - subroutine estimate_pi(pi_estimated, num_trials) -C Estimate pi using Monte Carlo - integer num_trials, num_in_circle - real*8 pi_estimated, x, y -Cf2py intent(in) num_trials -Cf2py intent(out) pi_estimated - - num_in_circle = 0d0 - do i = 1, num_trials - call random_number(x) - call random_number(y) - if (x**2 + y**2 < 1.0d0) then - num_in_circle = num_in_circle + 1 - endif - end do - pi_estimated = (4d0 * num_in_circle) / num_trials - end subroutine estimate_pi diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/pi.pyf b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/pi.pyf deleted file mode 100644 index 5e92796..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pi/pi.pyf +++ /dev/null @@ -1,10 +0,0 @@ -! -*- f90 -*- -! Note: the context of this file is case sensitive. -python module pi - interface - subroutine estimate_pi(pi_estimated,num_trials) ! in pi/_pi.f - real*8 intent(out) :: pi_estimated - integer intent(in) :: num_trials - end subroutine estimate_pi - end interface -end python module pi diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pyproject.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pyproject.toml deleted file mode 100644 index cb3eef4..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/pyproject.toml +++ /dev/null @@ -1,16 +0,0 @@ -[build-system] -requires = [ - "scikit-build-core", - "numpy>=1.21", -] -build-backend = "scikit_build_core.build" - -[project] -name = "pi-fortran" -version = "1.0.1" -requires-python = ">=3.7" -dependencies = ["numpy>=1.21"] - -[tool.scikit-build] -ninja.minimum-version = "1.10" -cmake.minimum-version = "3.17.2" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/tests/test_pi.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/tests/test_pi.py deleted file mode 100644 index e1c505a..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/pi-fortran/tests/test_pi.py +++ /dev/null @@ -1,9 +0,0 @@ -import math - -import pytest -from pi import pi - - -def test_estimate_pi(): - pi_est = pi.estimate_pi(1e8) - assert pi_est == pytest.approx(math.pi, rel=0.001) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/CMakeLists.txt deleted file mode 100644 index 18f19cf..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/CMakeLists.txt +++ /dev/null @@ -1,72 +0,0 @@ -cmake_minimum_required(VERSION 3.15...3.26) - -project(tower_of_babel) - -enable_testing() - -find_package(PythonExtensions REQUIRED) -find_package(Cython REQUIRED) -find_package(Boost COMPONENTS python) - - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -add_cython_target(tbabel_cython_static CXX) -add_cython_target(tbabel_cython_shared CXX) -add_cython_target(tbabel_cython_module CXX) - - -add_library(tbabel_cython_static STATIC ${tbabel_cython_static}) -add_library(tbabel_cython_shared SHARED ${tbabel_cython_shared}) -add_library(tbabel_cython_module MODULE ${tbabel_cython_module}) - - -include_directories(${Boost_INCLUDE_DIRS}) - - -add_library(tbabel_boost_static STATIC tbabel_boost_static.cxx) -add_library(tbabel_boost_shared SHARED tbabel_boost_shared.cxx) -add_library(tbabel_boost_module MODULE tbabel_boost_module.cxx) - -target_link_libraries(tbabel_boost_static ${Boost_LIBRARIES}) -target_link_libraries(tbabel_boost_shared ${Boost_LIBRARIES}) -target_link_libraries(tbabel_boost_module ${Boost_LIBRARIES}) - - -python_extension_module(tbabel_cython_static) -python_extension_module(tbabel_cython_shared) -python_extension_module(tbabel_cython_module) - -python_extension_module(tbabel_boost_static) -python_extension_module(tbabel_boost_shared) -python_extension_module(tbabel_boost_module) - -set(site_packages "${PYTHON_RELATIVE_SITE_PACKAGES_DIR}") - -install(TARGETS tbabel_cython_static DESTINATION lib) -install(TARGETS tbabel_cython_shared DESTINATION lib) -install(TARGETS tbabel_cython_module DESTINATION ${site_packages}) - -install(TARGETS tbabel_boost_static DESTINATION lib) -install(TARGETS tbabel_boost_shared DESTINATION lib) -install(TARGETS tbabel_boost_module DESTINATION ${site_packages}) - - -install(FILES tbabel_cython_static.pxd DESTINATION ${site_packages}) -install(FILES tbabel_cython_shared.pxd DESTINATION ${site_packages}) -install(FILES tbabel_cython_module.pxd DESTINATION ${site_packages}) - -install(FILES tbabel_cython_common.pxi DESTINATION ${site_packages}) - - -install(FILES tbabel_boost_static.h DESTINATION include) -install(FILES tbabel_boost_shared.h DESTINATION include) -install(FILES tbabel_boost_module.h DESTINATION include) - -install(FILES tbabel_boost_common.h DESTINATION include) - -install(FILES tbabel_python.py DESTINATION ${site_packages}) - -file(COPY tbabel_python.py DESTINATION ${CMAKE_BINARY_DIR}) - -add_subdirectory(scripts) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/requirements-dev.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/requirements-dev.txt deleted file mode 100644 index bcc19bc..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/requirements-dev.txt +++ /dev/null @@ -1,2 +0,0 @@ -cython -skbuild diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/CMakeLists.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/CMakeLists.txt deleted file mode 100644 index d540d75..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ - -add_cython_target(tbabel CXX EMBED_MAIN) - -# generate modules header file -python_modules_header(modules) -include_directories(${modules_INCLUDE_DIRS}) - -# compile and link -get_property(MODS GLOBAL PROPERTY PY_LINKED_MODULES_LIST) -add_executable(tbabel ${tbabel}) -target_link_libraries(tbabel ${MODS}) -python_standalone_executable(tbabel) - -add_test(NAME tbabel COMMAND tbabel - WORKING_DIRECTORY ${CMAKE_BUILD_DIRECTORY}) - -set_property(TEST tbabel PROPERTY ENVIRONMENT - "LD_LIBRARY_PATH=${CMAKE_BUILD_DIRECTORY};DYLD_LIBRARY_PATH=${CMAKE_BUILD_DIRECTORY}") - -install(TARGETS tbabel DESTINATION scripts) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/tbabel.pyx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/tbabel.pyx deleted file mode 100644 index e224bc4..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/scripts/tbabel.pyx +++ /dev/null @@ -1,56 +0,0 @@ - -import sys - -cdef extern from "stdlib.h": - void srand(int) - -cdef extern from "time.h": - long int time(int) - -cdef extern from "modules.h": - pass - -import tbabel_cython_static as tb_cy_static -import tbabel_cython_shared as tb_cy_shared -import tbabel_cython_module as tb_cy_module - -import tbabel_boost_static as tb_boost_static -import tbabel_boost_shared as tb_boost_shared -import tbabel_boost_module as tb_boost_module - -import tbabel_python as tb_python - -def main(): - from argparse import ArgumentParser - - parser = ArgumentParser(description=( - "Integration stress test that tests interoperability between all forms " - "of extension modules and pure python code.")) - - parser.add_argument("--depth", "-d", type=long, - default=2000, help="call stack depth") - args = parser.parse_args() - - srand(time(0)) - - modules = ( - tb_cy_static, - tb_cy_shared, - tb_cy_module, - - tb_boost_static, - tb_boost_shared, - tb_boost_module, - ) - - py_routines = [ x.cycle for x in modules ] - cy_routines = [ x.get_c_handle() for x in modules ] - - py_routines.append(tb_python.cycle) - - sys.setrecursionlimit(long(1.75*args.depth)) - sys.stdout.write("PY -> ") - tb_python.cycle(args.depth, 0, cy_routines, py_routines) - -if __name__ == "__main__": - main() diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/setup.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/setup.py deleted file mode 100644 index 5bbae28..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/setup.py +++ /dev/null @@ -1,12 +0,0 @@ -from skbuild import setup - -setup( - name="tower_of_babel", - version="0.0.1", - description="integration test of skbuild's support across various python" - "module types and code generation technologies", - author="The scikit-build team", - license="MIT", - scripts=["scripts/tbabel"], - python_requires=">=3.7", -) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common.h b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common.h deleted file mode 100644 index 9e10a58..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common.h +++ /dev/null @@ -1,16 +0,0 @@ - -#include - -#define CONCAT(X, Y) CONCAT_(X, Y) -#define CONCAT_(X, Y) X##Y - -#define TOSTR(X) TOSTR_(X) -#define TOSTR_(X) #X - -#define TB_CYCLE CONCAT(CONCAT(tb_, TBABEL_MODE_LOWER), _cycle) -#define TB_MODULE CONCAT(tbabel_boost_, TBABEL_MODE_LOWER) - -typedef void (*cy_routine)(unsigned int, unsigned int, - PyObject *, PyObject *); - -extern void TB_CYCLE(unsigned int, unsigned int, PyObject *, PyObject *); diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common_imp.h b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common_imp.h deleted file mode 100644 index be5a2a7..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_common_imp.h +++ /dev/null @@ -1,65 +0,0 @@ - -#include -#include - -#include - -void TB_CYCLE(unsigned int N, unsigned int i, - PyObject *_cy_routines, - PyObject *_py_routines) -{ - unsigned int nCy = (unsigned int)PyList_Size(_cy_routines); - unsigned int nPy = (unsigned int)PyList_Size(_py_routines); - unsigned int newI = ((unsigned int)rand())%(nCy + nPy); - - PySys_WriteStdout("Boost " TOSTR(TBABEL_MODE) "\n"); - - if(N) - { - if(newI < nCy) - { - PySys_WriteStdout("C -> "); - - PyObject *_addr = PyList_GetItem(_cy_routines, (Py_ssize_t)newI); - unsigned long addr = PyLong_AsUnsignedLong(_addr); - ((cy_routine)((*(void **)(&addr))))( - N - 1, newI, _cy_routines, _py_routines - ); - } - else - { - PySys_WriteStdout("PY -> "); - PyObject *func = PyList_GetItem(_py_routines, (Py_ssize_t)newI - nCy); - PyObject *args = PyTuple_Pack( - 4, - PyLong_FromSize_t((std::size_t)(N - 1)), - PyLong_FromSize_t((std::size_t)newI), - _cy_routines, - _py_routines - ); - - PyObject_Call(func, args, NULL); - - Py_XDECREF(args); - } - } -} - -static void cycle(unsigned int N, unsigned int i, - boost::python::list &_cy_routines, - boost::python::list &_py_routines) -{ - TB_CYCLE(N, i, _cy_routines.ptr(), _py_routines.ptr()); -} - -static PyObject *get_c_handle() -{ - return PyLong_FromSize_t((std::size_t)(TB_CYCLE)); -} - -BOOST_PYTHON_MODULE(TB_MODULE) -{ - using namespace boost::python; - def("cycle", cycle); - def("get_c_handle", get_c_handle); -} diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.cxx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.cxx deleted file mode 100644 index c401106..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.cxx +++ /dev/null @@ -1,4 +0,0 @@ - -#define TBABEL_MODE MODULE -#define TBABEL_MODE_LOWER module -#include diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.h b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.h deleted file mode 100644 index ca7c9ba..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _TBABEL_BOOST_MODULE_H -#define _TBABEL_BOOST_MODULE_H - -#define TBABEL_MODE MODULE -#define TBABEL_MODE_LOWER module -#include - -#endif /* !_TBABEL_BOOST_MODULE_H */ diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.pxd b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.pxd deleted file mode 100644 index 495058f..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_module.pxd +++ /dev/null @@ -1,9 +0,0 @@ - -cimport cython - -cdef extern from "tbabel_boost_module.h": - ctypedef void (*cy_routine)( - unsigned int, unsigned int, list, list) - - void cycle "tb_module_cycle"(unsigned int N, unsigned int i, - list cy_routines, list py_routines) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.cxx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.cxx deleted file mode 100644 index 5f153d8..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.cxx +++ /dev/null @@ -1,4 +0,0 @@ - -#define TBABEL_MODE SHARED -#define TBABEL_MODE_LOWER shared -#include diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.h b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.h deleted file mode 100644 index bc97d56..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _TBABEL_BOOST_SHARED_H -#define _TBABEL_BOOST_SHARED_H - -#define TBABEL_MODE SHARED -#define TBABEL_MODE_LOWER shared -#include - -#endif /* !_TBABEL_BOOST_SHARED_H */ diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.pxd b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.pxd deleted file mode 100644 index 6052c77..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_shared.pxd +++ /dev/null @@ -1,9 +0,0 @@ - -cimport cython - -cdef extern from "tbabel_boost_shared.h": - ctypedef void (*cy_routine)( - unsigned int, unsigned int, list, list) - - void cycle "tb_shared_cycle"(unsigned int N, unsigned int i, - list cy_routines, list py_routines) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.cxx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.cxx deleted file mode 100644 index d441852..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.cxx +++ /dev/null @@ -1,4 +0,0 @@ - -#define TBABEL_MODE STATIC -#define TBABEL_MODE_LOWER static -#include diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.h b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.h deleted file mode 100644 index bda8aae..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _TBABEL_BOOST_STATIC_H -#define _TBABEL_BOOST_STATIC_H - -#define TBABEL_MODE STATIC -#define TBABEL_MODE_LOWER static -#include - -#endif /* !_TBABEL_BOOST_STATIC_H */ diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.pxd b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.pxd deleted file mode 100644 index 09fcb56..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_boost_static.pxd +++ /dev/null @@ -1,9 +0,0 @@ - -cimport cython - -cdef extern from "tbabel_boost_static.h": - ctypedef void (*cy_routine)( - unsigned int, unsigned int, list, list) - - void cycle "tb_static_cycle"(unsigned int N, unsigned int i, - list cy_routines, list py_routines) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common.pxi b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common.pxi deleted file mode 100644 index bcb8ad7..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common.pxi +++ /dev/null @@ -1,8 +0,0 @@ - -cimport cython - -ctypedef void (*cy_routine)( - unsigned int, unsigned int, list, list) - -cdef void _cycle(unsigned int N, unsigned int i, - list cy_routines, list py_routines) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common_imp.pxi b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common_imp.pxi deleted file mode 100644 index 7abfcb6..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_common_imp.pxi +++ /dev/null @@ -1,40 +0,0 @@ - -# MODULE_TYPE must be defined -# -# DEF MODULE_TYPE = "STATIC" -# include "tbabel/cython_common_imp.pxi" - -cdef extern from "stdlib.h": - unsigned int rand() - -from sys import stdout - -cdef void _cycle(unsigned int N, unsigned int i, - list _cy_routines, list _py_routines): - - cdef unsigned int nCy = len(_cy_routines) - cdef unsigned int nPy = len(_py_routines) - - cdef unsigned int newI = rand()%(nCy + nPy) - - stdout.write("Cython ") - stdout.write(MODULE_TYPE) - stdout.write("\n") - stdout.flush() - - if N: - if newI < nCy: - stdout.write("C -> ") - (((_cy_routines[newI])))( - N - 1, newI, _cy_routines, _py_routines) - - else: - stdout.write("PY -> ") - _py_routines[newI - nCy]( - N - 1, newI, _cy_routines, _py_routines) - -def cycle(N, i, cy_routines, py_routines): - _cycle(N, i, cy_routines, py_routines) - -def get_c_handle(): - return (_cycle) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pxd b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pxd deleted file mode 100644 index 12f0830..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pxd +++ /dev/null @@ -1,2 +0,0 @@ - -include "tbabel_cython_common.pxi" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pyx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pyx deleted file mode 100644 index c64c675..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_module.pyx +++ /dev/null @@ -1,3 +0,0 @@ - -DEF MODULE_TYPE = "MODULE" -include "tbabel_cython_common_imp.pxi" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pxd b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pxd deleted file mode 100644 index 12f0830..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pxd +++ /dev/null @@ -1,2 +0,0 @@ - -include "tbabel_cython_common.pxi" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pyx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pyx deleted file mode 100644 index 390add2..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_shared.pyx +++ /dev/null @@ -1,3 +0,0 @@ - -DEF MODULE_TYPE = "SHARED" -include "tbabel_cython_common_imp.pxi" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pxd b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pxd deleted file mode 100644 index 12f0830..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pxd +++ /dev/null @@ -1,2 +0,0 @@ - -include "tbabel_cython_common.pxi" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pyx b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pyx deleted file mode 100644 index 0fdd29a..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_cython_static.pyx +++ /dev/null @@ -1,3 +0,0 @@ - -DEF MODULE_TYPE = "STATIC" -include "tbabel_cython_common_imp.pxi" diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_python.py b/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_python.py deleted file mode 100644 index e16083d..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/projects/tower-of-babel/tbabel_python.py +++ /dev/null @@ -1,17 +0,0 @@ -from random import getrandbits -from sys import stdout - - -def cycle(n, i, cy_routines, py_routines): # noqa: ARG001 - n_py = len(py_routines) - - new_index = getrandbits(32) % n_py - - stdout.write("Python ") - stdout.write("MODULE") - stdout.write("\n") - stdout.flush() - - if n: - stdout.write("PY -> ") - py_routines[new_index](n - 1, new_index, cy_routines, py_routines) diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/requirements-test.txt b/tests/test_data/scikit-build-core/scikit-build-sample-projects/requirements-test.txt deleted file mode 100644 index c1e6a72..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/requirements-test.txt +++ /dev/null @@ -1,11 +0,0 @@ -codecov>=2.0.5 -coverage>=4.2 -cython>=0.25.1 -flake8>=3.0.4 -path.py>=8.2.1 -pytest>=3.0.3 -pytest-cov>=2.4.0 -pytest-mock>=1.4.0 -pytest-runner>=2.9 -pytest-virtualenv>=1.2.5 -six>=1.10.0 diff --git a/tests/test_data/scikit-build-core/scikit-build-sample-projects/ruff.toml b/tests/test_data/scikit-build-core/scikit-build-sample-projects/ruff.toml deleted file mode 100644 index 3fa8d3d..0000000 --- a/tests/test_data/scikit-build-core/scikit-build-sample-projects/ruff.toml +++ /dev/null @@ -1,32 +0,0 @@ -target-version = "py37" -line-length = 88 - -[lint] -extend-select = [ - "B", # flake8-bugbear - "I", # isort - "ARG", # flake8-unused-arguments - "C4", # flake8-comprehensions - "EM", # flake8-errmsg - "ICN", # flake8-import-conventions - "ISC", # flake8-implicit-str-concat - "G", # flake8-logging-format - "PGH", # pygrep-hooks - "PIE", # flake8-pie - "PL", # pylint - "PTH", # flake8-use-pathlib - "RET", # flake8-return - "RUF", # Ruff-specific - "SIM", # flake8-simplify - "UP", # pyupgrade - "YTT", # flake8-2020 - "EXE", # flake8-executable - "NPY", # NumPy specific rules - "PD", # pandas-vet -] -ignore = [ - "PLR09", # Design related pylint codes - "PLR2004", # Magic values - "ISC001", # Conflicts with formatter -] -flake8-unused-arguments.ignore-variadic-names = true diff --git a/tests/test_data/scikit-build-core/scikit_build_example b/tests/test_data/scikit-build-core/scikit_build_example deleted file mode 160000 index 6fbb889..0000000 --- a/tests/test_data/scikit-build-core/scikit_build_example +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6fbb8896ca47e83a38c491cddeaa39a8882a90f9 diff --git a/tests/test_data/test_archive.tar.gz b/tests/test_data/test_archive.tar.gz deleted file mode 100644 index daa634dd669db4e33fca51a89cba5d0e82748861..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 401 zcmV;C0dD>uiwFP!000001MSkWZrd;r24Ky63PM>cR&pfEi?em;(5cx1p`fX=#a5zJ zkv3ukdH0^|CUFWhT@nOM{%;XXS2MVN3wXKdLG&OphqdATJLQAMBcyF|5M>~{=C5NKSl-@O&&7o1xcy>zt`^gw0~bQh*kf-( v%6Q=F^ybjsY&LZ#D)HLm1poj5000000000000000fH&?J#!EJ*04M+e0Qt)% diff --git a/tests/test_data/test_repo/repo.yaml b/tests/test_data/test_repo/repo.yaml deleted file mode 100644 index f3f8c14..0000000 --- a/tests/test_data/test_repo/repo.yaml +++ /dev/null @@ -1,2 +0,0 @@ -repo: - namespace: 'test_repo' diff --git a/tests/test_spack_utils.py b/tests/test_spack_utils.py index afdd730..845017a 100644 --- a/tests/test_spack_utils.py +++ b/tests/test_spack_utils.py @@ -7,7 +7,7 @@ def test_get_spack_repo1(): - repo = pathlib.Path.cwd() / "tests" / "test_data" / "test_repo" + repo = pathlib.Path.cwd() / "tests" / "sample_data" / "sample_repo" assert spack_utils.get_spack_repo(str(repo)) == repo @@ -36,17 +36,17 @@ def test_is_spack_repo1(): def test_is_spack_repo2(): - repo = pathlib.Path.cwd() / "tests" / "test_data" / "test_repo" + repo = pathlib.Path.cwd() / "tests" / "sample_data" / "sample_repo" assert spack_utils.is_spack_repo(repo) def test_is_spack_repo3(): - repo = pathlib.Path.cwd() / "tests" / "test_data" / "invalid" + repo = pathlib.Path.cwd() / "tests" / "sample_data" / "invalid" assert not spack_utils.is_spack_repo(repo) def test_is_spack_repo4(): - repo = pathlib.Path.cwd() / "tests" / "test_data" + repo = pathlib.Path.cwd() / "tests" / "sample_data" assert not spack_utils.is_spack_repo(repo) diff --git a/tests/test_utils.py b/tests/test_utils.py index 77d5253..767183c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -49,28 +49,8 @@ def test_download_bytes_invalid(url: str) -> None: def test_extract_file_contents_from_tar_bytes_success() -> None: """Unit tests for method.""" - expected = { - "tool": { - "black": { - "line-length": 88, - } - }, - "build-system": { - "requires": ["hatchling>=1.8.0", "hatch-vcs", "hatch-fancy-pypi-readme"], - "build-backend": "hatchling.build", - }, - "project": { - "name": "test", - "description": "description ...", - "license": {"text": "MIT"}, - "requires-python": ">=3.8", - "dependencies": [ - "packaging>=22.0", - ], - }, - } - toml_path = "test_archive/pyproject.toml" - p = pathlib.Path("tests/test_data/test_archive.tar.gz") + toml_path = "sample_archive/pyproject.toml" + p = pathlib.Path("tests/sample_data/sample_archive.tar.gz") with p.open("rb") as file: file_content = file.read() assert isinstance(utils.extract_file_content_from_tar_bytes(file_content, toml_path), str) @@ -78,8 +58,8 @@ def test_extract_file_contents_from_tar_bytes_success() -> None: def test_extract_file_contents_from_tar_bytes_invalid() -> None: """Unit tests for method.""" - toml_path = "test_archive123/pyproject.toml" - p = pathlib.Path("tests/test_data/test_archive.tar.gz") + toml_path = "sample_archive123/pyproject.toml" + p = pathlib.Path("tests/sample_data/sample_archive.tar.gz") with p.open("rb") as file: file_content = file.read() assert utils.extract_file_content_from_tar_bytes(file_content, toml_path) is None