|
| 1 | +# Maintainers Guide |
| 2 | + |
| 3 | +This document describes tools, tasks and workflow that one needs to be familiar with in order to effectively maintain |
| 4 | +this project. If you use this package within your own software as is but don't plan on modifying it, this guide is |
| 5 | +**not** for you. |
| 6 | + |
| 7 | +## Tools |
| 8 | + |
| 9 | +### Python (and friends) |
| 10 | + |
| 11 | +We recommend using [pyenv](https://github.com/pyenv/pyenv) for Python runtime management. If you use macOS, follow the following steps: |
| 12 | + |
| 13 | +```zsh |
| 14 | +brew update |
| 15 | +brew install pyenv |
| 16 | +``` |
| 17 | + |
| 18 | +Install necessary Python runtimes for development/testing. You can rely on GitHub Actions for testing with various major versions. |
| 19 | + |
| 20 | +```zsh |
| 21 | +pyenv install -l | grep -v "-e[conda|stackless|pypy]" |
| 22 | + |
| 23 | +pyenv install 3.8.5 # select the latest patch version |
| 24 | +pyenv local 3.8.5 |
| 25 | + |
| 26 | +pyenv versions |
| 27 | + system |
| 28 | + 3.6.10 |
| 29 | + 3.7.7 |
| 30 | +* 3.8.5 (set by /path-to-python-slack-hooks/.python-version) |
| 31 | + |
| 32 | +pyenv rehash |
| 33 | +``` |
| 34 | + |
| 35 | +Then, you can create a new Virtual Environment this way: |
| 36 | + |
| 37 | +```zsh |
| 38 | +python -m venv env_3.8.5 |
| 39 | +source env_3.8.5/bin/activate |
| 40 | +``` |
| 41 | + |
| 42 | +## Tasks |
| 43 | + |
| 44 | +### Testing |
| 45 | + |
| 46 | +#### Run All the Unit Tests |
| 47 | + |
| 48 | +If you make some changes to this project, please write corresponding unit tests as much as possible. You can easily run all the tests by running the following scripts. |
| 49 | + |
| 50 | +If this is your first time to run tests, although it may take a bit longer, running the following script is the easiest. |
| 51 | + |
| 52 | +```zsh |
| 53 | +./scripts/install_and_run_tests.sh |
| 54 | +``` |
| 55 | + |
| 56 | +To simply install all the development dependencies for this project. |
| 57 | + |
| 58 | +```zsh |
| 59 | +./scripts/install.sh |
| 60 | +``` |
| 61 | + |
| 62 | +Once you installed all the required dependencies, you can use the following. |
| 63 | + |
| 64 | +```zsh |
| 65 | +./scripts/run_tests.sh |
| 66 | +./scripts/run_tests.sh tests/scenario_test/test_get_hooks.py |
| 67 | +``` |
| 68 | + |
| 69 | +To format this project |
| 70 | + |
| 71 | +```zsh |
| 72 | +./scripts/format.sh |
| 73 | +``` |
| 74 | + |
| 75 | +To lint this project |
| 76 | + |
| 77 | +```zsh |
| 78 | +./scripts/lint.sh |
| 79 | +``` |
| 80 | + |
| 81 | +This project uses [pytype](https://google.github.io/pytype/) to check and infers types for your Python code. |
| 82 | + |
| 83 | +```zsh |
| 84 | +./scripts/run_pytype.sh |
| 85 | +``` |
| 86 | + |
| 87 | +#### Develop Locally |
| 88 | + |
| 89 | +If you want to test the package locally you can. |
| 90 | + |
| 91 | +1. Build the package locally |
| 92 | + - Run |
| 93 | + |
| 94 | + ```zsh |
| 95 | + scripts/build_pypi_package.sh |
| 96 | + ``` |
| 97 | + |
| 98 | + - This will create a `.whl` file in the `./dist` folder |
| 99 | +2. Use the built package |
| 100 | + - Example `/dist/slack_cli_hooks-1.2.3-py2.py3-none-any.whl` was created |
| 101 | + - From anywhere on your machine you can install this package to a project with |
| 102 | + |
| 103 | + ```zsh |
| 104 | + pip install <project path>/dist/slack_cli_hooks-1.2.3-py2.py3-none-any.whl |
| 105 | + ``` |
| 106 | + |
| 107 | +### Releasing |
| 108 | + |
| 109 | +#### test.pypi.org deployment |
| 110 | + |
| 111 | +It is possible to deploy this project on <https://test.pypi.org/> in order to try out packaging and deploy related changes |
| 112 | + |
| 113 | +```zsh |
| 114 | +./scripts/deploy_to_test_pypi.sh |
| 115 | +``` |
| 116 | + |
| 117 | +#### Development Deployment |
| 118 | + |
| 119 | +1. Create a branch in which the development release will live: |
| 120 | + - Bump the version number in adherence to [Semantic Versioning](http://semver.org/) and [Developmental Release](https://peps.python.org/pep-0440/#developmental-releases) in `slack_cli_hooks/version.py` |
| 121 | + - Example the current version is `1.2.3` a proper development bump would be `1.3.0.dev0` |
| 122 | + - `.dev` will indicate to pip that this is a [Development Release](https://peps.python.org/pep-0440/#developmental-releases) |
| 123 | + - Note that the `dev` version can be bumped in development releases: `1.3.0.dev0` -> `1.3.0.dev1` |
| 124 | + - Commit with a message including the new version number. For example `1.3.0.dev0` & Push the commit to a branch where the development release will live (create it if it does not exist) |
| 125 | + - `git checkout -b future-release` |
| 126 | + - `git commit -m 'version 1.3.0.dev0'` |
| 127 | + - `git push future-release` |
| 128 | + - Create a git tag for the release. For example `git tag v1.3.0.dev0`. |
| 129 | + - Push the tag up to github with `git push origin --tags` |
| 130 | + |
| 131 | +2. Distribute the release |
| 132 | + - Use the latest stable Python runtime |
| 133 | + - `python -m venv .venv` |
| 134 | + - `./scripts/deploy_to_prod_pypi.sh` |
| 135 | + - You do not need to create a GitHub release |
| 136 | + |
| 137 | +3. (Slack Internal) Communicate the release internally |
| 138 | + |
| 139 | +#### Production Deployment |
| 140 | + |
| 141 | +1. Create the commit for the release: |
| 142 | + - Bump the version number in adherence to [Semantic Versioning](http://semver.org/) in `slack_cli_hooks/version.py` |
| 143 | + - Commit with a message including the new version number. For example `1.2.3` & Push the commit to a branch and create a PR to sanity check. |
| 144 | + - `git checkout -b v1.2.3-release` |
| 145 | + - `git commit -m 'version 1.2.3'` |
| 146 | + - `git push {your-fork} v1.2.3-release` |
| 147 | + - Merge in release PR after getting an approval from at least one maintainer. |
| 148 | + - Create a git tag for the release. For example `git tag v1.2.3`. |
| 149 | + - Push the tag up to github with `git push origin --tags` |
| 150 | + |
| 151 | +2. Distribute the release |
| 152 | + - Use the latest stable Python runtime |
| 153 | + - `python -m venv .venv` |
| 154 | + - `./scripts/deploy_to_pypi_org.sh` |
| 155 | + - Create a GitHub release - <https://github.com/slackapi/python-slack-hooks/releases> |
| 156 | + |
| 157 | + ```markdown |
| 158 | + ## New Features |
| 159 | +
|
| 160 | + ### Awesome Feature 1 |
| 161 | +
|
| 162 | + Description here. |
| 163 | +
|
| 164 | + ### Awesome Feature 2 |
| 165 | +
|
| 166 | + Description here. |
| 167 | +
|
| 168 | + ## Changes |
| 169 | +
|
| 170 | + * #123 Make it better - thanks @SlackHQ |
| 171 | + * #123 Fix something wrong - thanks @seratch |
| 172 | + ``` |
| 173 | + |
| 174 | +3. (Slack Internal) Communicate the release internally |
| 175 | + - Include a link to the GitHub release |
| 176 | + |
| 177 | +4. (Slack Internal) Tweet by @SlackAPI |
| 178 | + - Not necessary for patch updates, might be needed for minor updates, definitely needed for major updates. Include a link to the GitHub release |
| 179 | + |
| 180 | +## Workflow |
| 181 | + |
| 182 | +### Versioning and Tags |
| 183 | + |
| 184 | +This project uses semantic versioning, expressed through the numbering scheme of |
| 185 | +[PEP-0440](https://www.python.org/dev/peps/pep-0440/). |
| 186 | + |
| 187 | +### Branches |
| 188 | + |
| 189 | +`main` is where active development occurs. Long running named feature branches are occasionally created for |
| 190 | +collaboration on a feature that has a large scope (because everyone cannot push commits to another person's open Pull |
| 191 | +Request). At some point in the future after a major version increment, there may be maintenance branches for older major |
| 192 | +versions. |
| 193 | +
|
| 194 | +### Issue Management |
| 195 | +
|
| 196 | +Labels are used to run issues through an organized workflow. Here are the basic definitions: |
| 197 | +
|
| 198 | +- `bug`: A confirmed bug report. A bug is considered confirmed when reproduction steps have been |
| 199 | + documented and the issue has been reproduced. |
| 200 | +- `enhancement`: A feature request for something this package might not already do. |
| 201 | +- `docs`: An issue that is purely about documentation work. |
| 202 | +- `tests`: An issue that is purely about testing work. |
| 203 | +- `discussion`: An issue that is purely meant to hold a discussion. Typically the maintainers are looking for feedback in this issues. |
| 204 | +- `question`: An issue that is like a support request because the user's usage was not correct. |
| 205 | + |
| 206 | +**Triage** is the process of taking new issues that aren't yet "seen" and marking them with a basic level of information |
| 207 | +with labels. An issue should have **one** of the following labels applied: `bug`, `enhancement`, `question`, |
| 208 | +`needs feedback`, `docs`, `tests`, or `discussion`. |
| 209 | +
|
| 210 | +Issues are closed when a resolution has been reached. If for any reason a closed issue seems relevant once again, |
| 211 | +reopening is great and better than creating a duplicate issue. |
| 212 | +
|
| 213 | +## Everything else |
| 214 | +
|
| 215 | +When in doubt, find the other maintainers and ask. |
0 commit comments