Skip to content

Commit e9e4cc9

Browse files
grdsdevclaude
andcommitted
feat: improve CI workflows and add CLAUDE.md
- Split CI/CD into separate workflows for better separation of concerns - Enhanced CI workflow with uv caching and explicit dependency installation - Added proper release workflow using release-please outputs - Fixed conditional publishing logic to use release_created output - Added pre-publish validation steps (linting and testing) - Created CLAUDE.md with comprehensive development guidance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f88cb25 commit e9e4cc9

File tree

3 files changed

+220
-43
lines changed

3 files changed

+220
-43
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI/CD
1+
name: CI
22

33
on:
44
push:
@@ -14,7 +14,6 @@ on:
1414

1515
permissions:
1616
contents: read
17-
id-token: write
1817

1918
jobs:
2019
test:
@@ -36,9 +35,14 @@ jobs:
3635
- name: Install uv
3736
uses: astral-sh/setup-uv@v6
3837
with:
38+
enable-cache: true
39+
cache-dependency-glob: "uv.lock"
3940
version: "0.8.2"
4041
python-version: ${{ matrix.python-version }}
4142

43+
- name: Install dependencies
44+
run: uv sync --all-extras --dev
45+
4246
- name: Run Tests
4347
run: make ci
4448

@@ -61,44 +65,3 @@ jobs:
6165
github-token: ${{ secrets.GITHUB_TOKEN }}
6266
parallel-finished: true
6367
carryforward: "run-ubuntu-latest-3.9,run-ubuntu-latest-3.10,run-ubuntu-latest-3.11,run-ubuntu-latest-3.12,run-ubuntu-latest-3.13"
64-
65-
release-please:
66-
needs: test
67-
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
68-
runs-on: ubuntu-latest
69-
name: "Bump version and create changelog"
70-
permissions:
71-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
72-
contents: write # needed for github actions bot to write to repo
73-
pull-requests: write
74-
steps:
75-
- uses: googleapis/release-please-action@v4
76-
id: release
77-
with:
78-
target-branch: ${{ github.ref_name }}
79-
publish:
80-
needs: release-please
81-
if: ${{ startsWith(github.event.head_commit.message, 'chore(main)') && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
82-
runs-on: ubuntu-latest
83-
name: "Publish to PyPi"
84-
environment:
85-
name: pypi
86-
url: https://pypi.org/p/supabase
87-
permissions:
88-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
89-
contents: write # needed for github actions bot to write to repo
90-
steps:
91-
- name: Clone Repository
92-
uses: actions/checkout@v5
93-
with:
94-
ref: ${{ github.ref }}
95-
fetch-depth: 0
96-
97-
- name: Install uv
98-
uses: astral-sh/setup-uv@v6
99-
with:
100-
version: "0.8.2"
101-
python-version: "3.11"
102-
103-
- name: Build all packages and publish
104-
run: make publish

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '.github/**'
9+
- '.devcontainer/**'
10+
- 'CHANGELOG.md'
11+
- 'MAINTAINERS.md'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
release-please:
19+
if: ${{ github.repository_owner == 'supabase' }}
20+
runs-on: ubuntu-latest
21+
name: "Bump version and create changelog"
22+
outputs:
23+
release_created: ${{ steps.release.outputs.release_created }}
24+
tag_name: ${{ steps.release.outputs.tag_name }}
25+
permissions:
26+
contents: write # needed for github actions bot to write to repo
27+
pull-requests: write
28+
steps:
29+
- uses: googleapis/release-please-action@v4
30+
id: release
31+
with:
32+
target-branch: ${{ github.ref_name }}
33+
34+
publish:
35+
needs: release-please
36+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
37+
runs-on: ubuntu-latest
38+
name: "Publish to PyPI"
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/supabase
42+
permissions:
43+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
44+
contents: read
45+
steps:
46+
- name: Clone Repository
47+
uses: actions/checkout@v5
48+
with:
49+
ref: ${{ needs.release-please.outputs.tag_name }}
50+
fetch-depth: 0
51+
52+
- name: Install supabase cli latest
53+
uses: supabase/setup-cli@v1
54+
with:
55+
version: "latest"
56+
57+
- name: Install uv
58+
uses: astral-sh/setup-uv@v6
59+
with:
60+
enable-cache: true
61+
cache-dependency-glob: "uv.lock"
62+
version: "0.8.2"
63+
python-version: "3.11"
64+
65+
- name: Install dependencies
66+
run: uv sync --all-extras --dev
67+
68+
- name: Run pre-publish checks
69+
run: |
70+
make pre-commit
71+
make ci
72+
73+
- name: Build all packages and publish
74+
run: make publish

CLAUDE.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is `supabase-py`, a Python monorepo containing all official Supabase client libraries for Python. The repository uses a workspace structure managed by `uv` with the following packages:
8+
9+
- `supabase` - Main Supabase client library
10+
- `realtime` - Realtime subscriptions client
11+
- `supabase_functions` - Edge Functions client
12+
- `storage3` - Storage client
13+
- `postgrest` - PostgREST client
14+
- `supabase_auth` - Authentication client
15+
16+
## Development Setup
17+
18+
### Prerequisites
19+
- `uv` for Python project management
20+
- `make` for command running
21+
- `docker` for test containers (postgrest, auth)
22+
- `supabase-cli` for test containers (storage, realtime)
23+
24+
### Environment Setup
25+
```bash
26+
# Create and activate virtual environment
27+
uv venv supabase-py
28+
source supabase-py/bin/activate
29+
uv sync
30+
```
31+
32+
### Alternative: Nix
33+
If you have Nix installed, use the development shell:
34+
```bash
35+
nix develop
36+
```
37+
38+
## Common Commands
39+
40+
### Testing
41+
```bash
42+
# Run all tests for all packages
43+
make ci
44+
45+
# Run tests in parallel (faster but messy output)
46+
make ci -j
47+
48+
# Run tests for specific package
49+
make realtime.tests
50+
make supabase.tests
51+
make storage.tests
52+
# etc.
53+
```
54+
55+
### Linting and Formatting
56+
```bash
57+
# Run pre-commit hooks (ruff lint/format, trailing whitespace, etc.)
58+
make pre-commit
59+
60+
# Run type checking for specific package
61+
make realtime.mypy
62+
```
63+
64+
### Infrastructure Management
65+
```bash
66+
# Start all test containers
67+
make start-infra
68+
69+
# Stop all test containers
70+
make stop-infra
71+
```
72+
73+
### Cleanup
74+
```bash
75+
# Clean all cache files and coverage reports
76+
make clean
77+
78+
# Clean specific package
79+
make realtime.clean
80+
```
81+
82+
### Building
83+
```bash
84+
# Build all packages
85+
make publish
86+
87+
# Build specific package
88+
make supabase.build
89+
```
90+
91+
## Architecture
92+
93+
### Monorepo Structure
94+
The codebase uses a `uv` workspace with each package in `src/` having its own:
95+
- `pyproject.toml` - Package configuration and dependencies
96+
- `Makefile` - Package-specific commands
97+
- `README.md` - Package documentation
98+
99+
### Async/Sync Pattern
100+
The `supabase` package maintains both async and sync versions:
101+
- `src/supabase/_async/` - Async implementations
102+
- `src/supabase/_sync/` - Auto-generated sync versions using `unasync`
103+
104+
The sync versions are generated via:
105+
```bash
106+
make supabase.unasync
107+
make supabase.build-sync
108+
```
109+
110+
### Testing Infrastructure
111+
- Tests require containers for services (PostgreSQL, Supabase services)
112+
- Each package with external dependencies has `start-infra`/`stop-infra` targets
113+
- Uses `pytest` with coverage reporting
114+
- Type checking with `mypy` where applicable
115+
116+
### Code Quality
117+
- `ruff` for linting and formatting
118+
- `pre-commit` hooks for automated checks
119+
- `commitizen` for conventional commits
120+
- Coverage reporting with `pytest-cov`
121+
122+
## Package-Specific Notes
123+
124+
### Realtime
125+
- Requires Supabase CLI containers for testing
126+
- Has mypy type checking
127+
128+
### Storage
129+
- Requires Supabase CLI containers for testing
130+
131+
### Auth & PostgREST
132+
- Require Docker containers for testing
133+
134+
### Functions
135+
- Standalone package with minimal infrastructure needs
136+
137+
### Supabase (Main Client)
138+
- Aggregates all other packages
139+
- Has special async/sync build process
140+
- Most complex package with full integration tests

0 commit comments

Comments
 (0)