Skip to content

chore: use uv instead of poetry #1186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from 7 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
27 changes: 10 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ jobs:
- name: Clone Repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.2"
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
run: pipx install poetry==1.8.5 --python python${{ matrix.python-version }}

- name: Run Tests
run: poetry run tests
run: uv run tests

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
Expand Down Expand Up @@ -85,25 +83,20 @@ jobs:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # needed for github actions bot to write to repo
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Clone Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Set up Poetry
run: pipx install poetry==1.8.5 --python python3.11

- name: Install dependencies
run: poetry install
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.2"
python-version: "3.11"

- name: Build package dist directory
run: poetry build
run: uv build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ cd supabase-py

### Create and Activate a Virtual Environment

We recommend activating your virtual environment. For example, we like `poetry` and `conda`! Click [here](https://docs.python.org/3/library/venv.html) for more about Python virtual environments and working with [conda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment) and [poetry](https://python-poetry.org/docs/basic-usage/).
We recommend activating your virtual environment. For example, we like `uv` and `conda`! Click [here](https://docs.python.org/3/library/venv.html) for more about Python virtual environments and working with [conda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment) and [uv](https://docs.astral.sh/uv/getting-started/features/).

Using uv:
```
uv venv supabase-py
source supabase-py/bin/activate
```

Using venv (Python 3 built-in):

Expand Down
20 changes: 20 additions & 0 deletions cli_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from subprocess import Popen


def spawn(cmd: str) -> Popen:
return Popen(cmd.split())


def spawn_precommit() -> Popen:
return spawn("uv run pre-commit run --all-files")


def spawn_pytest() -> Popen:
return spawn("uv run pytest --cov=./ --cov-report=xml --cov-report=html -vv")


def run_tests():
# Install requirements
with spawn_precommit() as precommit, spawn_pytest() as pytests:
pass # implicitly wait for all of them to return
return precommit.returncode and pytests.returncode
16 changes: 0 additions & 16 deletions poetry_scripts.py

This file was deleted.

79 changes: 54 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
[tool.poetry]
[project]
name = "supabase"
version = "2.17.0" # {x-release-please-version}
description = "Supabase client for Python."
authors = ["Joel Lee <joel@joellee.org>", "Leon Fedden <leonfedden@gmail.com>", "Daniel Reinón García <danielreinon@outlook.com>", "Leynier Gutiérrez González <leynier41@gmail.com>", "Anand", "Andrew Smith <a.smith@silentworks.co.uk>"]
authors = [
{ name = "Joel Lee", email = "joel@joellee.org" },
{ name = "Leon Fedden", email = "leonfedden@gmail.com" },
{ name = "Daniel Reinón García", email = "danielreinon@outlook.com" },
{ name = "Leynier Gutiérrez González", email = "leynier41@gmail.com" },
{ name = "Anand" },
{ name = "Andrew Smith", email = "a.smith@silentworks.co.uk" },
]
homepage = "https://github.com/supabase/supabase-py"
repository = "https://github.com/supabase/supabase-py"
documentation = "https://github.com/supabase/supabase-py"
Expand All @@ -13,32 +20,54 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
]
requires-python = ">=3.9"
dependencies = [
"postgrest >= 1.1.1",
"realtime >= 2.6.0",
"gotrue >= 2.12.3",
"storage3 >= 0.12.0",
"supafunc >= 0.10.1",
"httpx >=0.26,<0.29",
]

[project.scripts]
tests = 'cli_scripts:run_tests'

[dependency-groups]
dev = [
{ include-group = "pre-commit" },
{ include-group = "tests" },
{ include-group = "lints" },
]
pre-commit = [
"pre-commit >= 4.1.0",
"commitizen >=4.8.3",
]
tests = [
"pytest >= 8.4.1",
"pytest-cov >= 6.2.1",
"pytest-asyncio >=0.24,<1.1",
"python-dotenv >= 1.1.1",
]
lints = [
"unasync-cli",
"ruff >=0.12.1",
]

[tool.uv]
default-groups = [ "dev" ]

[tool.poetry.dependencies]
python = "^3.9"
postgrest = "1.1.1"
realtime = "2.6.0"
gotrue = "2.12.3"
storage3 = "0.12.0"
supafunc = "0.10.1"
httpx = ">=0.26,<0.29"

[tool.poetry.group.dev.dependencies]
pre-commit = "^4.1.0"
pytest = "^8.4.1"
pytest-cov = "^6.2.1"
commitizen = "^4.8.3"
python-dotenv = "^1.1.1"

[tool.uv.sources]
unasync-cli = { git = "https://github.com/supabase-community/unasync-cli.git", branch = "main" }
pytest-asyncio = ">=0.24,<1.1"
ruff = "^0.12.1"

[tool.poetry.scripts]
tests = 'poetry_scripts:run_tests'
[build-system]
requires = ["uv_build>=0.8.3,<0.9.0"]
build-backend = "uv_build"

[tool.uv.build-backend]
module-name = "supabase"
module-root = ""

[tool.pytest.ini_options]
asyncio_mode = "auto"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Loading