How to Contribute#
Contributions to THzTools are welcome! Here are some ways you can contribute:
Create a discussion topic if you have an idea for a new feature or a general topic for discussion.
Create an issue if you find a bug with THzTools, an issue with its documentation, or have a suggestion for improving the package. New feature requests are also welcome!
If you would like to make improvements to the source code or documentation then you may do so directly by opening a pull request. Please review the following section for details about the development process.
Please review our code of conduct and follow the guidelines described there to help us maintain clear and respectful communication.
Development Process#
Please review the Contributing to a project instructions on GitHub if you would like to contribute to the THzTools code base and documentation.
Development Tools#
THzTools development relies on the following tools:
Unit tests: pytest
Code coverage: coverage
Documentation builder: Sphinx, using the PyData Sphinx Theme and the numpydoc extension
Documentation tests: doctest
Linter: ruff
Code format: black
Type checker: mypy
Configuration metadata for each of these tools is stored in pyproject.toml
.
Development Environment#
THzTools has been developed with the Hatch and Conda. Brief instructions for their installation and use are below.
Hatch#
Follow the instructions at this link to install Hatch.
Enter the environment by typing the following command from the top
directory of the project (ie, ~/thztools
):
hatch shell
This will update any changes to the dependencies and enable several script shortcuts that can be used for testing, linting, and building documentation.
To execute tests with pytest
:
hatch run test
To lint the code base with ruff
:
hatch fmt
To run type checking with mypy
:
hatch run lint:typing
To build the documentation with sphinx
and test examples with doctest
:
hatch run docs:build
To exit the hatch
environment:
exit
Conda#
Follow the instructions at this link to install Miniconda, a lightweight version of the Conda package and environment manager.
Create the environment by typing the following command from the top directory
of the project (ie, ~/thztools
). The first line of the
environment-dev.yml
file sets the environment name to thztools
, and the
last line uses pip
to install the thztools
package in
editable
mode for development.
conda env create -f envs/environment-dev.yml
To activate the thztools
environment:
conda activate thztools
To deactivate the environment when you are finished using thztools
:
conda deactivate
More detailed instructions on using Conda to manage environments are available here.