Copyright 2024 National Technology & Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
U.S. Government retains certain rights in this software.
If you are looking to get started or want to propose a change please start by checking current or filing a new issue.
-
Clone your fork and enter the directory
git clone [email protected]:<your username>/pyttb.git cd pyttb
- Setup your desired python environment as appropriate
-
Install dependencies
Most changes only require dev options
pip install -e ".[dev]"
But if you are making larger interface changes or updating tutorials/documentation you can also add the required packages for documentation.
pip install -e ".[dev,doc]"
-
Checkout a branch and make your changes
git checkout -b my-new-feature-branch
-
Formatters and linting
- Run autoformatters and linting from root of project (they will change your code)
ruff check . --fix ruff format
- Ruff's
--fix
won't necessarily address everything and may point out issues that need manual attention - We optionally support pre-commit hooks for this
- Alternatively, you can run
pre-commit run --all-files
from the command line if you don't want to install the hooks.
- Alternatively, you can run
- Ruff's
- Check typing
mypy pyttb/
- Run autoformatters and linting from root of project (they will change your code)
-
Run tests (at desired fidelity)
- Just doctests (enabled by default)
pytest .
- Functional tests
pytest tests
- With coverage
pytest tests --cov=pyttb --cov-report=term-missing
- Just doctests (enabled by default)
-
(Optionally) Building documentation and tutorials
- From project root
sphinx-build ./docs/source ./docs/build
- Clear notebook outputs if run locally see
nbstripout
in our pre-commit configuration
If you want to propose a change to Python Tensor Toolbox, follow these steps:
-
Create an Issue
- Use the Issues tab of the Python Tensor Toolbox GitHub repository and click on the "New issue" button.
-
Fork the Repository and Create a New Branch
- Navigate to the main page of the Python Tensor Toolbox GitHub repository and click on the "Fork" button to create a copy of the repository under your own account.
- Clone the forked repository to your local machine.
- In your local repository, create a new branch for your proposed changes.
-
Update the Code
- Make the necessary updates in your local environment.
- After making your changes, stage and commit them with an informative message.
-
Push your Changes and Create a Pull Request
- Push your changes to the new branch in your fork of the repository.
- Navigate to the main page of the Python Tensor Toolbox repository and click on the "New pull request" button.
- In the "base repository" dropdown, select the original Python Tensor Toolbox repository. In the "base" dropdown, select the branch where you want your changes to be merged.
- In the "head repository" dropdown, select your forked repository. In the "compare" dropdown, select the branch with your changes.
- Write a title and description for your pull request.
-
Review Process
- After creating a pull request, wait for the Github CI tests to pass.
- If any test fails, review your code, make necessary changes, and push your code again to the same branch in your forked repository.
- If there are any comments or requested changes from the Python Tensor Toolbox team, address them and push any additional changes to the same branch.
- Once your changes are approved, a repository admin will merge your pull request.