Thank you for considering contributing to nada-numpy
! There are two ways to contribute to nada-numpy
:
- Open issues to report bugs and typos, or to suggest new ideas.
- Submit a PR with a new feature or improvement.
To ensure a consistent development process, please follow the guidelines outlined below.
- All contributions must adhere to the project's coding standards. We enforce these standards using
pylint
for code quality andmypy
for type checking. - Before submitting your contributions, ensure that your code passes both
pylint
andmypy
checks. - These tools are also integrated into our CI/CD pipeline, and any PR will be automatically validated against these checks.
We recommend continuously running your code through pylint
and mypy
during the development process. These tools help identify potential issues early, enforce coding standards, and maintain type safety.
pip3 install black && isort
- Fork the repo
- Install from source the
nada-numpy
library:
cd nada-numpy
pip3 install -e .
The tests/nada-tests
folder contains the testing infrastructure for nada_numpy
. You will need to create one or more scripts to test your functionality. You can read the docs for more info about testing. Follow these steps for testing:
-
Add a script to
tests/nada-tests/nada-project.toml
. -
Place your test script in
tests/nada-tests/src/
, where it will verify the expected behavior. -
Generate the test file by running
nada generate-test --test-name <TEST_NAME> <PROGRAM>
and placing it in tests/nada-tests/tests/
.
- Finally, add the script to the
TESTS
array intests/test_all.py
to integrate it with the CI/CD pipeline.
Below we provide some hints on how to add new features. We give two examples: adding a NadaArray
method and adding a Rational
method.
As an example, we use the variance
operation to describe the development flow:
-
Integrate the variance function:
- In
nada_numpy/array.py
, integrate thevariance
method inside theNadaArray
class as a new member function. This will allow thevariance
to be called asarray.var()
.
- In
-
Add a Wrapper in
nada_numpy/funcs.py
:- In
nada-numpy
, functions can also be called in the formna.var(array)
. To support this, add a wrapper innada_numpy/funcs.py
. You can refer to the existing functions in this file to see how they simply wrap aroundarray.var()
in this context.
- In
As an example, we use the exponential exp
function to describe the development flow:
-
Integrate the exp function with Rational:
- In
nada_numpy/types.py
, integrate theexp
method inside both theRational
andSecretRational
classes as a new member function. This will allow theexp
to be called asvalue.exp()
.
- In
-
Integrate the exp function with NadaArray:
- In
nada_numpy/array.py
, integrate theexp
method inside theNadaArray
class as a new member function. This will allow theexp
to be called asarray.exp()
.
- In
-
Add a Wrapper in
nada_numpy/funcs.py
:- In
nada-numpy
, functions can also be called in the formna.exp(array)
. To support this, add a wrapper innada_numpy/funcs.py
. You can refer to the existing functions in this file to see how they simply wrap aroundarray.exp()
in this context.
- In
We actively welcome your pull requests. Please follow these steps to successfully submit a PR:
- Fork the repo and create your branch from
main
. - If you've added code that should be tested, add tests as explained above.
- Ensure that the test suite passes. Under
tests/nada-tests/tests/
run
nada test <TEST_NAME>
- Run from the root directory both
black . && isort .
- Ensure that your code passes both
pylint
andmypy
checks:
poetry run pylint
poetry run mypy
We use GitHub issues to report bugs and typos, or to suggest new ideas. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.
By contributing to nada-numpy
, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree.