This document describes tools, tasks and workflow that one needs to be familiar with in order to effectively maintain this project. If you use this package within your own software as is but don't plan on modifying it, this guide is not for you.
We recommend using pyenv for Python runtime management. If you use macOS, follow the following steps:
brew update
brew install pyenvInstall necessary Python runtimes for development/testing. You can rely on GitHub Actions for testing with various major versions.
pyenv install -l | grep -v "-e[conda|stackless|pypy]"
pyenv install 3.9.18 # select the latest patch version
pyenv local 3.9.18
pyenv versions
system
3.6.10
3.7.7
* 3.9.18 (set by /path-to-python-slack-hooks/.python-version)
pyenv rehashThen, you can create a new Virtual Environment this way:
python -m venv env_3.9.18
source env_3.9.18/bin/activateIf 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.
If this is your first time to run tests, although it may take a bit longer, running the following script is the easiest.
./scripts/install_and_run_tests.shTo simply install all the development dependencies for this project.
./scripts/install.shOnce you installed all the required dependencies, you can use the following.
./scripts/run_tests.sh
./scripts/run_tests.sh tests/scenario_test/test_get_hooks.pyTo format this project
./scripts/format.shTo lint this project
./scripts/lint.shThis project uses mypy to check and infers types for your Python code.
./scripts/run_mypy.shIf you want to test the package locally you can.
-
Build the package locally
-
Run
scripts/build_pypi_package.sh
-
This will create a
.whlfile in the./distfolder
-
-
Use the built package
-
Example
/dist/slack_cli_hooks-1.2.3-py2.py3-none-any.whlwas created -
From anywhere on your machine you can install this package to a project with
pip install <project path>/dist/slack_cli_hooks-1.2.3-py2.py3-none-any.whl
-
TestPyPI is a separate instance of the Python Package
Index that allows you to try distribution tools and processes without affecting
the real index. This is useful with changes that relate to the package itself,
example the contents of the pyproject.toml
The following can be used to deploy this project on https://test.pypi.org/.
./scripts/deploy_to_test_pypi.shDeploying a new version of this library to Pypi is triggered by publishing a Github Release. Before creating a new release, ensure that everything on a stable branch has landed, then run the tests.
-
Create a branch in which the development release will live:
- Bump the version number in adherence to
Semantic Versioning and
Developmental Release
in
slack_cli_hooks/version.py- Example the current version is
1.2.3a proper development bump would be1.2.3.dev0 .devwill indicate to pip that this is a Development Release- Note that the
devversion can be bumped in development releases:1.2.3.dev0->1.2.3.dev1
- Example the current version is
- Commit with a message including the new version number. For example
1.2.3.dev0& Push the commit to a branch where the development release will live (create it if it does not exist)git checkout -b future-releasegit commit -m 'version 1.2.3.dev0'git push -u origin future-release
- Bump the version number in adherence to
Semantic Versioning and
Developmental Release
in
-
Create a new GitHub Release from the Releases page by clicking the "Draft a new release" button.
-
Input the version manually into the "Choose a tag" input. You must use the same version found in
slack_cli_hooks/version.py- After you input the new version, click the "Create a new tag: x.x.x on publish" button. This won't create your tag immediately.
- Auto-generate the release notes by clicking the "Auto-generate release notes" button. This will pull in changes that will be included in your release.
- Edit the resulting notes to ensure they have decent messaging that are understandable by non-contributors, but each commit should still have it's own line.
- Ensure that this version adheres to semantic versioning and Developmental Release. See Versioning for correct version format.
-
Set the "Target" input to the feature branch with the development changes.
-
Name the release title after the version tag. It should match the updated value from
slack_cli_hooks/version.py! -
Make any adjustments to generated release notes to make sure they are accessible and approachable and that an end-user with little context about this project could still understand.
-
Select "Set as a pre-release"
-
Publish the release by clicking the "Publish release" button!
-
After a few minutes, the corresponding version will be available on https://pypi.org/project/slack-cli-hooks/.
-
(Slack Internal) Communicate the release internally
Deploying a new version of this library to Pypi is triggered by publishing a Github Release.
Before creating a new release, ensure that everything on the main branch since
the last tag is in a releasable state! At a minimum,
run the tests.
-
Create the commit for the release
- Bump the version number in adherence to
Semantic Versioning in
slack_cli_hooks/version.py - 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.git checkout -b 1.2.3-releasegit commit -m 'chore(release): tag version 1.2.3'git push {your-fork} 1.2.3-release
- Add relevant labels to the PR and add the PR to a GitHub Milestone.
- Merge in release PR after getting an approval from at least one maintainer.
- Bump the version number in adherence to
Semantic Versioning in
-
Create a new GitHub Release from the Releases page by clicking the "Draft a new release" button.
-
Input the version manually into the "Choose a tag" input. You must use the same version found in
slack_cli_hooks/version.py- After you input the version, click the "Create a new tag: x.x.x on publish" button. This won't create your tag immediately.
- Click the "Auto-generate release notes" button. This will pull in changes that will be included in your release.
- Edit the resulting notes to ensure they have decent messaging that are understandable by non-contributors, but each commit should still have it's own line.
- Ensure that this version adheres to semantic versioning. See Versioning for correct version format.
-
Set the "Target" input to the "main" branch.
-
Name the release title after the version tag. It should match the updated value from
slack_cli_hooks/version.py! -
Make any adjustments to generated release notes to make sure they are accessible and approachable and that an end-user with little context about this project could still understand.
-
Publish the release by clicking the "Publish release" button!
-
After a few minutes, the corresponding version will be available on https://pypi.org/project/slack-cli-hooks/.
-
Close the current GitHub Milestone and create one for the next minor version.
-
(Slack Internal) Communicate the release internally
- Include a link to the GitHub release
-
(Slack Internal) Tweet by @SlackAPI
- Not necessary for patch updates, might be needed for minor updates, definitely needed for major updates. Include a link to the GitHub release
This project uses semantic versioning, expressed through the numbering scheme of PEP-0440.
main is where active development occurs. Long running named feature branches are occasionally created for
collaboration on a feature that has a large scope (because everyone cannot push commits to another person's open Pull
Request). At some point in the future after a major version increment, there may be maintenance branches for older major
versions.
Labels are used to run issues through an organized workflow. Here are the basic definitions:
bug: A confirmed bug report. A bug is considered confirmed when reproduction steps have been documented and the issue has been reproduced.enhancement: A feature request for something this package might not already do.docs: An issue that is purely about documentation work.tests: An issue that is purely about testing work.discussion: An issue that is purely meant to hold a discussion. Typically the maintainers are looking for feedback in this issues.question: An issue that is like a support request because the user's usage was not correct.
Triage is the process of taking new issues that aren't yet "seen" and marking them with a basic level of information
with labels. An issue should have one of the following labels applied: bug, enhancement, question,
needs feedback, docs, tests, or discussion.
Issues are closed when a resolution has been reached. If for any reason a closed issue seems relevant once again, reopening is great and better than creating a duplicate issue.
When in doubt, find the other maintainers and ask.