diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cdf712b..0468cae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: entry: >- pixi run -e lint insert-license - --license-base64 Q29weXJpZ2h0IChjKSBRdWFudENvIHt5ZWFyX3N0YXJ0fS17eWVhcl9lbmR9ClNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBMaWNlbnNlUmVmLVF1YW50Q28K + --license-base64 Q29weXJpZ2h0IChjKSBRdWFudENvIDIwMjMtMjAyNApTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogQlNELTMtQ2xhdXNlCg== --dynamic-years --comment-style "#" language: system diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..0e165f1 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,12 @@ +version: 2 +build: + os: "ubuntu-22.04" + tools: + python: "3" + # You can also specify other tool versions: + # nodejs: "16" + commands: + - pip install setuptools sphinx numpydoc sphinxcontrib-apidoc sphinx_rtd_theme sphinx-toolbox nbsphinx + - pip install -e . --no-build-isolation + - cd docs && make html + - cp _build/html/* $READTHEDOCS_OUTPUT/html/ diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..565b052 --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1 @@ +.. include:: ../CHANGELOG.rst diff --git a/docs/conf.py b/docs/conf.py index 94cc609..a374993 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2022-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause # Configuration file for the Sphinx documentation builder. # diff --git a/docs/experimental/experimental.rst b/docs/experimental/experimental.rst index b8c151f..7198486 100644 --- a/docs/experimental/experimental.rst +++ b/docs/experimental/experimental.rst @@ -60,7 +60,6 @@ Internally, ``ndonnx`` defines the ``StructType`` interface. This interface is u The interface is defined below: .. autoclass:: ndonnx._experimental.StructType - :no-index: :members: :undoc-members: :private-members: diff --git a/ndonnx/__init__.py b/ndonnx/__init__.py index a783fd0..5e5fd01 100644 --- a/ndonnx/__init__.py +++ b/ndonnx/__init__.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2022-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause import importlib.metadata import warnings diff --git a/ndonnx/_array.py b/ndonnx/_array.py index 5f2031b..7d415f3 100644 --- a/ndonnx/_array.py +++ b/ndonnx/_array.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_build.py b/ndonnx/_build.py index fa2b661..d95b2ba 100644 --- a/ndonnx/_build.py +++ b/ndonnx/_build.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_constants.py b/ndonnx/_constants.py index c16ccca..3053472 100644 --- a/ndonnx/_constants.py +++ b/ndonnx/_constants.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause import numpy as np diff --git a/ndonnx/_core/__init__.py b/ndonnx/_core/__init__.py index 159c41e..a53bade 100644 --- a/ndonnx/_core/__init__.py +++ b/ndonnx/_core/__init__.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from ._impl import CoreOperationsImpl from ._interface import OperationsBlock diff --git a/ndonnx/_core/_impl.py b/ndonnx/_core/_impl.py index c77ac96..39f76ec 100644 --- a/ndonnx/_core/_impl.py +++ b/ndonnx/_core/_impl.py @@ -1,5 +1,6 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause + from __future__ import annotations import functools diff --git a/ndonnx/_core/_interface.py b/ndonnx/_core/_interface.py index ea056e3..b1a354a 100644 --- a/ndonnx/_core/_interface.py +++ b/ndonnx/_core/_interface.py @@ -1,5 +1,6 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause + from __future__ import annotations from typing import Literal diff --git a/ndonnx/_corearray.py b/ndonnx/_corearray.py index 7dd0dc7..7183eb9 100644 --- a/ndonnx/_corearray.py +++ b/ndonnx/_corearray.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_data_types/__init__.py b/ndonnx/_data_types/__init__.py index 92004e0..28b8779 100644 --- a/ndonnx/_data_types/__init__.py +++ b/ndonnx/_data_types/__init__.py @@ -1,5 +1,6 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause + from __future__ import annotations from .aliases import ( diff --git a/ndonnx/_data_types/aliases.py b/ndonnx/_data_types/aliases.py index d88509e..9ba10c4 100644 --- a/ndonnx/_data_types/aliases.py +++ b/ndonnx/_data_types/aliases.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from .classes import ( Boolean, diff --git a/ndonnx/_data_types/classes.py b/ndonnx/_data_types/classes.py index 59edf85..db28709 100644 --- a/ndonnx/_data_types/classes.py +++ b/ndonnx/_data_types/classes.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_data_types/conversion.py b/ndonnx/_data_types/conversion.py index 7084fb3..ca70d08 100644 --- a/ndonnx/_data_types/conversion.py +++ b/ndonnx/_data_types/conversion.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_data_types/coretype.py b/ndonnx/_data_types/coretype.py index cd4596f..ca2d217 100644 --- a/ndonnx/_data_types/coretype.py +++ b/ndonnx/_data_types/coretype.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_data_types/schema.py b/ndonnx/_data_types/schema.py index ff9d3f3..765c332 100644 --- a/ndonnx/_data_types/schema.py +++ b/ndonnx/_data_types/schema.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from dataclasses import dataclass diff --git a/ndonnx/_data_types/structtype.py b/ndonnx/_data_types/structtype.py index 1f720b7..bcde0b9 100644 --- a/ndonnx/_data_types/structtype.py +++ b/ndonnx/_data_types/structtype.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_experimental.py b/ndonnx/_experimental.py index 6814f44..df9dd14 100644 --- a/ndonnx/_experimental.py +++ b/ndonnx/_experimental.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from ._core import OperationsBlock from ._data_types import CastMixin, Schema, StructType diff --git a/ndonnx/_funcs.py b/ndonnx/_funcs.py index edfc6f6..dd912f3 100644 --- a/ndonnx/_funcs.py +++ b/ndonnx/_funcs.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_index.py b/ndonnx/_index.py index 59aefdd..86dff61 100644 --- a/ndonnx/_index.py +++ b/ndonnx/_index.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from collections.abc import Iterable from typing import TypeVar, Union diff --git a/ndonnx/_opset_extensions.py b/ndonnx/_opset_extensions.py index 45a28c2..a6826f4 100644 --- a/ndonnx/_opset_extensions.py +++ b/ndonnx/_opset_extensions.py @@ -1,5 +1,6 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause + from __future__ import annotations import builtins diff --git a/ndonnx/_propagation.py b/ndonnx/_propagation.py index 5a5591b..b1fdce1 100644 --- a/ndonnx/_propagation.py +++ b/ndonnx/_propagation.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/_utility.py b/ndonnx/_utility.py index 17ef119..8e0922b 100644 --- a/ndonnx/_utility.py +++ b/ndonnx/_utility.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/ndonnx/additional/__init__.py b/ndonnx/additional/__init__.py index ddfe2db..7554609 100644 --- a/ndonnx/additional/__init__.py +++ b/ndonnx/additional/__init__.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from ._additional import fill_null, make_nullable, isin, shape, static_map diff --git a/ndonnx/additional/_additional.py b/ndonnx/additional/_additional.py index 29e3dd1..670fe5e 100644 --- a/ndonnx/additional/_additional.py +++ b/ndonnx/additional/_additional.py @@ -1,5 +1,6 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause + from __future__ import annotations from collections.abc import Mapping, Sequence diff --git a/pixi.toml b/pixi.toml index 733a33e..d5c863f 100644 --- a/pixi.toml +++ b/pixi.toml @@ -11,6 +11,7 @@ postinstall = "pip install --no-build-isolation --no-deps --disable-pip-version- python = ">=3.10" numpy = "*" spox = ">=0.10" +typing_extensions = "*" [host-dependencies] pip = "*" diff --git a/pyproject.toml b/pyproject.toml index fd6903d..f6fa2f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,12 +14,20 @@ authors = [ { name = "Christian Bourjau", email = "christian.bourjau@quantco.com" }, ] classifiers = [ + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] requires-python = ">=3.10" +dependencies = ["numpy", "spox>=0.10", "typing_extensions"] +keywords = [ + "numpy", + "onnx", + "array-api", +] [project.urls] repository = "https://github.com/quantco/ndonnx" diff --git a/scripts/create_typing.sh b/scripts/create_typing.sh deleted file mode 100755 index 63844e3..0000000 --- a/scripts/create_typing.sh +++ /dev/null @@ -1,5 +0,0 @@ -# Create concatenation of all signature files, removing the definitions of array -sed '$s/$/\n/' api-coverage-tests/array-api/spec/API_specification/signatures/*.py | sed '/^array = /d' > ndonnx/__init__.pyi - -# Create _types.py -echo "from ._array import Array as array\n$( ndonnx/_types.pyi diff --git a/scripts/parse_test_report.py b/scripts/parse_test_report.py deleted file mode 100644 index 6dd0279..0000000 --- a/scripts/parse_test_report.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo - -import argparse -import json - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("report_json", help="Directory containing reports") - args = parser.parse_args() - - print(args.report_json) - with open(args.report_json) as f: - report = json.load(f) - - for test in report["tests"]: - print(test["nodeid"], test["outcome"]) - - # Print summary in readable format - print("Summary:") - print(f'- {report["summary"]["passed"]} passed') - print(f'- {report["summary"]["failed"]} failed') - print(f'- {report["summary"]["skipped"]} deselected') - print(f'- {report["summary"]["total"]} total') diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 12afabe..0000000 --- a/scripts/test.sh +++ /dev/null @@ -1,2 +0,0 @@ -export ARRAY_API_TESTS_MODULE=ndonnx.testing && -pytest -n auto api-coverage-tests --json-report --json-report-file=api-coverage-tests.json diff --git a/tests/ndonnx/test_additional.py b/tests/ndonnx/test_additional.py index 5845ed3..ba2b67f 100644 --- a/tests/ndonnx/test_additional.py +++ b/tests/ndonnx/test_additional.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause import sys diff --git a/tests/ndonnx/test_build_utils.py b/tests/ndonnx/test_build_utils.py index ab69ee0..a5b737f 100644 --- a/tests/ndonnx/test_build_utils.py +++ b/tests/ndonnx/test_build_utils.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause import pytest diff --git a/tests/ndonnx/test_compute_modes.py b/tests/ndonnx/test_compute_modes.py index 551dc29..ed87e1e 100644 --- a/tests/ndonnx/test_compute_modes.py +++ b/tests/ndonnx/test_compute_modes.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause import numpy as np import numpy.array_api as npx diff --git a/tests/ndonnx/test_constant_propagation.py b/tests/ndonnx/test_constant_propagation.py index 5e16161..8c2ad69 100644 --- a/tests/ndonnx/test_constant_propagation.py +++ b/tests/ndonnx/test_constant_propagation.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from typing import Literal diff --git a/tests/ndonnx/test_core.py b/tests/ndonnx/test_core.py index 14d4eea..e88e203 100644 --- a/tests/ndonnx/test_core.py +++ b/tests/ndonnx/test_core.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations diff --git a/tests/ndonnx/test_dtypes.py b/tests/ndonnx/test_dtypes.py index 8b11699..5c4d788 100644 --- a/tests/ndonnx/test_dtypes.py +++ b/tests/ndonnx/test_dtypes.py @@ -1,5 +1,6 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause + from __future__ import annotations import re diff --git a/tests/ndonnx/test_include.py b/tests/ndonnx/test_include.py index 96dbcdc..8bf805b 100644 --- a/tests/ndonnx/test_include.py +++ b/tests/ndonnx/test_include.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause def test_import(): diff --git a/tests/ndonnx/test_masked.py b/tests/ndonnx/test_masked.py index 6510e62..8903158 100644 --- a/tests/ndonnx/test_masked.py +++ b/tests/ndonnx/test_masked.py @@ -1,5 +1,5 @@ # Copyright (c) QuantCo 2023-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# SPDX-License-Identifier: BSD-3-Clause import math diff --git a/tests/ndonnx/utils.py b/tests/ndonnx/utils.py index 793929c..cef399b 100644 --- a/tests/ndonnx/utils.py +++ b/tests/ndonnx/utils.py @@ -1,5 +1,5 @@ -# Copyright (c) QuantCo 2024-2024 -# SPDX-License-Identifier: LicenseRef-QuantCo +# Copyright (c) QuantCo 2023-2024 +# SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations