Skip to content

Commit 94ebafa

Browse files
roaffixAnton
and
Anton
authored
[Data API] Array Object Implementation (#261)
* Refactoring of basic functionality to create an empty Array * Replace dim4 with CShape * Add tests for array api. Minor fixes. Update CI * Add arithmetic operators w/o tests * Fix array init bug. Add __getitem__. Change pytest for active debug mode * Add reflected arithmetic and array operators * Place TODO for repr * Add bitwise operators. Add in-place operators. Add missing reflected operators * Add tests for arithmetic operators * Added to_list and to_ctypes_array * Fix bug when scalar is empty returns None * Fix typing in array object. Add tests * Change tests and found bug with reflected operators * Fix reflected operators bug. Add test coverage for the rest of the arithmetic operators * Add required by specification methods * Change utils. Add docstrings * Add docstrings for operators * Add docstrings for other operators. Remove docstrings from mocks * Change tags and typings * Change typings from python 3.10 to python 3.8 * Add readme with reference to run tests * Revert changes accidentally made in original array * Add constructor initialization warning. Add Note on deviation from spec. Dump minimal numpy version required. * Fix warning messages for non-standard functions * Add NOTE tag to functions that are not a part of spec but custom solutions --------- Co-authored-by: Anton <[email protected]>
1 parent 33b0558 commit 94ebafa

16 files changed

+1773
-9
lines changed

.github/workflows/build.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v1
11+
12+
- name: Set up Python 3.10
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: "3.10"
16+
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install -r requirements.txt
21+
22+
- name: Test with pytest
23+
run: pytest
24+
25+
- name: Install AF
26+
run: apt install arrayfire
27+
28+
- name: Test array_api
29+
run: python -m pytest arrayfire/array_api

.gitignore

+6-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ htmlcov/
4242
nosetests.xml
4343
coverage.xml
4444
*,cover
45+
.pytest_cache
4546

4647
# Translations
4748
*.mo
@@ -56,6 +57,8 @@ docs/_build/
5657
# PyBuilder
5758
target/
5859

59-
# IDE
60-
.idea
61-
.vscode
60+
# mypy
61+
.mypy_cache
62+
63+
# Virtual environment
64+
venv

arrayfire/array_api/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ArrayFire ArrayAPI
2+
3+
Specification Documentation: [source](https://data-apis.org/array-api/latest/purpose_and_scope.html)
4+
5+
Run tests
6+
7+
```bash
8+
python -m pytest arrayfire/array_api
9+
```

arrayfire/array_api/__init__.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__all__ = [
2+
# array objects
3+
"Array",
4+
# dtypes
5+
"int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float32", "float64",
6+
"complex64", "complex128", "bool"]
7+
8+
from .array_object import Array
9+
from .dtypes import bool, complex64, complex128, float32, float64, int16, int32, int64, uint8, uint16, uint32, uint64

0 commit comments

Comments
 (0)