supports github releases
Project description
setuptools-github
Quick start
setuptools-github helps to implement a simple project life cycle aimed at delivering packages into PyPI.
Install it with:
pip install setuptools-github
or
conda install -c conda-forge setuptools-github
Add secrets
First you need to install the secrets for the package-name repository here
- TWINE_PASSWORD
- TWINE_USERNAME
- CODECOV_TOKEN
Setup the master branch
Create a new src/package_name/__init__.py
file to store the package information:
__version__ = "N.M.O" # replace N, M and O with numerical values (eg. 0.0.0)
__hash__ = "" # leave this empty
Fix the setup.py file:
from setuptools_github import tools
initfile = pathlib.Path(__file__).parent / "package_name/__init__.py"
setup(
name="package-name",
version=tools.update_version(initfile, os.getenv("GITHUB_DUMP")),
...
Copy over the github workflow files:
Most likely you might need to change tests/requirements.txt
file.
THAT IS ALL! Now when commiting to the master branch, this will trigger the github action to run tests and quality checks on the code (see the Rationale section below).
Setup the beta/N.M.O branch
You must create a beta branch using the little script:
python -m setuptools_github.script make-beta
or
setuptools-github make-beta
This will generate the beta/N.M.O branch out of the master branch.
Adds the secrets in https://github.com///settings/secrets/actions:
- TWINE_PASSWORD
- TWINE_USERNAME
Then for each commit into beta/N.M.O a package will be generated as package-N.M.O.bX on PyPI (if all tests pass!).
Rationale
setuptools-github helps to implement a simple project life cycle aimed at delivering packages into PyPI: there are three important components, the master branch, the beta branch and the release tags.
/master branch
this is the branch where all commit go
(as well the PR from feature branches).
On each commit the CI will run code quality checks as:
- running flake8
- running mypy
- running all pytest + coverage
(see github/workflows/master.yml for an example)
/beta/N.M.O branch
branch is where code is merged to release the beta
packages to PyPI.
On each commit into this branch, the CI will:
- run flake8
- run mypy
- run pytest + coverage (see .github/workflows/master.yml)
- create wheel such as package-N.M.O.bX
- (optional) publish the wheel to PyPI
(see github/workflows/beta.yml for an example)
NOTE: the X in the package-name-N.M.O.bX is a unique increasing build number taken from GITHUB build environment.
/release/N.M.O
is a release tag.
Once the code is stable enough on the /beta/N.M.O branch that is the
time to release a formal package-N.M.O.
So tagging on /beta/N.M.O with a /release/N.M.O tag will direct the CI to:
- create wheel such as package-name-N.M.O
- (optional) publish the wheel to PyPI
(see github/workflows/tags.yml for an example)
WARNING: there won't be any check/test run on the tagged code, so it it important the tagging happen on /beta/N.M.O branch
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for setuptools-github-0.3.0b60.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b45c5cd4c9d1fd0b1f86de7968b7b1b638f5a9a9c65fb6a7ff67ee74ec46dd0 |
|
MD5 | 377f8e6b93c5f666a5cfc59620316d8a |
|
BLAKE2b-256 | f2eb0938aad79390db616000fb1398df3ade114a02e9394259d312228811fab4 |
Hashes for setuptools_github-0.3.0b60-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b30e646628d5241a767e029fd0c40c78ab3eb9ff67bdb2a3b11e884127b20d4d |
|
MD5 | 007aca7acf98ae9aa784c33f2df87eb5 |
|
BLAKE2b-256 | 0f5e4ffe719bf061b20ed88df24753bed8be9236b123380fd6709a324dc46542 |