Skip to content

Commit 44f8885

Browse files
committed
Add PyPI release workflow and installation badges/docs
1 parent e42daf7 commit 44f8885

2 files changed

Lines changed: 109 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
validate:
14+
name: Validate tag matches package version
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Check version match
25+
run: |
26+
TAG_VERSION="${GITHUB_REF_NAME#v}"
27+
PKG_VERSION=$(python - <<'PY'
28+
import tomllib
29+
with open('pyproject.toml', 'rb') as f:
30+
data = tomllib.load(f)
31+
print(data['project']['version'])
32+
PY
33+
)
34+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
35+
echo "Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)."
36+
exit 1
37+
fi
38+
echo "Version check passed: $PKG_VERSION"
39+
40+
test:
41+
name: Full test suite before release
42+
needs: validate
43+
runs-on: ubuntu-latest
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
python-version: ["3.11", "3.12", "3.13"]
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Set up Python ${{ matrix.python-version }}
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: ${{ matrix.python-version }}
56+
57+
- name: Install dependencies
58+
run: |
59+
python -m pip install --upgrade pip
60+
pip install -e .[dev]
61+
62+
- name: Run tests
63+
run: pytest
64+
65+
build-and-publish:
66+
name: Build distribution and publish to PyPI
67+
needs: test
68+
runs-on: ubuntu-latest
69+
environment:
70+
name: pypi
71+
url: https://pypi.org/project/fanvue-python-sdk/
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Set up Python
77+
uses: actions/setup-python@v5
78+
with:
79+
python-version: "3.12"
80+
81+
- name: Install build tools
82+
run: python -m pip install --upgrade build
83+
84+
- name: Build distributions
85+
run: python -m build
86+
87+
- name: Publish to PyPI
88+
uses: pypa/gh-action-pypi-publish@release/v1
89+
90+
github-release:
91+
name: Create GitHub release
92+
needs: build-and-publish
93+
runs-on: ubuntu-latest
94+
95+
steps:
96+
- uses: actions/checkout@v4
97+
with:
98+
fetch-depth: 0
99+
100+
- name: Create GitHub Release
101+
uses: softprops/action-gh-release@v2
102+
with:
103+
generate_release_notes: true
104+
draft: false
105+
prerelease: ${{ contains(github.ref_name, '-') }}

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Async Python SDK for the [Fanvue API](https://api.fanvue.com/docs), generated from Fanvue's official API reference (`.mdx`) endpoints.
44

5+
[![PyPI](https://img.shields.io/pypi/v/fanvue-python-sdk)](https://pypi.org/project/fanvue-python-sdk/)
6+
[![Python](https://img.shields.io/pypi/pyversions/fanvue-python-sdk)](https://pypi.org/project/fanvue-python-sdk/)
7+
58
- Fully async (`httpx.AsyncClient`)
69
- Generated resource methods for all documented API reference endpoints
710
- Generated Pydantic response models for endpoint payloads
@@ -15,7 +18,7 @@ Async Python SDK for the [Fanvue API](https://api.fanvue.com/docs), generated fr
1518
## Installation
1619

1720
```bash
18-
pip install -e .
21+
pip install fanvue-python-sdk
1922
```
2023

2124
For development tools:

0 commit comments

Comments
 (0)