Skip to content

Commit 4a5f14b

Browse files
authored
Merge pull request #112 from AusClimateService/34-package-for-pip
34 package for pip
2 parents ef412b3 + 2d76544 commit 4a5f14b

File tree

5 files changed

+141
-3
lines changed

5 files changed

+141
-3
lines changed

.github/workflows/pypi-release.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
10+
build-artifacts:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Install Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: "3.11"
25+
26+
- name: Install PyPi dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install build twine
30+
31+
- name: Build tarball and wheels
32+
run: |
33+
git clean -xdf
34+
git restore -SW .
35+
python -m build
36+
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: releases
41+
path: dist
42+
43+
publish_pypi_test:
44+
45+
needs: build-artifacts
46+
runs-on: ubuntu-latest
47+
environment:
48+
name: release
49+
url: https://test.pypi.org/project/acs-axiom
50+
permissions:
51+
id-token: write
52+
53+
steps:
54+
55+
- name: Install Python
56+
uses: actions/setup-python@v4
57+
with:
58+
python-version: "3.11"
59+
60+
- name: Download artifact
61+
uses: actions/download-artifact@v3
62+
with:
63+
name: releases
64+
path: dist
65+
66+
- name: Install PyPi dependencies
67+
run: |
68+
python -m pip install --upgrade pip
69+
python -m pip install build twine
70+
71+
- name: Check build artifacts
72+
run: |
73+
python -m twine check dist/*
74+
pwd
75+
if [ -f dist/axiom-0.0.0.tar.gz ]; then
76+
echo "INVALID VERSION NUMBER"
77+
exit 1
78+
fi
79+
80+
- name: Publish package distributions to TestPyPI
81+
uses: pypa/gh-action-pypi-publish@release/v1
82+
with:
83+
repository-url: https://test.pypi.org/legacy/
84+
85+
publish_pypi_prod:
86+
87+
needs: publish_pypi_test
88+
runs-on: ubuntu-latest
89+
environment:
90+
name: release
91+
url: https://pypi.org/project/acs-axiom
92+
permissions:
93+
id-token: write
94+
95+
steps:
96+
97+
- name: Install Python
98+
uses: actions/setup-python@v4
99+
with:
100+
python-version: "3.11"
101+
102+
- name: Download artifact
103+
uses: actions/download-artifact@v3
104+
with:
105+
name: releases
106+
path: dist
107+
108+
- name: Install PyPi dependencies
109+
run: |
110+
python -m pip install --upgrade pip
111+
python -m pip install build twine
112+
113+
- name: Check build artifacts
114+
run: |
115+
python -m twine check dist/*
116+
pwd
117+
if [ -f dist/axiom-0.0.0.tar.gz ]; then
118+
echo "INVALID VERSION NUMBER"
119+
exit 1
120+
fi
121+
122+
- name: Publish package distributions to TestPyPI
123+
uses: pypa/gh-action-pypi-publish@release/v1

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,17 @@ test:
44

55
# Style
66
lint:
7-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
7+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
8+
9+
# Build for PyPi
10+
pypi_build:
11+
python3 -m build
12+
13+
# Publish to PyPi (test)
14+
test_pypi_publish: pypi_build
15+
python3 -m twine upload --repository testpypi dist/*
16+
17+
# Publish to PyPi (production)
18+
pypi_publish: pypi_build
19+
python3 -m twine upload dist/*
20+
File renamed without changes.

axiom/requirements.txt renamed to requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ tabulate >= 0.8.9
77
dask >= 2022.8.1
88
distributed >= 2022.8.1
99
tqdm >= 4.64.1
10-
Jinja2 >= 3.1.2
10+
Jinja2 >= 3.1.2
11+
importlib-metadata >= 6.6.0

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author = Ben Schreoter
44
author_email = ben.schroeter@csiro.au
55
license = MIT
66
description = A prototype utility for validating/applying metadata templates for scientific data.
7-
long_description = file: README.md
7+
long_description = A prototype utility for validating/applying metadata templates for scientific data.
88

99
url = https://github.com/AusClimateService/axiom
1010
classifiers =
@@ -34,6 +34,7 @@ install_requires =
3434
distributed >= 2022.8.1
3535
tqdm >= 4.64.1
3636
Jinja2 >= 3.1.2
37+
importlib-metadata >= 6.6.0
3738

3839
[aliases]
3940
test = pytest

0 commit comments

Comments
 (0)