Software organization¶
Directory Structure¶
With our main directory GradDog, our package is organized as follows:
dependencies in
requirements.txtworkflow for continuous integration via
GitHub Actionsand code coverage report viaCodeCovin.github\workflow\python-package.ymldocumentation in
\docstest suite in
\testscode in
\graddogimages in
\images
Basic Modules¶
For users:
Our code consists of 3 user-facing modules:
graddog, defining thetracefunction used to return derivativesgraddog.functions, definining elementary functions that are compatible with the trace function.graddog.tools, defining user-facing tools to do common calculations of scalar functions
For developers:
Our code consists of 5 total modules:
__init__.py, defining the trace function that allows the user to take derivatives of python functionstrace.py, defining the Trace class that stores the information for an individual trace elementcompgraph.py, defining the CompGraph class that creates a computational graph keeping track of the elements in relation to one anotherfunctions.py, defining elementary functions that users can usemath.py, defining the mathematical rules (for computing values, first-derivatives, and second-derivatives) of all functions implemented in our librarytools.py, defining user-facing tools to do common calculations of scalar functions
How to Test¶
We used GitHub Actions for continuous integration and CodeCov for code coverage reports. Our test suite will live inside our repo in a \tests directory. Our project currently has 98% coverage. In order to run the tests locally after installing the repository, run the following command in your terminal while being in the root directory:
pytest
If you want to see code coverage, run the following commands in your terminal:
pip install pytest-cov
pytest --cov-report term --cov=graddog tests/