|
| 1 | +--- |
| 2 | +title: Contributing |
| 3 | +--- |
| 4 | + |
| 5 | +# 🍪 Contributing |
| 6 | +bigtree is a tree implementation package for Python. It integrates with Python lists, dictionaries, pandas and |
| 7 | +polars DataFrame. |
| 8 | + |
| 9 | +Thank you for taking the time to contribute. Contributing to this package is an excellent opportunity to dive into |
| 10 | +tree implementations. |
| 11 | + |
| 12 | +## Set Up |
| 13 | + |
| 14 | +First, [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and |
| 15 | +clone the forked repository. |
| 16 | + |
| 17 | +```console |
| 18 | +$ git clone git@github.com:<your-username>/bigtree.git |
| 19 | +``` |
| 20 | + |
| 21 | +Next, create a virtual environment and activate it. |
| 22 | + |
| 23 | +=== "conda" |
| 24 | + ```console |
| 25 | + $ conda create -n bigtree_venv python=3.10 |
| 26 | + $ conda activate bigtree_venv |
| 27 | + ``` |
| 28 | + |
| 29 | +=== "venv" |
| 30 | + ```console |
| 31 | + $ python -m venv .venv |
| 32 | + $ source .venv/bin/activate |
| 33 | + ``` |
| 34 | + |
| 35 | +To check if it worked, |
| 36 | + |
| 37 | +=== "conda" |
| 38 | + ```console |
| 39 | + $ which pip |
| 40 | + /<some directory>/envs/bigtree_venv/bin/pip |
| 41 | + ``` |
| 42 | + |
| 43 | +=== "venv" |
| 44 | + ```console |
| 45 | + $ which pip |
| 46 | + /<current directory>/.venv/bin/pip |
| 47 | + ``` |
| 48 | + |
| 49 | +From the project folder, install the required python packages locally in editable mode and set up pre-commit checks. |
| 50 | + |
| 51 | + $ python -m pip install -e ".[all]" |
| 52 | + $ python -m pip install pre-commit |
| 53 | + $ pre-commit install |
| 54 | + |
| 55 | +## Developing |
| 56 | + |
| 57 | +After making your changes, create a new branch, add and commit your changed files. |
| 58 | +In this example, let's assume the changed file is `README.md`. |
| 59 | +If there are any pre-commit changes or comments, do modify, re-add and re-commit your files. |
| 60 | + |
| 61 | +```console |
| 62 | +$ git checkout -b chore/update-readme |
| 63 | +$ git add README.md |
| 64 | +$ git commit -m "chore: updated README" |
| 65 | +``` |
| 66 | + |
| 67 | +Push your changes to your created branch and [create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your fork. |
| 68 | + |
| 69 | +```console |
| 70 | +$ git push origin chore/update-readme |
| 71 | +``` |
| 72 | + |
| 73 | +## Testing |
| 74 | + |
| 75 | +If there are changes related to code, make sure to add or update the tests accordingly. |
| 76 | +Run the following lines of code and ensure the <mark>unit tests pass</mark> and the |
| 77 | +<mark>code coverage is 100%</mark>. |
| 78 | + |
| 79 | +```console |
| 80 | +$ python -m pip install pytest coverage |
| 81 | +$ pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=bigtree |
| 82 | +``` |
| 83 | + |
| 84 | +## Documentation |
| 85 | + |
| 86 | +If there are changes related to code, make sure to add or update the documentations and docstrings accordingly. |
| 87 | + |
| 88 | +For documentation, `bigtree` uses [mkdocs](https://www.mkdocs.org) for documentation and previews can be viewed |
| 89 | +by running the following lines of code. |
| 90 | + |
| 91 | +```console |
| 92 | +$ python -m pip install hatch |
| 93 | +$ hatch run mkdocs:build |
| 94 | +$ hatch run mkdocs:serve |
| 95 | +``` |
| 96 | + |
| 97 | +For docstrings, ensure that the description is most updated and existing, added, or modified sample code examples |
| 98 | +in docstring still work. Run the following lines of code to generate the <mark>coverage report and test report for |
| 99 | +docstrings</mark>. Refer to the console log for information on the file location of the reports. |
| 100 | + |
| 101 | +```console |
| 102 | +$ python -m pip install hatch |
| 103 | +$ hatch run docs:coverage |
| 104 | +$ hatch run docs:doctest |
| 105 | +``` |
| 106 | + |
| 107 | +## Consequent Changes |
| 108 | + |
| 109 | +Please [open an issue](https://github.com/kayjan/bigtree/issues/new/choose) to discuss important changes before |
| 110 | +embarking on an implementation. |
0 commit comments