Skip to content

Commit 3819b81

Browse files
authored
Chore/Rename Nada Algebra to Nada Numpy (#35)
* chore!: renamed nada_algebra to nada_numpy * chore: changed target pypi repository to Nillion
1 parent 365a277 commit 3819b81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+248
-225
lines changed

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ jobs:
2929
run: poetry build
3030
- name: Publish package
3131
run: |
32-
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
32+
poetry config pypi-token.pypi ${{ secrets.NILLION_PYPI_TOKEN }}
3333
poetry publish

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
33

4-
name: Test Nada Algebra
4+
name: Test Nada Numpy
55

66
on:
77
push:
@@ -24,9 +24,9 @@ jobs:
2424
pip install poetry
2525
poetry install --with dev
2626
- name: Run pylint
27-
run: poetry run pylint nada_algebra
27+
run: poetry run pylint nada_numpy
2828
- name: Run mypy
29-
run: poetry run mypy nada_algebra
29+
run: poetry run mypy nada_numpy
3030

3131
build:
3232
needs: check-linting

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Nada-Algebra
1+
# Nada-Numpy
22

3-
![GitHub License](https://img.shields.io/github/license/NillionNetwork/nada-algebra?style=for-the-badge)
4-
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/NillionNetwork/nada-algebra/test?style=for-the-badge)
3+
![GitHub License](https://img.shields.io/github/license/NillionNetwork/nada-numpy?style=for-the-badge)
4+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/NillionNetwork/nada-numpy/test?style=for-the-badge)
55

66

7-
Nada-Algebra is a Python library designed for algebraic operations on NumPy-like array objects on top of Nada DSL and Nillion Network. It provides a simple and intuitive interface for performing various algebraic computations, including dot products, element-wise operations, and stacking operations, while supporting broadcasting similar to NumPy arrays.
7+
Nada-Numpy is a Python library designed for algebraic operations on NumPy-like array objects on top of Nada DSL and Nillion Network. It provides a simple and intuitive interface for performing various algebraic computations, including dot products, element-wise operations, and stacking operations, while supporting broadcasting similar to NumPy arrays.
88

99
## Features
1010

@@ -19,16 +19,24 @@ Nada-Algebra is a Python library designed for algebraic operations on NumPy-like
1919
### Using pip
2020

2121
```bash
22-
pip install nada-algebra
22+
pip install nada-numpy
2323
```
2424

2525
### From Sources
26-
You can install the nada-algebra library using Poetry:
26+
You can install the nada-numpy library using Poetry:
2727

2828
```bash
29-
git clone https://github.com/NillionNetwork/nada-algebra.git
30-
pip3 install poetry
31-
poetry install nada-algebra
29+
git clone https://github.com/NillionNetwork/nada-numpy.git
30+
pip3 install ./nada-numpy
31+
```
32+
33+
## Testing
34+
35+
To test that the version installed works as expected, you can use poetry as follows:
36+
37+
```bash
38+
poetry install
39+
poetry run pytest
3240
```
3341

3442
## License

examples/broadcasting/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# Broadcasting Tutorial
22

3-
This tutorial shows how to efficiently use broadcasting in Nada using Nada Algebra.
3+
This tutorial shows how to efficiently use broadcasting in Nada using Nada Numpy.
44

55
```python
66
from nada_dsl import *
77

8-
# Step 0: Nada Algebra is imported with this line
9-
import nada_algebra as na
8+
# Step 0: Nada Numpy is imported with this line
9+
import nada_numpy as na
1010

1111

1212
def nada_main():
13-
# Step 1: We use Nada Algebra wrapper to create "Party0", "Party1" and "Party2"
13+
# Step 1: We use Nada Numpy wrapper to create "Party0", "Party1" and "Party2"
1414
parties = na.parties(3)
1515

1616
# Step 2: Party0 creates an array of dimension (3, ) with name "A"
17-
a = na.array([3], parties[0], "A")
17+
a = na.array([3], parties[0], "A", SecretInteger)
1818

1919
# Step 3: Party1 creates an array of dimension (3, ) with name "B"
20-
b = na.array([3], parties[1], "B")
20+
b = na.array([3], parties[1], "B", SecretInteger)
2121

2222
# Step 4: Party0 creates an array of dimension (3, ) with name "C"
23-
c = na.array([3], parties[0], "C")
23+
c = na.array([3], parties[0], "C", SecretInteger)
2424

2525
# Step 5: Party1 creates an array of dimension (3, ) with name "D"
26-
d = na.array([3], parties[1], "D")
26+
d = na.array([3], parties[1], "D", SecretInteger)
2727

2828
# Step 4: The result is of computing SIMD operations on top of the elements of the array
2929
# SIMD operations are performed on all the elements of the array.
@@ -33,13 +33,13 @@ def nada_main():
3333
return result.output(parties[2], "my_output")
3434
```
3535

36-
0. We import Nada algebra using `import nada_algebra as na`.
36+
0. We import Nada Numpy using `import nada_numpy as na`.
3737
1. We create an array of parties, with our wrapper using `parties = na.parties(3)` which creates an array of parties named: `Party0`, `Party1` and `Party2`.
3838
2. We create our input array `a` with `na.array([3], parties[0], "A")`, meaning our array will have dimension 3, `Party0` will be in charge of giving its inputs and the name of the variable is `"A"`.
3939
3. We create our input array `b` with `na.array([3], parties[1], "B")`, meaning our array will have dimension 3, `Party1` will be in charge of giving its inputs and the name of the variable is `"B"`.
4040
4. We create our input array `c` with `na.array([3], parties[1], "C")`, meaning our array will have dimension 3, `Party0` will be in charge of giving its inputs and the name of the variable is `"C"`.
4141
5. We create our input array `d` with `na.array([3], parties[1], "D")`, meaning our array will have dimension 3, `Party1` will be in charge of giving its inputs and the name of the variable is `"D"`.
42-
5. Finally, we use Nada Algebra to produce the outputs of the array like: `result.output(parties[2], "my_output")` establishing that the output party will be `Party2`and the name of the output variable will be `my_output`.
42+
5. Finally, we use Nada Numpy to produce the outputs of the array like: `result.output(parties[2], "my_output")` establishing that the output party will be `Party2`and the name of the output variable will be `my_output`.
4343
# How to run the tutorial.
4444

4545
1. First, we need to compile the nada program running: `nada build`.

examples/broadcasting/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
import py_nillion_client as nillion
88
from dotenv import load_dotenv
99

10-
import nada_algebra.client as na_client
10+
import nada_numpy.client as na_client
11+
1112
# Import helper functions for creating nillion client and getting keys
1213
from examples.broadcasting.config import DIM
1314
from examples.common.nillion_client_helper import create_nillion_client
14-
from examples.common.nillion_keypath_helper import (getNodeKeyFromFile,
15-
getUserKeyFromFile)
15+
from examples.common.nillion_keypath_helper import (
16+
getNodeKeyFromFile,
17+
getUserKeyFromFile,
18+
)
1619
from examples.common.utils import compute, store_program, store_secrets
1720

1821
# Load environment variables from a .env file

examples/broadcasting/src/broadcasting.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
from nada_dsl import Output, SecretInteger
66

7-
import nada_algebra as na
7+
# Step 0: Nada Numpy is imported with this line
8+
import nada_numpy as na
89

910

1011
def nada_main() -> List[Output]:
@@ -14,7 +15,7 @@ def nada_main() -> List[Output]:
1415
Returns:
1516
List[Output]: List of Nada outputs.
1617
"""
17-
# Step 1: We use Nada Algebra wrapper to create "Party0", "Party1" and "Party2"
18+
# Step 1: We use Nada Numpy wrapper to create "Party0", "Party1" and "Party2"
1819
parties = na.parties(3)
1920

2021
# Step 2: Party0 creates an array of dimension (3, ) with name "A"

examples/common/nillion_payments_helper.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/common/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import numpy as np
88
import py_nillion_client as nillion
99

10-
import nada_algebra.client as na_client
10+
import nada_numpy.client as na_client
1111

1212

1313
def async_timer(file_path: os.PathLike) -> Callable:

examples/dot_product/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Dot Product Tutorial
22

3-
This tutorial shows how to efficiently program a dot product in Nada using Nada Algebra.
3+
This tutorial shows how to efficiently program a dot product in Nada using Nada Numpy.
44

55
```python
66
from nada_dsl import *
77

8-
# Step 0: Nada Algebra is imported with this line
9-
import nada_algebra as na
8+
# Step 0: Nada Numpy is imported with this line
9+
import nada_numpy as na
1010

1111

1212
def nada_main():
13-
# Step 1: We use Nada Algebra wrapper to create "Party0", "Party1" and "Party2"
13+
# Step 1: We use Nada Numpy wrapper to create "Party0", "Party1" and "Party2"
1414
parties = na.parties(3)
1515

1616
# Step 2: Party0 creates an array of dimension (3, ) with name "A"
@@ -24,15 +24,14 @@ def nada_main():
2424

2525
# Step 5: We can use result.output() to produce the output for Party2 and variable name "my_output"
2626
return na.output(result, parties[1], "my_output")
27-
2827
```
2928

30-
0. We import Nada algebra using `import nada_algebra as na`.
29+
0. We import Nada Numpy using `import nada_numpy as na`.
3130
1. We create an array of parties, with our wrapper using `parties = na.parties(3)` which creates an array of parties named: `Party0`, `Party1` and `Party2`.
3231
2. We create our input array `a` with `na.array([3], parties[0], "A")`, meaning our array will have dimension 3, `Party0` will be in charge of giving its inputs and the name of the variable is `"A"`.
3332
3. We create our input array `b` with `na.array([3], parties[1], "B")`, meaning our array will have dimension 3, `Party1` will be in charge of giving its inputs and the name of the variable is `"B"`.
3433
4. Then, we use the `dot` function to compute the dot product like `a.dot(b)`, which will encompass all the functionality.
35-
5. Finally, we use Nada Algebra to produce the outputs of the array like: `result.output(parties[2], "my_output")` establishing that the output party will be `Party2`and the name of the output variable will be `my_output`.
34+
5. Finally, we use Nada Numpy to produce the outputs of the array like: `result.output(parties[2], "my_output")` establishing that the output party will be `Party2`and the name of the output variable will be `my_output`.
3635
# How to run the tutorial.
3736

3837
1. First, we need to compile the nada program running: `nada build`.

examples/dot_product/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
import py_nillion_client as nillion
99
from dotenv import load_dotenv
1010

11-
import nada_algebra.client as na_client
11+
import nada_numpy.client as na_client
12+
1213
# Import helper functions for creating nillion client and getting keys
1314
from examples.common.nillion_client_helper import create_nillion_client
14-
from examples.common.nillion_keypath_helper import (getNodeKeyFromFile,
15-
getUserKeyFromFile)
15+
from examples.common.nillion_keypath_helper import (
16+
getNodeKeyFromFile,
17+
getUserKeyFromFile,
18+
)
1619
from examples.common.utils import compute, store_program, store_secrets
1720
from examples.dot_product.config import DIM
1821

examples/dot_product/src/dot_product.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
from nada_dsl import Output, SecretInteger
66

7-
import nada_algebra as na
7+
# Step 0: Nada Numpy is imported with this line
8+
import nada_numpy as na
89

910

1011
def nada_main() -> List[Output]:
@@ -14,7 +15,7 @@ def nada_main() -> List[Output]:
1415
Returns:
1516
List[Output]: List of program outputs.
1617
"""
17-
# Step 1: We use Nada Algebra wrapper to create "Party0", "Party1" and "Party2"
18+
# Step 1: We use Nada Numpy wrapper to create "Party0", "Party1" and "Party2"
1819
parties = na.parties(3)
1920

2021
# Step 2: Party0 creates an array of dimension (3, ) with name "A"

examples/matrix_multiplication/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# Matrix Multiplication Tutorial
22

3-
This tutorial shows how to efficiently program a matrix multiplication in Nada using Nada Algebra.
3+
This tutorial shows how to efficiently program a matrix multiplication in Nada using Nada Numpy.
44

55
```python
66
from nada_dsl import *
7-
# Step 0: Nada Algebra is imported with this line
8-
import nada_algebra as na
7+
8+
# Step 0: Nada Numpy is imported with this line
9+
import nada_numpy as na
910

1011

1112
def nada_main():
12-
# Step 1: We use Nada Algebra wrapper to create "Party0", "Party1" and "Party2"
13+
# Step 1: We use Nada Numpy wrapper to create "Party0", "Party1" and "Party2"
1314
parties = na.parties(3)
1415

1516
# Step 2: Party0 creates an array of dimension (3 x 3) with name "A"
16-
a = na.array([3, 3], parties[0], "A")
17+
a = na.array([3, 3], parties[0], "A", SecretInteger)
1718

1819
# Step 3: Party1 creates an array of dimension (3 x 3) with name "B"
19-
b = na.array([3, 3], parties[1], "B")
20+
b = na.array([3, 3], parties[1], "B", SecretInteger)
2021

2122
# Step 4: The result is of computing the dot product between the two which is another (3 x 3) matrix
2223
result = a @ b
@@ -26,12 +27,12 @@ def nada_main():
2627

2728
```
2829

29-
0. We import Nada algebra using `import nada_algebra as na`.
30+
0. We import Nada Numpy using `import nada_numpy as na`.
3031
1. We create an array of parties, with our wrapper using `parties = na.parties(3)` which creates an array of parties named: `Party0`, `Party1` and `Party2`.
3132
2. We create our input array `a` with `na.array([3], parties[0], "A")`, meaning our array will have dimension 3, `Party0` will be in charge of giving its inputs and the name of the variable is `"A"`.
3233
3. We create our input array `b` with `na.array([3], parties[1], "B")`, meaning our array will have dimension 3, `Party1` will be in charge of giving its inputs and the name of the variable is `"B"`.
3334
4. Then, we use the `dot` function to compute the dot product like `a.dot(b)`, which will encompass all the functionality.
34-
5. Finally, we use Nada Algebra to produce the outputs of the array like: `result.output(parties[2], "my_output")` establishing that the output party will be `Party2`and the name of the output variable will be `my_output`.
35+
5. Finally, we use Nada Numpy to produce the outputs of the array like: `result.output(parties[2], "my_output")` establishing that the output party will be `Party2`and the name of the output variable will be `my_output`.
3536

3637
# How to Run the Tutorial
3738

examples/matrix_multiplication/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
import py_nillion_client as nillion
99
from dotenv import load_dotenv
1010

11-
import nada_algebra.client as na_client
11+
import nada_numpy.client as na_client
12+
1213
# Import helper functions for creating nillion client and getting keys
1314
from examples.common.nillion_client_helper import create_nillion_client
14-
from examples.common.nillion_keypath_helper import (getNodeKeyFromFile,
15-
getUserKeyFromFile)
15+
from examples.common.nillion_keypath_helper import (
16+
getNodeKeyFromFile,
17+
getUserKeyFromFile,
18+
)
1619
from examples.common.utils import compute, store_program, store_secrets
1720
from examples.matrix_multiplication.config import DIM
1821

examples/matrix_multiplication/src/matrix_multiplication.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
from nada_dsl import Output, SecretInteger
66

7-
import nada_algebra as na
7+
# Step 0: Nada Numpy is imported with this line
8+
import nada_numpy as na
89

910

1011
def nada_main() -> List[Output]:
@@ -14,7 +15,7 @@ def nada_main() -> List[Output]:
1415
Returns:
1516
List[Output]: List of program outputs.
1617
"""
17-
# Step 1: We use Nada Algebra wrapper to create "Party0", "Party1" and "Party2"
18+
# Step 1: We use Nada Numpy wrapper to create "Party0", "Party1" and "Party2"
1819
parties = na.parties(3)
1920

2021
# Step 2: Party0 creates an array of dimension (3 x 3) with name "A"

0 commit comments

Comments
 (0)