|
| 1 | +# Contributing |
| 2 | + |
| 3 | +<details> |
| 4 | +<summary>Table of Contents</summary> |
| 5 | + |
| 6 | +- [Fork](#fork) |
| 7 | +- [Install](#install) |
| 8 | +- [Develop](#develop) |
| 9 | +- [Test](#test) |
| 10 | +- [Lint](#lint) |
| 11 | +- [Release](#release) |
| 12 | + |
| 13 | +</details> |
| 14 | + |
| 15 | +Pull requests are welcome! By participating in this project, you agree to abide by our [code of conduct](https://github.com/remarkablemark/.github/blob/master/CODE_OF_CONDUCT.md). |
| 16 | + |
| 17 | +## Fork |
| 18 | + |
| 19 | +[Fork](https://github.com/remarkablemark/python_package_template/fork) and then clone the repository: |
| 20 | + |
| 21 | +```sh |
| 22 | +# replace <USER> with your username |
| 23 | +git clone git@github.com:<USER>/python_package_template.git |
| 24 | +``` |
| 25 | + |
| 26 | +```sh |
| 27 | +cd python_package_template |
| 28 | +``` |
| 29 | + |
| 30 | +## Install |
| 31 | + |
| 32 | +Install [Python](https://www.python.org/): |
| 33 | + |
| 34 | +```sh |
| 35 | +brew install python |
| 36 | +``` |
| 37 | + |
| 38 | +Create the virtual environment: |
| 39 | + |
| 40 | +```sh |
| 41 | +python3 -m venv .venv |
| 42 | +``` |
| 43 | + |
| 44 | +Activate the virtual environment: |
| 45 | + |
| 46 | +```sh |
| 47 | +source .venv/bin/activate |
| 48 | +``` |
| 49 | + |
| 50 | +Install the dependencies: |
| 51 | + |
| 52 | +```sh |
| 53 | +pip install -e '.[test]' |
| 54 | +``` |
| 55 | + |
| 56 | +Install pre-commit into your git hooks: |
| 57 | + |
| 58 | +```sh |
| 59 | +pre-commit install |
| 60 | +``` |
| 61 | + |
| 62 | +## Develop |
| 63 | + |
| 64 | +Make your changes, add tests/documentation, and ensure tests pass: |
| 65 | + |
| 66 | +```sh |
| 67 | +pytest |
| 68 | +``` |
| 69 | + |
| 70 | +Write a commit message that follows the [Conventional Commits](https://www.conventionalcommits.org/) specification: |
| 71 | + |
| 72 | +- **feat**: A new feature |
| 73 | +- **fix**: A bug fix |
| 74 | +- **perf**: A code change that improves performance |
| 75 | +- **refactor**: A code change that neither fixes a bug nor adds a feature |
| 76 | +- **test**: Add missing tests or correct existing tests |
| 77 | +- **build**: Changes that affect the build system or external dependencies |
| 78 | +- **ci**: Updates configuration files and scripts for continuous integration |
| 79 | +- **docs**: Documentation only changes |
| 80 | + |
| 81 | +Push to your fork and create a [pull request](https://github.com/remarkablemark/python_package_template/compare/). |
| 82 | + |
| 83 | +At this point, wait for us to review your pull request. We'll try to review pull requests within 1-3 business days. We may suggest changes, improvements, and/or alternatives. |
| 84 | + |
| 85 | +Things that will improve the chance that your pull request will be accepted: |
| 86 | + |
| 87 | +- [ ] Write tests that pass [CI](https://github.com/remarkablemark/python_package_template/actions/workflows/test.yml). |
| 88 | +- [ ] Write solid documentation. |
| 89 | +- [ ] Write a good [commit message](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit). |
| 90 | + |
| 91 | +## Test |
| 92 | + |
| 93 | +Run tests: |
| 94 | + |
| 95 | +```sh |
| 96 | +pytest |
| 97 | +``` |
| 98 | + |
| 99 | +## Build |
| 100 | + |
| 101 | +Generate distribution packages: |
| 102 | + |
| 103 | +```sh |
| 104 | +python3 -m build |
| 105 | +``` |
| 106 | + |
| 107 | +Upload all of the archives under `dist`: |
| 108 | + |
| 109 | +```sh |
| 110 | +twine upload --repository testpypi dist/* |
| 111 | +``` |
| 112 | + |
| 113 | +Install the package: |
| 114 | + |
| 115 | +```sh |
| 116 | +pip install --index-url https://test.pypi.org/simple/ --no-deps python_package_template |
| 117 | +``` |
| 118 | + |
| 119 | +## Release |
| 120 | + |
| 121 | +Release and publish are automated with [Release Please](https://github.com/googleapis/release-please). |
0 commit comments