Skip to content

Commit ec1f239

Browse files
updated REAME
1 parent f6bf81e commit ec1f239

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

.github/workflows/publish.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,8 @@ jobs:
2727
pip install ".[dev]"
2828
- name: 🚀 Publish to PyPi
2929
env:
30-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
31-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
32-
TWINE_TEST_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
30+
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
31+
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
32+
PYPI_TEST_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
3333

34-
run: |
35-
python setup.py sdist bdist_wheel
36-
twine upload -r testpypi dist/* -u $TWINE_USERNAME -p $TWINE_TEST_PASSWORD --verbose
37-
twine check dist/*
38-
twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD --verbose
34+
run: make publish

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ check_code_quality:
1414
flake8 $(check_dirs) --count --select=E9,F63,F7,F82 --show-source --statistics
1515
# exit-zero treats all errors as warnings. E203 for black, E501 for docstring, W503 for line breaks before logical operators
1616
flake8 $(check_dirs) --count --max-line-length=88 --exit-zero --ignore=D --extend-ignore=E203,E501,W503 --statistics
17-
17+
18+
publish:
19+
python setup.py sdist bdist_wheel
20+
twine upload -r testpypi dist/* -u ${PYPI_USERNAME} -p ${PYPI_TEST_PASSWORD} --verbose
21+
twine check dist/*
22+
twine upload dist/* -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} --verbose

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,44 @@ So far, **there is no types checking with mypy**. See [issue](https://github.com
4747

4848
[`pytests`](https://docs.pytest.org/en/7.1.x/) is used to run our tests.
4949

50-
### CI/CD
50+
### Publish on PyPi 🚀
51+
52+
**Important**: Before publishing, edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version.
53+
54+
We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. You can publish by using
55+
56+
```
57+
export PYPI_USERNAME="you_username"
58+
export PYPI_PASSWORD="your_password"
59+
export PYPI_TEST_PASSWORD="your_password_for_test_pypi"
60+
make publish
61+
```
62+
63+
You can also use token for auth, see [pypi doc](https://pypi.org/help/#apitoken). In that case,
64+
65+
```
66+
export PYPI_USERNAME="__token__"
67+
export PYPI_PASSWORD="your_token"
68+
export PYPI_TEST_PASSWORD="your_token_for_test_pypi"
69+
make publish
70+
```
71+
72+
**Note**: We will try to push to [test pypi](https://test.pypi.org/) before pushing to pypi, to assert everything will work
73+
74+
### CI/CD 🤖
5175

5276
We use [GitHub actions](https://github.com/features/actions) to automatically run tests and check code quality when a new PR is done on `main`.
5377

5478
On any pull request, we will check the code quality and tests.
5579

56-
#### Publish on PyPi
80+
When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier.
81+
82+
The **correct steps** to create a new realease are the following:
83+
- edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version.
84+
- create a new [`tag`](https://git-scm.com/docs/git-tag) with the release name, e.g. `git tag v0.0.1 && git push origin v0.0.1` or from the GitHub UI.
85+
- create a new release from GitHub UI
5786

58-
When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier.
87+
The CI will run when you create the new release.
5988

6089
# Q&A
6190

0 commit comments

Comments
 (0)