Skip to content

Commit 2adc0ab

Browse files
author
saul-data
committed
release python package
1 parent 51da5fd commit 2adc0ab

File tree

7 files changed

+102
-16
lines changed

7 files changed

+102
-16
lines changed

.devcontainer/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ pytest==7.1.3
77
pyarrow==9.0.0
88
nanoid==0.1
99
requests==2.28.1
10-
python-dotenv==0.21.0
10+
python-dotenv==0.21.0
11+
toml==0.10.2
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Dataplane Python Package Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
worker:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.10"]
13+
permissions:
14+
contents: read
15+
packages: write
16+
# This is used to complete the identity challenge
17+
# with sigstore/fulcio when running outside of PRs.
18+
id-token: write
19+
20+
steps:
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Get the version
28+
id: get_version
29+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
30+
31+
- name: Release check out ${{ steps.get_version.outputs.VERSION }}
32+
uses: actions/checkout@v3
33+
with:
34+
ref: ${{ steps.get_version.outputs.VERSION }}
35+
36+
- name: Update pyproject.toml version ${{ steps.get_version.outputs.VERSION }}
37+
run: python3 update_toml_release.py ${{ steps.get_version.outputs.VERSION }}
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
python3 -m pip install --upgrade twine
43+
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
44+
45+
- name: Build python package
46+
run: python3 -m build
47+
48+
- name: Distribute python package
49+
run: python3 -m twine upload dist/* -u "__token__" -p ${{ secrets.PYPI_API_TOKEN }}
50+
51+
- name: Commit report
52+
continue-on-error: true
53+
run: |
54+
git config --global user.name 'Dataplane Actions'
55+
git config --global user.email 'saul-data@users.noreply.github.com'
56+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
57+
git checkout "${GITHUB_REF:11}"
58+
git add pyproject.toml
59+
git commit -am "Automated TOML release update"
60+
git push
61+
# git diff --exit-code || git commit -am "Automated TOML release update"
62+
# git diff --exit-code || git push

.github/workflows/python-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
run: |
3333
python -m pip install --upgrade pip
3434
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
35+
3536
- name: Test with pytest
3637
run: |
3738
pytest -s

notes-distribute.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
### Github Actions Release
2+
1. Update release with latest version
3+
2. Github Actions will release to PyPI with that version
4+
3. Automatically update toml and git commit to main
5+
```shell
6+
python update_toml_release.py 0.0.15
7+
```
8+
19
### Steps to distribute
210

311
1. Update toml with latest version

pyproject.toml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
[build-system]
2-
requires = ["setuptools>=61.0","redis>=1.0.0","pyarrow>1.0.0", "pandas>1.0.0", "requests>1.0.0"]
2+
requires = [ "setuptools>=61.0", "redis>=1.0.0", "pyarrow>1.0.0", "pandas>1.0.0", "requests>1.0.0",]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "dataplane"
77
version = "0.0.14"
8-
authors = [
9-
{ name="Saul Frank" }, {name ="Dataplane, Inc."}
10-
]
118
description = "The data engineering library to build robust, reliable and on time data pipelines in Python."
129
readme = "README.md"
1310
requires-python = ">=3.7"
14-
classifiers = [
15-
"Programming Language :: Python :: 3",
16-
"License :: OSI Approved :: BSD License",
17-
"Operating System :: OS Independent",
18-
]
11+
classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent",]
12+
keywords = [ "workflow", "data-science", "data", "airflow", "etl", "dataplane", "data-engineering", "data-pipelines", "datawarehouse", "automation", "data-analysis", "scheduler",]
13+
[[project.authors]]
14+
name = "Saul Frank"
1915

20-
keywords = ["workflow", "data-science", "data", "airflow", "etl", "dataplane", "data-engineering", "data-pipelines", "datawarehouse", "automation", "data-analysis", "scheduler"]
16+
[[project.authors]]
17+
name = "Dataplane, Inc."
2118

2219
[project.urls]
23-
"Homepage" = "https://dataplane.app"
24-
"Github" = "https://github.com/dataplane-app/dataplane-python-package"
25-
"Issues" = "https://github.com/dataplane-app/dataplane/issues"
26-
"Feedback" = "https://github.com/dataplane-app/dataplane/discussions"
20+
Homepage = "https://dataplane.app"
21+
Github = "https://github.com/dataplane-app/dataplane-python-package"
22+
Issues = "https://github.com/dataplane-app/dataplane/issues"
23+
Feedback = "https://github.com/dataplane-app/dataplane/discussions"

tests/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ pytest==7.1.3
77
pyarrow==9.0.0
88
nanoid==0.1
99
requests==2.28.1
10-
python-dotenv==0.21.0
10+
python-dotenv==0.21.0
11+
toml==0.10.2

update_toml_release.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import toml
2+
import sys
3+
4+
data = toml.load("pyproject.toml")
5+
6+
# Modify field
7+
version = sys.argv[1]
8+
version = version.replace("v", "")
9+
data['project']['version']=version
10+
11+
# To use the dump function, you need to open the file in 'write' mode
12+
# It did not work if I just specify file location like in load
13+
f = open("pyproject.toml",'w')
14+
toml.dump(data, f)
15+
f.close()
16+
print(f"Dataplane python project updated to {version}")

0 commit comments

Comments
 (0)