Skip to content

Commit f623bcc

Browse files
authored
Merge pull request #19 from nebari-dev/claude/add-pypi-github-action-011CUdUaeiJDATFHKiJACeDn
Add GitHub action to publish to PyPI
2 parents f7ee031 + 5a86055 commit f623bcc

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed

.github/workflows/release.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Test & Publish PyPI Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
permissions:
8+
id-token: write
9+
contents: read
10+
11+
jobs:
12+
test-pypi:
13+
name: Test PyPI Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.10"
25+
26+
- name: Install build dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install build
30+
31+
- name: Build package
32+
run: python -m build
33+
34+
- name: Publish to TestPyPI
35+
uses: pypa/gh-action-pypi-publish@release/v1
36+
with:
37+
repository-url: https://test.pypi.org/legacy/
38+
39+
- name: Wait for TestPyPI to update
40+
run: sleep 120
41+
42+
- name: Verify TestPyPI installation
43+
run: |
44+
python -m pip install \
45+
--index-url https://test.pypi.org/simple/ \
46+
--extra-index-url https://pypi.org/simple \
47+
nebari-mlflow-plugin
48+
49+
release-pypi:
50+
name: Publish to PyPI
51+
needs: test-pypi
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: "3.10"
63+
64+
- name: Install build dependencies
65+
run: |
66+
python -m pip install --upgrade pip
67+
python -m pip install build
68+
69+
- name: Build package
70+
run: python -m build
71+
72+
- name: Publish to PyPI
73+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ share/python-wheels/
2626
*.egg
2727
MANIFEST
2828

29+
# Auto-generated version file
30+
src/nebari_mlflow_plugin/_version.py
31+
2932
# PyInstaller
3033
# Usually these files are written by a python script from a template
3134
# before PyInstaller builds the exe, so as to inject date/other infos into it.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling"]
2+
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -42,7 +42,8 @@ Issues = "https://github.com/Quansight/nebari-mlflow-plugin/issues"
4242
Source = "https://github.com/Quansight/nebari-mlflow-plugin"
4343

4444
[tool.hatch.version]
45-
path = "src/nebari_mlflow_plugin/__about__.py"
45+
source = "vcs"
46+
version-file = "src/nebari_mlflow_plugin/_version.py"
4647

4748
[tool.black]
4849
target-version = ["py310"]

src/nebari_mlflow_plugin/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
from nebari.schema import Base, ProviderEnum
99
from pydantic import Field
1010

11+
try:
12+
from nebari_mlflow_plugin._version import __version__
13+
except ImportError:
14+
__version__ = "unknown"
15+
1116

1217
class MlflowConfigAWS(Base):
1318
enable_s3_encryption: bool | None = True

0 commit comments

Comments
 (0)