diff --git a/.all-contributorsrc b/.all-contributorsrc index 7c080dd5..ca4d3550 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -5,7 +5,7 @@ "repoHost": "https://github.com", "files": [ "README.md", - "CONTRIBUTORS.md" + "docs/CONTRIBUTORS.md" ], "imageSize": 100, "commitType": "docs", diff --git a/codecov.yml b/.codecov.yml similarity index 100% rename from codecov.yml rename to .codecov.yml diff --git a/.gitattributes b/.gitattributes index 61f1375c..67b7264b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,10 +6,8 @@ .github/* export-ignore .git* export-ignore -codecov.yml export-ignore +.codecov.yml export-ignore pixi.lock export-ignore -RELEASING.md export-ignore -renovate.json export-ignore # GitHub syntax highlighting pixi.lock linguist-language=YAML linguist-generated=true diff --git a/renovate.json b/.github/renovate.json similarity index 100% rename from renovate.json rename to .github/renovate.json diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4825d66d..88204767 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -37,7 +37,7 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: docs-build - path: docs/build/ + path: docs/sphinx/build/ docs-deploy: name: Deploy @@ -60,10 +60,10 @@ jobs: uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: docs-build - path: docs/build/ + path: docs/sphinx/build/ - name: Deploy uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 with: - folder: docs/build/ + folder: docs/sphinx/build/ ssh-key: ${{ secrets.DEPLOY_KEY }} diff --git a/.gitignore b/.gitignore index 0b377833..7d0e038e 100644 --- a/.gitignore +++ b/.gitignore @@ -69,8 +69,8 @@ instance/ .scrapy # Sphinx documentation -docs/_build/ -docs/generated/ +docs/sphinx/_build/ +docs/sphinx/generated/ # PyBuilder .pybuilder/ @@ -163,9 +163,9 @@ Thumbs.db .pixi *.egg-info -# Vendor tests -vendor_tests/array_api_compat/ -vendor_tests/array_api_extra/ +# Vendoring tests +tests/vendoring/array_api_compat/ +tests/vendoring/array_api_extra/ # all-contributors node_modules diff --git a/lefthook.yml b/.lefthook.yml similarity index 100% rename from lefthook.yml rename to .lefthook.yml diff --git a/CONTRIBUTORS.md b/docs/CONTRIBUTORS.md similarity index 100% rename from CONTRIBUTORS.md rename to docs/CONTRIBUTORS.md diff --git a/RELEASING.md b/docs/RELEASING.md similarity index 100% rename from RELEASING.md rename to docs/RELEASING.md diff --git a/docs/_templates/autosummary/class.rst b/docs/sphinx/_templates/autosummary/class.rst similarity index 100% rename from docs/_templates/autosummary/class.rst rename to docs/sphinx/_templates/autosummary/class.rst diff --git a/docs/_templates/autosummary/function.rst b/docs/sphinx/_templates/autosummary/function.rst similarity index 100% rename from docs/_templates/autosummary/function.rst rename to docs/sphinx/_templates/autosummary/function.rst diff --git a/docs/_templates/testing-function.rst b/docs/sphinx/_templates/testing-function.rst similarity index 100% rename from docs/_templates/testing-function.rst rename to docs/sphinx/_templates/testing-function.rst diff --git a/docs/api-creation.md b/docs/sphinx/api-creation.md similarity index 100% rename from docs/api-creation.md rename to docs/sphinx/api-creation.md diff --git a/docs/api-elementwise.md b/docs/sphinx/api-elementwise.md similarity index 100% rename from docs/api-elementwise.md rename to docs/sphinx/api-elementwise.md diff --git a/docs/api-indexing.md b/docs/sphinx/api-indexing.md similarity index 100% rename from docs/api-indexing.md rename to docs/sphinx/api-indexing.md diff --git a/docs/api-inspection.md b/docs/sphinx/api-inspection.md similarity index 100% rename from docs/api-inspection.md rename to docs/sphinx/api-inspection.md diff --git a/docs/api-lazy.md b/docs/sphinx/api-lazy.md similarity index 100% rename from docs/api-lazy.md rename to docs/sphinx/api-lazy.md diff --git a/docs/api-linalg.md b/docs/sphinx/api-linalg.md similarity index 100% rename from docs/api-linalg.md rename to docs/sphinx/api-linalg.md diff --git a/docs/api-manipulation.md b/docs/sphinx/api-manipulation.md similarity index 100% rename from docs/api-manipulation.md rename to docs/sphinx/api-manipulation.md diff --git a/docs/api-reference.md b/docs/sphinx/api-reference.md similarity index 100% rename from docs/api-reference.md rename to docs/sphinx/api-reference.md diff --git a/docs/api-searching.md b/docs/sphinx/api-searching.md similarity index 100% rename from docs/api-searching.md rename to docs/sphinx/api-searching.md diff --git a/docs/api-set.md b/docs/sphinx/api-set.md similarity index 100% rename from docs/api-set.md rename to docs/sphinx/api-set.md diff --git a/docs/api-sorting.md b/docs/sphinx/api-sorting.md similarity index 100% rename from docs/api-sorting.md rename to docs/sphinx/api-sorting.md diff --git a/docs/api-statistical.md b/docs/sphinx/api-statistical.md similarity index 100% rename from docs/api-statistical.md rename to docs/sphinx/api-statistical.md diff --git a/docs/api-testing.md b/docs/sphinx/api-testing.md similarity index 100% rename from docs/api-testing.md rename to docs/sphinx/api-testing.md diff --git a/docs/conf.py b/docs/sphinx/conf.py similarity index 97% rename from docs/conf.py rename to docs/sphinx/conf.py index 8470621c..132aefd2 100644 --- a/docs/conf.py +++ b/docs/sphinx/conf.py @@ -10,7 +10,7 @@ _SOURCE_REPOSITORY = "https://github.com/data-apis/array-api-extra" _SOURCE_BRANCH = "main" -_REPOSITORY_ROOT = Path(__file__).resolve().parent.parent +_REPOSITORY_ROOT = Path(__file__).resolve().parent.parent.parent _PACKAGE_SOURCE_ROOT = _REPOSITORY_ROOT / "src" project = "array-api-extra" @@ -56,7 +56,7 @@ ], "source_repository": _SOURCE_REPOSITORY, "source_branch": _SOURCE_BRANCH, - "source_directory": "docs/", + "source_directory": "docs/sphinx/", } myst_enable_extensions = [ diff --git a/docs/contributing.md b/docs/sphinx/contributing.md similarity index 97% rename from docs/contributing.md rename to docs/sphinx/contributing.md index 6b86a4c2..bc3ba154 100644 --- a/docs/contributing.md +++ b/docs/sphinx/contributing.md @@ -58,10 +58,10 @@ pixi shell --environment=dev - Add your function to `__all__` at the top of the file. - Import your function to `src/array_api_extra/__init__.py` and add it to`__all__` there. -- Add a test class for your function in the corresponding file under `tests/`. +- Add a test class for your function in the corresponding file under `tests/main/`. - Ensure that `lazy_xp_function` is called on the function if lazy backends are supposed to be tested. -- Add your function to the corresponding API page under `docs/`. +- Add your function to the corresponding API page under `docs/sphinx/`. - Don't worry if you are not sure how to do some of the above steps or think you might have done something wrong — [make a PR!](https://github.com/data-apis/array-api-extra/pulls) diff --git a/docs/contributors.md b/docs/sphinx/contributors.md similarity index 100% rename from docs/contributors.md rename to docs/sphinx/contributors.md diff --git a/docs/index.md b/docs/sphinx/index.md similarity index 100% rename from docs/index.md rename to docs/sphinx/index.md diff --git a/docs/library-design.md b/docs/sphinx/library-design.md similarity index 100% rename from docs/library-design.md rename to docs/sphinx/library-design.md diff --git a/meson.build b/meson.build index df567ef8..a38eb173 100644 --- a/meson.build +++ b/meson.build @@ -57,4 +57,3 @@ foreach subdir, files : sources endforeach subdir('tests') -subdir('vendor_tests') diff --git a/pixi.toml b/pixi.toml index 9f5ead2b..10aa36dc 100644 --- a/pixi.toml +++ b/pixi.toml @@ -224,12 +224,12 @@ scipy = ">=1.15.2" [feature.tests.tasks] tests = { description = "Run tests", - cmd = "pytest -v", + cmd = "pytest -v tests/main", default-environment = "tests", } tests-cov = { description = "Run tests with coverage", - cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20", + cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20 tests/main", default-environment = "tests", } @@ -248,36 +248,36 @@ open-coverage = { clean-vendor-compat = { description = "Delete the existing vendored version of array-api-compat", - cmd = "rm -rf vendor_tests/array_api_compat", + cmd = "rm -rf tests/vendoring/array_api_compat", default-environment = "tests", } clean-vendor-extra = { description = "Delete the existing vendored version of array-api-extra", - cmd = "rm -rf vendor_tests/array_api_extra", + cmd = "rm -rf tests/vendoring/array_api_extra", default-environment = "tests", } copy-vendor-compat = { description = "Vendor a clean copy of array-api-compat", depends-on = ["clean-vendor-compat"], - cmd = "cp -r $(python -c 'import array_api_compat, pathlib; print(pathlib.Path(array_api_compat.__file__).parent)') vendor_tests/ && rm -rf vendor_tests/array_api_compat/vendor_tests && rm -rf vendor_tests/array_api_compat/tests", + cmd = "cp -r $(python -c 'import array_api_compat, pathlib; print(pathlib.Path(array_api_compat.__file__).parent)') tests/vendoring/ && rm -rf tests/vendoring/array_api_compat/vendor_tests && rm -rf tests/vendoring/array_api_compat/tests", default-environment = "tests", } copy-vendor-extra = { description = "Vendor a clean copy of array-api-extra", depends-on = ["clean-vendor-extra"], - cmd = "cp -r src/array_api_extra vendor_tests/", + cmd = "cp -r src/array_api_extra tests/vendoring/", default-environment = "tests", } -tests-vendor = { +tests-vendoring = { description = "Check that array-api-extra and array-api-compat can be vendored together", depends-on = ["copy-vendor-compat", "copy-vendor-extra"], - cmd = "pytest -v vendor_tests", + cmd = "pytest -v tests/vendoring", default-environment = "tests", } tests-ci = { description = "Run tests with coverage and vendor tests", - depends-on = ["tests-cov", "tests-vendor"], + depends-on = ["tests-cov", "tests-vendoring"], } # tests with only run dependencies @@ -288,12 +288,12 @@ pytest-cov = ">=7.1.0" [feature.tests-run-deps.tasks] tests-run-deps = { description = "Run run-dependency tests", - cmd = "pytest -v run_deps_tests", + cmd = "pytest -v tests/run_deps", default-environment = "tests-run-deps", } tests-run-deps-cov = { description = "Run run-dependency tests with coverage", - cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20 run_deps_tests", + cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20 tests/run_deps", default-environment = "tests-run-deps", } @@ -312,14 +312,14 @@ numpy = ">=2.1.3" [feature.docs.tasks] docs = { description = "Build docs", - cwd = "docs", + cwd = "docs/sphinx/", cmd = "sphinx-build -E -W . build/", default-environment = "docs", } open-docs = { description = "Open the generated docs", depends-on = ["docs"], - cwd = "docs", + cwd = "docs/sphinx/", cmd = "open build/index.html", default-environment = "docs", } @@ -328,7 +328,7 @@ open-docs = { open-docs = { description = "Open the generated docs", depends-on = ["docs"], - cwd = "docs", + cwd = "docs/sphinx/", cmd = "cmd /c start build/index.html", default-environment = "docs", } diff --git a/pyproject.toml b/pyproject.toml index e8830126..bc39bcdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,8 @@ requires = ["meson-python"] build-backend = "mesonpy" [tool.basedpyright] -include = ["src", "tests", "vendor_tests", "run_deps_tests"] -exclude = ["vendor_tests/array_api_compat"] +include = ["src", "tests"] +exclude = ["tests/vendoring/array_api_compat"] pythonVersion = "3.11" pythonPlatform = "All" typeCheckingMode = "all" @@ -63,9 +63,7 @@ reportUnknownLambdaType = false reportImplicitStringConcatenation = false executionEnvironments = [ - { root = "tests", reportPrivateUsage = false, reportUnknownArgumentType = false }, - { root = "vendor_tests", reportPrivateUsage = false, reportUnknownArgumentType = false }, - { root = "run_deps_tests", reportPrivateUsage = false, reportUnknownArgumentType = false }, + { root = "tests/", reportPrivateUsage = false, reportUnknownArgumentType = false }, { root = "src" }, ] @@ -73,7 +71,7 @@ executionEnvironments = [ run.source = ["array_api_extra"] [tool.mypy] -files = ["src", "tests", "vendor_tests", "run_deps_tests"] +files = ["src", "tests"] python_version = "3.11" warn_unused_configs = true strict = true @@ -90,17 +88,9 @@ module = ["tests/*"] disable_error_code = ["no-untyped-def"] # test(...) without -> None [[tool.mypy.overrides]] -module = ["vendor_tests/*"] -disable_error_code = ["no-untyped-def"] # test(...) without -> None - -[[tool.mypy.overrides]] -module = ["vendor_tests/array_api_compat/*"] +module = ["tests/vendoring/array_api_compat/*"] ignore_errors = true -[[tool.mypy.overrides]] -module = ["run_deps_tests/*"] -disable_error_code = ["no-untyped-def"] # test(...) without -> None - [tool.numpydoc_validation] checks = [ "all", # report on all checks, except the below @@ -110,7 +100,6 @@ checks = [ ] exclude_files = [ "^tests/.*", - "^vendor_tests/.*", ] [tool.pylint] @@ -148,7 +137,7 @@ matches = "tests/*.py" errors = { unannotated-return = false } [[tool.pyrefly.sub-config]] -matches = "vendor_tests/*.py" +matches = "tests/vendoring/*.py" errors = { unannotated-return = false } [[tool.pyrefly.sub-config]] @@ -209,3 +198,17 @@ ignore = [ "N806", # Variable in function should be lowercase "PLC0415", # `import` should be at the top-level of a file ] + +[tool.tombi] +toml-version = "v1.1.0" +format.rules.line-width = 100 + +[tool.typos.files] +extend-exclude = [".git/", ".pixi/"] +ignore-hidden = false + +[tool.typos.default.extend-words] +nd = "nd" +typ = "typ" +cardinalis = "cardinalis" +writeable = "writeable" diff --git a/tests/__init__.py b/tests/__init__.py index 3ccaf52b..21455971 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Needed to import .conftest from the test modules.""" +"""Tests""" diff --git a/tests/main/__init__.py b/tests/main/__init__.py new file mode 100644 index 00000000..3ccaf52b --- /dev/null +++ b/tests/main/__init__.py @@ -0,0 +1 @@ +"""Needed to import .conftest from the test modules.""" diff --git a/tests/conftest.py b/tests/main/conftest.py similarity index 100% rename from tests/conftest.py rename to tests/main/conftest.py diff --git a/tests/main/meson.build b/tests/main/meson.build new file mode 100644 index 00000000..720251f7 --- /dev/null +++ b/tests/main/meson.build @@ -0,0 +1,24 @@ +py.install_sources([ + '__init__.py', + 'conftest.py', + 'test_at.py', + 'test_creation.py', + 'test_deprecation.py', + 'test_elementwise.py', + 'test_helpers.py', + 'test_indexing.py', + 'test_inspection.py', + 'test_lazy.py', + 'test_linalg.py', + 'test_manipulation.py', + 'test_public_api.py', + 'test_searching.py', + 'test_set.py', + 'test_sorting.py', + 'test_statistical.py', + 'test_testing.py', + 'test_version.py', + ], + subdir: 'array_api_extra/tests/main', + install_tag: 'tests', +) diff --git a/tests/test_at.py b/tests/main/test_at.py similarity index 100% rename from tests/test_at.py rename to tests/main/test_at.py diff --git a/tests/test_creation.py b/tests/main/test_creation.py similarity index 100% rename from tests/test_creation.py rename to tests/main/test_creation.py diff --git a/tests/test_deprecation.py b/tests/main/test_deprecation.py similarity index 100% rename from tests/test_deprecation.py rename to tests/main/test_deprecation.py diff --git a/tests/test_elementwise.py b/tests/main/test_elementwise.py similarity index 100% rename from tests/test_elementwise.py rename to tests/main/test_elementwise.py diff --git a/tests/test_helpers.py b/tests/main/test_helpers.py similarity index 100% rename from tests/test_helpers.py rename to tests/main/test_helpers.py diff --git a/tests/test_indexing.py b/tests/main/test_indexing.py similarity index 100% rename from tests/test_indexing.py rename to tests/main/test_indexing.py diff --git a/tests/test_inspection.py b/tests/main/test_inspection.py similarity index 100% rename from tests/test_inspection.py rename to tests/main/test_inspection.py diff --git a/tests/test_lazy.py b/tests/main/test_lazy.py similarity index 100% rename from tests/test_lazy.py rename to tests/main/test_lazy.py diff --git a/tests/test_linalg.py b/tests/main/test_linalg.py similarity index 100% rename from tests/test_linalg.py rename to tests/main/test_linalg.py diff --git a/tests/test_manipulation.py b/tests/main/test_manipulation.py similarity index 100% rename from tests/test_manipulation.py rename to tests/main/test_manipulation.py diff --git a/tests/test_public_api.py b/tests/main/test_public_api.py similarity index 100% rename from tests/test_public_api.py rename to tests/main/test_public_api.py diff --git a/tests/test_searching.py b/tests/main/test_searching.py similarity index 100% rename from tests/test_searching.py rename to tests/main/test_searching.py diff --git a/tests/test_set.py b/tests/main/test_set.py similarity index 100% rename from tests/test_set.py rename to tests/main/test_set.py diff --git a/tests/test_sorting.py b/tests/main/test_sorting.py similarity index 100% rename from tests/test_sorting.py rename to tests/main/test_sorting.py diff --git a/tests/test_statistical.py b/tests/main/test_statistical.py similarity index 100% rename from tests/test_statistical.py rename to tests/main/test_statistical.py diff --git a/tests/test_testing.py b/tests/main/test_testing.py similarity index 100% rename from tests/test_testing.py rename to tests/main/test_testing.py diff --git a/tests/test_version.py b/tests/main/test_version.py similarity index 100% rename from tests/test_version.py rename to tests/main/test_version.py diff --git a/tests/meson.build b/tests/meson.build index 911502a4..b546d2aa 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,24 +1,8 @@ -py.install_sources([ - '__init__.py', - 'conftest.py', - 'test_at.py', - 'test_creation.py', - 'test_deprecation.py', - 'test_elementwise.py', - 'test_helpers.py', - 'test_indexing.py', - 'test_inspection.py', - 'test_lazy.py', - 'test_linalg.py', - 'test_manipulation.py', - 'test_public_api.py', - 'test_searching.py', - 'test_set.py', - 'test_sorting.py', - 'test_statistical.py', - 'test_testing.py', - 'test_version.py', - ], - subdir: 'array_api_extra/tests', +py.install_sources(['__init__.py',], + subdir: 'array_api_extra/tests/', install_tag: 'tests', ) + +subdir('main') +subdir('run_deps') +subdir('vendoring') diff --git a/run_deps_tests/__init__.py b/tests/run_deps/__init__.py similarity index 100% rename from run_deps_tests/__init__.py rename to tests/run_deps/__init__.py diff --git a/tests/run_deps/meson.build b/tests/run_deps/meson.build new file mode 100644 index 00000000..dd8db258 --- /dev/null +++ b/tests/run_deps/meson.build @@ -0,0 +1,7 @@ +py.install_sources([ + '__init__.py', + 'test_run_deps.py', + ], + subdir: 'array_api_extra/tests/run_deps', + install_tag: 'tests', +) diff --git a/run_deps_tests/test_run_deps.py b/tests/run_deps/test_run_deps.py similarity index 100% rename from run_deps_tests/test_run_deps.py rename to tests/run_deps/test_run_deps.py diff --git a/vendor_tests/__init__.py b/tests/vendoring/__init__.py similarity index 100% rename from vendor_tests/__init__.py rename to tests/vendoring/__init__.py diff --git a/vendor_tests/_array_api_compat_vendor.py b/tests/vendoring/_array_api_compat_vendor.py similarity index 100% rename from vendor_tests/_array_api_compat_vendor.py rename to tests/vendoring/_array_api_compat_vendor.py diff --git a/vendor_tests/meson.build b/tests/vendoring/meson.build similarity index 73% rename from vendor_tests/meson.build rename to tests/vendoring/meson.build index 234496ff..f72a1bbf 100644 --- a/vendor_tests/meson.build +++ b/tests/vendoring/meson.build @@ -3,6 +3,6 @@ py.install_sources([ '_array_api_compat_vendor.py', 'test_vendor.py', ], - subdir: 'array_api_extra/vendor_tests', + subdir: 'array_api_extra/tests/vendoring', install_tag: 'tests', ) diff --git a/vendor_tests/test_vendor.py b/tests/vendoring/test_vendor.py similarity index 95% rename from vendor_tests/test_vendor.py rename to tests/vendoring/test_vendor.py index 51ac821e..54e4ce2f 100644 --- a/vendor_tests/test_vendor.py +++ b/tests/vendoring/test_vendor.py @@ -5,7 +5,7 @@ import array_api_strict as xp from numpy.testing import assert_array_equal -from vendor_tests.array_api_compat.common._typing import ( # type: ignore[import-not-found] +from tests.vendoring.array_api_compat.common._typing import ( # type: ignore[import-not-found] Array, ) diff --git a/tombi.toml b/tombi.toml deleted file mode 100644 index 3d86da1c..00000000 --- a/tombi.toml +++ /dev/null @@ -1,2 +0,0 @@ -toml-version = "v1.1.0" -format.rules.line-width = 100 diff --git a/typos.toml b/typos.toml deleted file mode 100644 index d7e130a0..00000000 --- a/typos.toml +++ /dev/null @@ -1,9 +0,0 @@ -[files] -extend-exclude = [".git/", ".pixi/"] -ignore-hidden = false - -[default.extend-words] -nd = "nd" -typ = "typ" -cardinalis = "cardinalis" -writeable = "writeable"