-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: added 'build' and 'twine' packages as dependencies * docs: added md file with publishing steps * chore: prepared pyproject.toml for publishing * docs: updated install part in readme * feat: added publish.in and publish.txt as source and target for requriements compilaton cmd in Makefile * feat: added make cmd install-gh-publish * feat: added publish.yml to publish on pypi after release creation * chore: 0.1.1
- Loading branch information
1 parent
92f42a1
commit ae8a4bc
Showing
10 changed files
with
217 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# based on https://simonwillison.net/2021/Nov/4/publish-open-source-python-library/ | ||
name: publish python package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
name: Configure pip caching | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml','**/requirements/core.txt', '**/requirements/test.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
make install-gh-test | ||
- name: Run tests | ||
run: | | ||
pytest -v | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/cache@v3 | ||
name: Configure pip caching | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/pyproject.toml','**/requirements/core.txt', '**/requirements/publish.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-publish-pip- | ||
- name: Install dependencies | ||
run: | | ||
make install-gh-publish | ||
- name: Publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
python -m build | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# publishing | ||
|
||
Set up an account on TestPyPi and PyPi. Then after enabling two factor authentication set up a token. Once this is done add as described on (Test)PyPi to $HOME/.pypirc. | ||
|
||
Then run | ||
|
||
python -m build | ||
|
||
twine check dist/* | ||
|
||
twine upload -r testpypi dist/* | ||
|
||
twine upload -r pypi dist/* | ||
|
||
rm -r dist | ||
|
||
## References | ||
|
||
https://realpython.com/pypi-publish-python-package/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
[build-system] | ||
requires = ["setuptools>=65.0"] | ||
requires = ["setuptools>=65.0","wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "random-neural-net-models" | ||
description = "My implementation of a random selection of artificial neural net based models." | ||
requires-python = ">=3.10" | ||
|
||
version = "0.1.0" | ||
version = "0.1.1" | ||
authors = [ | ||
{name = "eschmidt42", email="[email protected]"} | ||
] | ||
description = "My implementation of a random selection of artificial neural net based models." | ||
readme = "README.md" | ||
license = { file = "LICENSE" } | ||
classifiers = [ | ||
"Development Status :: 2 - Pre-Alpha", | ||
"License :: OSI Approved :: BSD License", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11" | ||
] | ||
keywords = ["neural-networks", "machine-learning", "deep-learning"] | ||
# dependencies = [] - now via requirements/*.in files | ||
|
||
[tool.black] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
-c core.txt | ||
-c test.txt | ||
-c publish.txt | ||
black | ||
isort | ||
pre-commit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-c core.txt | ||
build | ||
twine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.11 | ||
# by the following command: | ||
# | ||
# pip-compile --config=pyproject.toml --output-file=requirements/publish.txt --resolver=backtracking requirements/publish.in | ||
# | ||
build==1.0.3 | ||
# via -r requirements/publish.in | ||
certifi==2023.7.22 | ||
# via requests | ||
cffi==1.15.1 | ||
# via cryptography | ||
charset-normalizer==3.2.0 | ||
# via requests | ||
cryptography==41.0.3 | ||
# via secretstorage | ||
docutils==0.20.1 | ||
# via readme-renderer | ||
idna==3.4 | ||
# via requests | ||
importlib-metadata==6.8.0 | ||
# via | ||
# keyring | ||
# twine | ||
jaraco-classes==3.3.0 | ||
# via keyring | ||
jeepney==0.8.0 | ||
# via | ||
# keyring | ||
# secretstorage | ||
keyring==24.2.0 | ||
# via twine | ||
markdown-it-py==3.0.0 | ||
# via | ||
# -c requirements/core.txt | ||
# rich | ||
mdurl==0.1.2 | ||
# via | ||
# -c requirements/core.txt | ||
# markdown-it-py | ||
more-itertools==10.1.0 | ||
# via jaraco-classes | ||
nh3==0.2.14 | ||
# via readme-renderer | ||
packaging==23.1 | ||
# via | ||
# -c requirements/core.txt | ||
# build | ||
pkginfo==1.9.6 | ||
# via twine | ||
pycparser==2.21 | ||
# via cffi | ||
pygments==2.16.1 | ||
# via | ||
# -c requirements/core.txt | ||
# readme-renderer | ||
# rich | ||
pyproject-hooks==1.0.0 | ||
# via build | ||
readme-renderer==42.0 | ||
# via twine | ||
requests==2.31.0 | ||
# via | ||
# requests-toolbelt | ||
# twine | ||
requests-toolbelt==1.0.0 | ||
# via twine | ||
rfc3986==2.0.0 | ||
# via twine | ||
rich==13.5.2 | ||
# via | ||
# -c requirements/core.txt | ||
# twine | ||
secretstorage==3.3.3 | ||
# via keyring | ||
twine==4.0.2 | ||
# via -r requirements/publish.in | ||
urllib3==2.0.4 | ||
# via | ||
# requests | ||
# twine | ||
zipp==3.16.2 | ||
# via importlib-metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
__version__ = "0.1.1" |