diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml
index 70f603c..6a503db 100644
--- a/.github/workflows/python-app.yml
+++ b/.github/workflows/python-app.yml
@@ -3,54 +3,90 @@ name: Python application
on: [push, pull_request]
jobs:
- build:
-
+ test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Fetch all history for versioning
- name: Set up Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: '3.x'
- - name: Install Poetry
- run: |
- curl -sSL https://install.python-poetry.org | python3 -
-
- - name: Install dependencies with Poetry
+ - name: Install UV
run: |
- poetry install --with dev
+ curl -LsSf https://astral.sh/uv/install.sh | sh
+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- - name: Install pre-commit
+ - name: Install dependencies with UV
run: |
- poetry run pip install pre-commit
+ uv sync
- name: Run pre-commit
run: |
- poetry run pre-commit run --all-files
+ uv run pre-commit run --all-files
- name: Install Playwright browsers
run: |
- poetry run playwright install
+ uv run playwright install
- name: Run tests
run: |
- poetry run pytest --reruns 3 # githubs playwright sometimes fails
+ uv run pytest --reruns 3 # githubs playwright sometimes fails
+
+ publish:
+ needs: test
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write # Allows pushing tags
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Fetch all history for versioning
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.x'
+
+ - name: Install UV
+ run: |
+ curl -LsSf https://astral.sh/uv/install.sh | sh
+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
+
+ - name: Install dependencies
+ run: |
+ uv sync
+
+ - name: Bump version and push tag
+ id: tag_version
+ uses: mathieudutour/github-tag-action@v6.1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ default_bump: patch
+ tag_prefix: v
- name: Build package
- if: github.ref == 'refs/heads/main'
run: |
- python -m pip install --upgrade build
- python -m build
+ uv build
- name: Publish package to PyPI
- if: github.ref == 'refs/heads/main'
env:
- TWINE_USERNAME: __token__
- TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
- python -m pip install --upgrade twine
- python -m twine upload dist/*
+ uv publish
+
+ - name: Create GitHub Release
+ uses: ncipollo/release-action@v1
+ with:
+ tag: ${{ steps.tag_version.outputs.new_tag }}
+ name: Release ${{ steps.tag_version.outputs.new_tag }}
+ body: ${{ steps.tag_version.outputs.changelog }}
diff --git a/.gitignore b/.gitignore
index ecc9912..56719c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
Dockerfile
example.py
+# Auto-generated version file
+hstream/_version.py
+
.*pyc
# Byte-compiled / optimized / DLL files
__pycache__/
diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md
index 72ceb9a..ee15d7a 100644
--- a/CONTRIBUTE.md
+++ b/CONTRIBUTE.md
@@ -1,15 +1,54 @@
## Deploy
-1. increment version in `setup.py`
+We use automatic versioning and deployment with hatch-vcs and GitHub Actions.
-2. `rm -rf build/ hstream.egg-info/ dist/`
+### How It Works:
-3. `pip install twine build`
+```
+Push to main → Tests pass → Auto-create tag → Build with version → Publish to PyPI → Create GitHub release
+```
-4. `python -m build`
+Every push to the main branch will:
+1. Run all tests
+2. Automatically create a new git tag (patch version bump: v0.1.58 → v0.1.59)
+3. Build the package with the version from the tag
+4. Publish to PyPI automatically
+5. Create a GitHub release with changelog
+
+### Important: Initial Setup Needed
+
+Before the auto-versioning works, you need to create an initial tag:
+
+```bash
+# Switch to main branch and create initial tag
+git checkout main
+git tag v0.1.58 # Use the next version number
+git push origin v0.1.58
+```
+
+After that, every push to main will auto-increment the patch version.
+
+### Manual Version Bumps
+The default is to bump the patch version (0.1.X), but you can control the version bump with commit messages:
+
+- **Patch bump** (default): `git commit -m "fix: bug fix"`
+- **Minor bump**: `git commit -m "feat: new feature"`
+- **Major bump**: `git commit -m "feat!: breaking change"`
+
+### Old Manual Process (Deprecated)
+
+
+Click to see the old manual deployment process (no longer used)
+
+1. increment version in `setup.py`
+2. `rm -rf build/ hstream.egg-info/ dist/`
+3. `pip install twine build`
+4. `python -m build`
5. `twine upload dist/*`
+
+
## Kill orphaned uvicorn processes
`kill -9 $(lsof -t -i:8000)` (or whatever port they we're using)
diff --git a/agents.md b/agents.md
index 23733c1..c238f96 100644
--- a/agents.md
+++ b/agents.md
@@ -1 +1 @@
-@architecture.md
\ No newline at end of file
+@architecture.md
diff --git a/architecture.md b/architecture.md
index b2ed4bc..e32b5a8 100644
--- a/architecture.md
+++ b/architecture.md
@@ -9,7 +9,7 @@ This flow covers the process from running the command to the user seeing the ini
```mermaid
stateDiagram-v2
direction LR
-
+
state "CLI & Server Startup" as Startup {
[*] --> RunCommand: hstream run