Skip to content

Commit e4e4b8b

Browse files
committed
Distribute via GitHub release tags instead of PyPI
Replace pip install fastcomments with a git+tag install, and repurpose publish.sh to build the wheel/sdist and cut a tagged GitHub Release.
1 parent f31d2f9 commit e4e4b8b

2 files changed

Lines changed: 37 additions & 14 deletions

File tree

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@ The FastComments Python SDK. You can use this to build secure and scalable backe
33

44
## Installation
55

6-
### PyPI
6+
### Install from GitHub
7+
8+
Install directly from a release tag (recommended, fully reproducible):
79

810
```bash
9-
pip install fastcomments
11+
pip install git+https://github.com/fastcomments/fastcomments-python.git@v3.0.0
12+
```
13+
14+
Pin the tag rather than a branch so builds are deterministic. The same form works in `requirements.txt`:
15+
16+
```
17+
fastcomments @ git+https://github.com/fastcomments/fastcomments-python.git@v3.0.0
1018
```
1119

20+
Each tagged [GitHub Release](https://github.com/fastcomments/fastcomments-python/releases) also has a built wheel attached if you prefer to install a binary artifact directly.
21+
1222
### Library Contents
1323

1424
This library contains two modules: the generated API client and the core Python library which contains hand-written utilities to make working with the API easier, including SSO support.

publish.sh

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,44 @@ set -e
44

55
# Get version from pyproject.toml
66
VERSION=$(grep "^version = " pyproject.toml | cut -d'"' -f2)
7+
TAG="v$VERSION"
78

8-
echo "Publishing FastComments Python SDK v$VERSION..."
9+
echo "Publishing FastComments Python SDK $TAG..."
910

1011
# Clean up old builds
1112
echo "Cleaning up old builds..."
1213
rm -rf dist/ build/ *.egg-info
1314

14-
# Build the package
15+
# Build the package (wheel + sdist) to attach to the GitHub Release
1516
echo "Building the package..."
16-
#python3 -m pip install --upgrade build twine
17+
#python3 -m pip install --upgrade build
1718
python3 -m build
1819

19-
# Check the package
20-
echo "Checking the package..."
21-
python3 -m twine check dist/*
22-
2320
echo ""
2421
echo "Package built successfully!"
2522
echo ""
2623

27-
# Publish to PyPI
28-
echo "Publishing to PyPI..."
29-
python3 -m twine upload dist/*
24+
# Tag the release (skip if the tag already exists)
25+
if git rev-parse "$TAG" >/dev/null 2>&1; then
26+
echo "Tag $TAG already exists, skipping tag creation."
27+
else
28+
echo "Tagging $TAG..."
29+
git tag "$TAG"
30+
git push origin "$TAG"
31+
fi
32+
33+
# Create the GitHub Release with the built artifacts (skip if it already exists)
34+
if gh release view "$TAG" >/dev/null 2>&1; then
35+
echo "Release $TAG already exists; uploading/clobbering artifacts..."
36+
gh release upload "$TAG" dist/*.whl dist/*.tar.gz --clobber
37+
else
38+
echo "Creating GitHub Release $TAG..."
39+
gh release create "$TAG" dist/*.whl dist/*.tar.gz \
40+
--title "$TAG" \
41+
--notes "FastComments Python SDK $TAG"
42+
fi
3043

3144
echo ""
32-
echo "✓ Published to PyPI!"
45+
echo "✓ Published GitHub Release $TAG!"
3346
echo "Users can install it with:"
34-
echo " pip install fastcomments"
47+
echo " pip install git+https://github.com/fastcomments/fastcomments-python.git@$TAG"

0 commit comments

Comments
 (0)