Thanks in advance for contributing to fathomnet-py! We appreciate your help in making this project better.
The FathomNet team welcomes contributions in the form of pull requests. If you're new to the project, you may want to start by reading the README to get an overview of the project.
For small changes (e.g., bug fixes), feel free to open a pull request right away. For larger changes, we recommend opening an issue first to discuss the proposed changes.
fathomnet-py is written in Python and uses the uv project management system. To contribute to fathomnet-py, you'll need to have Python 3.8 or later installed on your system. You can download Python from the official website.
To set up your development environment, follow these steps:
First, install uv by running the following command:
curl -LsSf https://astral.sh/uv/install.sh | shNext, clone the fathomnet-py repository to your local machine:
git clone git@github.com:fathomnet/fathomnet-py.gitNavigate to the project directory and install the project dependencies by running:
uv syncThis command will create a virtual environment at .venv and install the project dependencies. This will include the development dependencies needed to run the tests, build the documentation, lint, format, and manage the pre-commit hooks.
Activate the virtual environment by running:
. .venv/bin/activateThis will activate the virtual environment with the installed packages from the previous step.
Install the pre-commit hooks by running:
pre-commit installYou can run the pre-commit hooks at any time with:
pre-commit run [--all-files]Using the --all-files flag will run the pre-commit hooks on all files in the repository. If you don't use the flag, the pre-commit hooks will only run on the files you've staged for commit.
Now that you have your development environment set up, you can:
- Make changes to the code and run the code in a consistent environment.
- Run the tests.
- Build the documentation.
- Lint and format the code.
- Commit your changes.
To run the tests, use the following command:
pytestThis command will run the tests in the test directory.
To build the documentation, use the following command:
make -C docs htmlThis command builds the documentation using Sphinx. The documentation will be built in the docs/build/html directory.
To lint and format the code, run the pre-commit hooks:
pre-commit run --all-filesThe first step in the pre-commit hook is to lint the code using ruff. ruff is installed as a development dependency and is used to enforce code quality standards as well as format the code. If ruff finds any issues, it will print them to the console and exit with a non-zero status code.
If you want to automatically fix the issues printed in this stage, you can run:
ruff check --fixDoing this will automatically fix any issues that can be fixed automatically. If there are any issues that can't be fixed automatically, you'll need to fix them manually.