Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish

on:
push:
tags:
- "v*"

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write # required for PyPI Trusted Publishing (no API token needed)
contents: read

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install Python 3.13
run: uv python install 3.13

# Strip the leading 'v' from the tag (v0.1.0 → 0.1.0)
- name: Derive version from tag
id: tag
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"

# Fail fast if pyproject.toml version doesn't match the tag
- name: Assert pyproject.toml version matches tag
run: |
TOML_VERSION=$(uv run python -c "
import tomllib, pathlib
data = tomllib.loads(pathlib.Path('pyproject.toml').read_text())
print(data['project']['version'])
")
TAG_VERSION="${{ steps.tag.outputs.version }}"
if [ "$TOML_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: pyproject.toml version ($TOML_VERSION) != tag ($TAG_VERSION)"
echo "Update [project] version in pyproject.toml before pushing the tag."
exit 1
fi
echo "Version check passed: $TOML_VERSION"

- name: Build
run: uv build

- name: Smoke test (wheel)
run: uv run --isolated --no-project --with dist/*.whl python tests/smoke_check.py
env:
ETTER_EXPECTED_VERSION: ${{ steps.tag.outputs.version }}

- name: Smoke test (source distribution)
run: uv run --isolated --no-project --with dist/*.tar.gz python tests/smoke_check.py
env:
ETTER_EXPECTED_VERSION: ${{ steps.tag.outputs.version }}

- name: Publish
run: uv publish
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help install test lint format clean repl demo docs-preview
.PHONY: help install test lint format clean repl demo docs-preview smoke-test

help:
@echo "Setup:"
Expand All @@ -16,6 +16,8 @@ help:
@echo "Docs:"
@echo " make docs-preview Build and preview the documentation site"
@echo ""
@echo " make smoke-test Build dist and run smoke checks against wheel and sdist"
@echo ""
@echo "Maintenance:"
@echo " make clean Clean build artifacts"

Expand Down Expand Up @@ -67,6 +69,11 @@ docs-preview:
npm --prefix docs run preview

clean:
rm -rf .pytest_cache htmlcov .coverage
rm -rf .pytest_cache htmlcov .coverage dist build
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete

smoke-test:
uv build
uv run -n --isolated --no-project --with dist/*.whl python tests/smoke_check.py
uv run -n --isolated --no-project --with dist/*.tar.gz python tests/smoke_check.py
7 changes: 7 additions & 0 deletions etter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
Parse location queries into structured geographic queries using LLM.
"""

from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("etter")
except PackageNotFoundError: # running from source without install
__version__ = "unknown"

# Main API
# Exceptions
# Datasources
Expand Down
Loading
Loading