onearray 0.1.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. onearray-0.1.0a1/.gitattributes +2 -0
  2. onearray-0.1.0a1/.github/workflows/docs-check.yml +19 -0
  3. onearray-0.1.0a1/.github/workflows/docs.yml +26 -0
  4. onearray-0.1.0a1/.github/workflows/lint.yml +21 -0
  5. onearray-0.1.0a1/.github/workflows/release.yml +203 -0
  6. onearray-0.1.0a1/.github/workflows/tests.yml +41 -0
  7. onearray-0.1.0a1/.gitignore +181 -0
  8. onearray-0.1.0a1/CHANGELOG.md +49 -0
  9. onearray-0.1.0a1/LICENSE +21 -0
  10. onearray-0.1.0a1/PKG-INFO +115 -0
  11. onearray-0.1.0a1/README.md +88 -0
  12. onearray-0.1.0a1/docs/contracts.md +343 -0
  13. onearray-0.1.0a1/docs/guide/arrays-and-backends.md +145 -0
  14. onearray-0.1.0a1/docs/guide/conversion-and-memory.md +147 -0
  15. onearray-0.1.0a1/docs/index.md +47 -0
  16. onearray-0.1.0a1/docs/stylesheets/extra.css +4 -0
  17. onearray-0.1.0a1/docs/versioning.md +69 -0
  18. onearray-0.1.0a1/pyproject.toml +35 -0
  19. onearray-0.1.0a1/setup.cfg +4 -0
  20. onearray-0.1.0a1/src/onearray/__init__.py +54 -0
  21. onearray-0.1.0a1/src/onearray/_backend.py +47 -0
  22. onearray-0.1.0a1/src/onearray/checks.py +208 -0
  23. onearray-0.1.0a1/src/onearray/convert.py +335 -0
  24. onearray-0.1.0a1/src/onearray/errors.py +13 -0
  25. onearray-0.1.0a1/src/onearray/fourier.py +265 -0
  26. onearray-0.1.0a1/src/onearray/math.py +102 -0
  27. onearray-0.1.0a1/src/onearray/shape.py +141 -0
  28. onearray-0.1.0a1/src/onearray/types.py +104 -0
  29. onearray-0.1.0a1/src/onearray/validation.py +415 -0
  30. onearray-0.1.0a1/src/onearray.egg-info/PKG-INFO +115 -0
  31. onearray-0.1.0a1/src/onearray.egg-info/SOURCES.txt +42 -0
  32. onearray-0.1.0a1/src/onearray.egg-info/dependency_links.txt +1 -0
  33. onearray-0.1.0a1/src/onearray.egg-info/requires.txt +18 -0
  34. onearray-0.1.0a1/src/onearray.egg-info/scm_file_list.json +39 -0
  35. onearray-0.1.0a1/src/onearray.egg-info/scm_version.json +8 -0
  36. onearray-0.1.0a1/src/onearray.egg-info/top_level.txt +1 -0
  37. onearray-0.1.0a1/tests/test_convert.py +102 -0
  38. onearray-0.1.0a1/tests/test_operations.py +52 -0
  39. onearray-0.1.0a1/tests/test_operations_torch.py +75 -0
  40. onearray-0.1.0a1/tests/test_public_api.py +52 -0
  41. onearray-0.1.0a1/tests/test_shape.py +59 -0
  42. onearray-0.1.0a1/tests/test_validation.py +88 -0
  43. onearray-0.1.0a1/tests/test_validation_torch.py +52 -0
  44. onearray-0.1.0a1/zensical.toml +402 -0
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,19 @@
1
+ name: Documentation check
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v7
15
+ - uses: actions/setup-python@v6
16
+ with:
17
+ python-version: "3.12"
18
+ - run: python -m pip install --editable ".[docs]"
19
+ - run: zensical build --clean
@@ -0,0 +1,26 @@
1
+ name: Documentation
2
+ on:
3
+ workflow_dispatch:
4
+ permissions:
5
+ contents: read
6
+ pages: write
7
+ id-token: write
8
+ jobs:
9
+ deploy:
10
+ environment:
11
+ name: github-pages
12
+ url: ${{ steps.deployment.outputs.page_url }}
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/configure-pages@v6
16
+ - uses: actions/checkout@v7
17
+ - uses: actions/setup-python@v6
18
+ with:
19
+ python-version: 3.x
20
+ - run: python -m pip install --editable ".[docs]"
21
+ - run: zensical build --clean
22
+ - uses: actions/upload-pages-artifact@v5
23
+ with:
24
+ path: site
25
+ - uses: actions/deploy-pages@v5
26
+ id: deployment
@@ -0,0 +1,21 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ lint:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v7
16
+ - uses: actions/setup-python@v6
17
+ with:
18
+ python-version: "3.12"
19
+ - run: python -m pip install --editable ".[lint]"
20
+ - run: python -m ruff check src tests
21
+ - run: python -m black --check src tests
@@ -0,0 +1,203 @@
1
+ name: Publish Python package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ lint:
14
+ name: Lint
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ - uses: actions/setup-python@v6
20
+ with:
21
+ python-version: "3.12"
22
+ - run: python -m pip install --editable ".[lint]"
23
+ - run: python -m ruff check src tests
24
+ - run: python -m black --check src tests
25
+
26
+ pytest:
27
+ name: Tests (${{ matrix.python-version }})
28
+ runs-on: ubuntu-latest
29
+ strategy:
30
+ matrix:
31
+ python-version: ["3.10", "3.12", "3.14"]
32
+
33
+ steps:
34
+ - uses: actions/checkout@v7
35
+ - uses: actions/setup-python@v6
36
+ with:
37
+ python-version: ${{ matrix.python-version }}
38
+ - run: python -m pip install --editable ".[test]"
39
+ - run: python -m pytest
40
+
41
+ pytest-torch:
42
+ name: Tests (PyTorch)
43
+ runs-on: ubuntu-latest
44
+ strategy:
45
+ matrix:
46
+ include:
47
+ - python: "3.10"
48
+ dependencies: '"numpy==1.23.0" "torch==2.0.0"'
49
+ - python: "3.12"
50
+ dependencies: 'numpy torch'
51
+
52
+ steps:
53
+ - uses: actions/checkout@v7
54
+ - uses: actions/setup-python@v6
55
+ with:
56
+ python-version: ${{ matrix.python }}
57
+ - run: python -m pip install ${{ matrix.dependencies }}
58
+ - run: python -m pip install --editable ".[test,torch]"
59
+ - run: python -m pytest
60
+
61
+ build:
62
+ name: Build distribution
63
+ needs: [lint, pytest, pytest-torch]
64
+ runs-on: ubuntu-latest
65
+
66
+ steps:
67
+ - name: Check out repository
68
+ uses: actions/checkout@v4
69
+ with:
70
+ fetch-depth: 0
71
+
72
+ - name: Set up Python
73
+ uses: actions/setup-python@v5
74
+ with:
75
+ python-version: "3.12"
76
+
77
+ - name: Validate SemVer release tag
78
+ if: github.event_name == 'release'
79
+ env:
80
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
81
+ run: |
82
+ python - <<'PY'
83
+ import os
84
+ import re
85
+
86
+ tag = os.environ["RELEASE_TAG"]
87
+ pattern = re.compile(
88
+ r"^v(0|[1-9][0-9]*)\."
89
+ r"(0|[1-9][0-9]*)\."
90
+ r"(0|[1-9][0-9]*)"
91
+ r"(?:-((?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)"
92
+ r"(?:\.(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*))?"
93
+ r"$"
94
+ )
95
+ if pattern.fullmatch(tag) is None:
96
+ raise SystemExit(
97
+ f"Release tag {tag!r} is not a PyPI-compatible SemVer 2.0.0 tag"
98
+ )
99
+ PY
100
+
101
+ - name: Install build tools
102
+ run: python -m pip install --upgrade build twine
103
+
104
+ - name: Build distribution
105
+ env:
106
+ SETUPTOOLS_SCM_OVERRIDES_FOR_ONEARRAY: >-
107
+ {local_scheme = "no-local-version-strict"}
108
+ run: python -m build
109
+
110
+ - name: Check distribution
111
+ run: python -m twine check dist/*
112
+
113
+ - name: Check PyPI version matches release tag
114
+ if: github.event_name == 'release'
115
+ env:
116
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
117
+ run: |
118
+ python - <<'PY'
119
+ import email.parser
120
+ import glob
121
+ import os
122
+ import zipfile
123
+
124
+ from packaging.version import Version
125
+
126
+ wheel, = glob.glob("dist/*.whl")
127
+ with zipfile.ZipFile(wheel) as archive:
128
+ metadata_path, = [
129
+ name for name in archive.namelist() if name.endswith(".dist-info/METADATA")
130
+ ]
131
+ metadata = email.parser.Parser().parsestr(
132
+ archive.read(metadata_path).decode("utf-8")
133
+ )
134
+
135
+ expected = str(Version(os.environ["RELEASE_TAG"].removeprefix("v")))
136
+ actual = metadata["Version"]
137
+ if actual != expected:
138
+ raise SystemExit(
139
+ f"Built distribution version {actual!r} does not match normalized tag {expected!r}"
140
+ )
141
+ print(f"Verified release version: {actual}")
142
+ PY
143
+
144
+ - name: Test installed wheel outside the checkout
145
+ run: |
146
+ python -m pip install dist/*.whl numpy pytest torch
147
+ cp -r tests "$RUNNER_TEMP/onearray-tests"
148
+ cd "$RUNNER_TEMP"
149
+ python -m pytest -c /dev/null onearray-tests
150
+
151
+ - name: Upload distribution artifacts
152
+ uses: actions/upload-artifact@v4
153
+ with:
154
+ name: python-package-distributions
155
+ path: dist/
156
+
157
+ publish-testpypi:
158
+ name: Publish to TestPyPI
159
+ if: github.event_name == 'workflow_dispatch'
160
+ needs: build
161
+ runs-on: ubuntu-latest
162
+
163
+ environment:
164
+ name: testpypi
165
+ url: https://test.pypi.org/p/onearray
166
+
167
+ permissions:
168
+ id-token: write
169
+
170
+ steps:
171
+ - name: Download distribution artifacts
172
+ uses: actions/download-artifact@v4
173
+ with:
174
+ name: python-package-distributions
175
+ path: dist/
176
+
177
+ - name: Publish to TestPyPI
178
+ uses: pypa/gh-action-pypi-publish@release/v1
179
+ with:
180
+ repository-url: https://test.pypi.org/legacy/
181
+
182
+ publish-pypi:
183
+ name: Publish to PyPI
184
+ if: github.event_name == 'release'
185
+ needs: build
186
+ runs-on: ubuntu-latest
187
+
188
+ environment:
189
+ name: pypi
190
+ url: https://pypi.org/p/onearray
191
+
192
+ permissions:
193
+ id-token: write
194
+
195
+ steps:
196
+ - name: Download distribution artifacts
197
+ uses: actions/download-artifact@v4
198
+ with:
199
+ name: python-package-distributions
200
+ path: dist/
201
+
202
+ - name: Publish to PyPI
203
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,41 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ pytest:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10", "3.12", "3.14"]
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ - uses: actions/setup-python@v6
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ - run: python -m pip install --editable ".[test]"
23
+ - run: python -m pytest
24
+
25
+ pytest-torch:
26
+ runs-on: ubuntu-latest
27
+ strategy:
28
+ matrix:
29
+ include:
30
+ - python: "3.10"
31
+ dependencies: '"numpy==1.23.0" "torch==2.0.0"'
32
+ - python: "3.12"
33
+ dependencies: 'numpy torch'
34
+ steps:
35
+ - uses: actions/checkout@v7
36
+ - uses: actions/setup-python@v6
37
+ with:
38
+ python-version: ${{ matrix.python }}
39
+ - run: python -m pip install ${{ matrix.dependencies }}
40
+ - run: python -m pip install --editable ".[test,torch]"
41
+ - run: python -m pytest
@@ -0,0 +1,181 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Cursor
177
+ # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
178
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
179
+ # refer to https://docs.cursor.com/context/ignore-files
180
+ .cursorignore
181
+ .cursorindexingignore
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0-alpha.1] - 2026-10-07
11
+
12
+ This is the first public alpha release of OneArray. Its API is intentionally
13
+ unstable while the project gathers feedback before `1.0.0`.
14
+
15
+ ### Added
16
+
17
+ - Backend-agnostic array creation and conversion for NumPy and PyTorch,
18
+ including explicit CPU and CUDA modes.
19
+ - Backend-preserving mathematical helpers: `sum`, `exp`, and `abs`.
20
+ - Fourier helpers: `fft`, `ifft`, `fftfreq`, `fftshift`, and `ifftshift`.
21
+ - Shape inference, dimensionality, length, validation, list-conversion,
22
+ axis-insertion, and zero-allocation helpers.
23
+ - Explicit contracts for supported scalar types, rectangular sequences,
24
+ dtype preservation, memory sharing, backend conversion, and FFT behavior.
25
+ - Test coverage across supported Python, NumPy, and PyTorch versions, including
26
+ tests against the installed wheel outside the source checkout.
27
+ - Online documentation and an automatically generated public API reference.
28
+
29
+ ### Changed
30
+
31
+ - Restricted number-like scalars to Python numeric and boolean scalars plus
32
+ NumPy numeric and boolean scalars. Other numeric implementations require
33
+ explicit conversion.
34
+ - Limited the package-root namespace to the supported primary API. Validation,
35
+ shape, and type helpers remain available from their documented submodules.
36
+
37
+ ### Fixed
38
+
39
+ - Preserved shapes when converting empty nested sequences to PyTorch tensors.
40
+ - Rejected scalar inputs consistently from the array-length helper.
41
+ - Treated empty numeric arrays and tensors as vacuously real for real-value
42
+ predicates.
43
+ - Validated FFT axes consistently and checked CUDA availability before creating
44
+ CUDA frequency arrays.
45
+ - Avoided unnecessary copies in `asarray` while rejecting unsafe shared-memory
46
+ conversions.
47
+
48
+ [Unreleased]: https://github.com/optimato/onearray/compare/v0.1.0-alpha.1...HEAD
49
+ [0.1.0-alpha.1]: https://github.com/optimato/onearray/releases/tag/v0.1.0-alpha.1
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marcello Fonda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: onearray
3
+ Version: 0.1.0a1
4
+ Summary: Backend-agnostic array utilities for NumPy and PyTorch.
5
+ License-Expression: MIT
6
+ Project-URL: Documentation, https://optimato.github.io/onearray/
7
+ Project-URL: Repository, https://github.com/optimato/onearray
8
+ Project-URL: Issues, https://github.com/optimato/onearray/issues
9
+ Project-URL: Changelog, https://github.com/optimato/onearray/blob/main/CHANGELOG.md
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Provides-Extra: numpy
14
+ Requires-Dist: numpy>=1.23; extra == "numpy"
15
+ Provides-Extra: torch
16
+ Requires-Dist: torch>=2; extra == "torch"
17
+ Provides-Extra: test
18
+ Requires-Dist: numpy>=1.23; extra == "test"
19
+ Requires-Dist: pytest>=8; extra == "test"
20
+ Provides-Extra: lint
21
+ Requires-Dist: black==26.10.0; extra == "lint"
22
+ Requires-Dist: ruff==0.16.10; extra == "lint"
23
+ Provides-Extra: docs
24
+ Requires-Dist: zensical<0.1,>=0.0.66; extra == "docs"
25
+ Requires-Dist: mkdocstrings-python<3,>=2; extra == "docs"
26
+ Dynamic: license-file
27
+
28
+ # OneArray
29
+
30
+ [![Code style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
31
+ [![Lint](https://github.com/optimato/onearray/actions/workflows/lint.yml/badge.svg)](https://github.com/optimato/onearray/actions/workflows/lint.yml)
32
+ [![Tests](https://github.com/optimato/onearray/actions/workflows/tests.yml/badge.svg)](https://github.com/optimato/onearray/actions/workflows/tests.yml)
33
+ [![Documentation](https://img.shields.io/badge/docs-online-blue.svg)](https://optimato.github.io/onearray/)
34
+ [![Python](https://img.shields.io/badge/python-%E2%89%A53.10-blue.svg)](https://www.python.org/)
35
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
36
+
37
+ Backend-agnostic array utilities with a familiar NumPy-style API.
38
+
39
+ OneArray lets you write numerical code once and use it with either NumPy arrays
40
+ or PyTorch tensors. Operations dispatch from the input type and return values in
41
+ the same backend—there is no wrapper array class to learn.
42
+
43
+ ## Alpha status
44
+
45
+ `v0.1.0-alpha.1` is an early release intended to gather feedback. PyPI displays
46
+ this version in its normalized Python form, `0.1.0a1`. The most useful
47
+ reports cover API ergonomics, NumPy/PyTorch behavior differences, conversion
48
+ semantics, and operations you need but cannot express yet. Please report them
49
+ in [GitHub Issues](https://github.com/optimato/onearray/issues).
50
+
51
+ ## Installation
52
+
53
+ OneArray requires Python 3.10 or newer. Install it with the backend you need:
54
+
55
+ ```bash
56
+ pip install "onearray[numpy]"
57
+ pip install "onearray[torch]"
58
+ ```
59
+
60
+ To work on the project locally:
61
+
62
+ ```bash
63
+ git clone https://github.com/optimato/onearray.git
64
+ cd onearray
65
+ pip install -e ".[test]"
66
+ ```
67
+
68
+ ## Quick start
69
+
70
+ ```python
71
+ import onearray as oa
72
+
73
+ x_np = oa.array([1.0, 2.0, 3.0], mode="numpy")
74
+ x_torch = oa.array([1.0, 2.0, 3.0], mode="torch")
75
+
76
+ oa.exp(x_np) # numpy.ndarray
77
+ oa.exp(x_torch) # torch.Tensor
78
+ ```
79
+
80
+ Numerical operations do not silently move data between backends. Use `array`
81
+ or `asarray` when you explicitly want to create or convert an array:
82
+
83
+ ```python
84
+ x = oa.asarray([1, 2, 3], mode="numpy")
85
+ y = oa.fft(x)
86
+ values = oa.to_list(y)
87
+ ```
88
+
89
+ ## Features
90
+
91
+ - NumPy and PyTorch support, including CUDA tensors where PyTorch supports the operation
92
+ - Explicit array creation and conversion with `array` and `asarray`
93
+ - Backend-preserving math helpers: `sum`, `exp`, and `abs`
94
+ - Fourier helpers: `fft`, `ifft`, `fftfreq`, `fftshift`, and `ifftshift`
95
+ - Shape, axis, list-conversion, and zero-allocation helpers
96
+ - Validation for arrays, scalars, and rectangular nested sequences
97
+
98
+ ## Documentation
99
+
100
+ Read the full documentation at [optimato.github.io/onearray](https://optimato.github.io/onearray/).
101
+
102
+ OneArray follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).
103
+ Its public API and versioning policy are defined in the
104
+ [versioning documentation](https://optimato.github.io/onearray/versioning/),
105
+ and notable changes are recorded in the [changelog](CHANGELOG.md).
106
+
107
+ ## Running tests
108
+
109
+ ```bash
110
+ pytest
111
+ ```
112
+
113
+ ## License
114
+
115
+ OneArray is released under the [MIT License](LICENSE).