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 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
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
27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

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
45 changes: 45 additions & 0 deletions cli_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import subprocess


def uvx(*cmds: str):
return subprocess.run(["uv", "run", *cmds], check=True)


def precommit():
return uvx("pre-commit", "run", "--all-files")


def pytest():
return uvx("pytest", "--cov=./", "--cov-report=xml", "--cov-report=html", "-vv")


def unasync():
return uvx("unasync", "supabase", "tests")


def sed(before: str, after: str):
return subprocess.run(["sed", "-i", "", before, after], check=True)


def build_sync():
substs = [
(
"s/asyncio.create_task(self.realtime.set_auth(access_token))//g",
"supabase/_sync/client.py",
),
("s/asynch/synch/g", "supabase/_sync/auth_client.py"),
("s/Async/Sync/g", "supabase/_sync/auth_client.py"),
("s/Async/Sync/g", "supabase/_sync/client.py"),
("s/create_async_client/create_client/g", "tests/_sync/test_client.py"),
("s/SyncClient/Client/gi", "tests/_sync/test_client.py"),
("s/SyncHTTPTransport/HTTPTransport/g", "tests/_sync/test_client.py"),
("s/SyncMock/Mock/g", "tests/_sync/test_client.py"),
]
unasync()
for left, right in substs:
sed(left, right)


def run_tests():
precommit()
pytest()
16 changes: 0 additions & 16 deletions poetry_scripts.py

This file was deleted.

90 changes: 61 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,76 @@
[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>"]
homepage = "https://github.com/supabase/supabase-py"
repository = "https://github.com/supabase/supabase-py"
documentation = "https://github.com/supabase/supabase-py"
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" },
]
readme = "README.md"
license = "MIT"
license-files = [ "LICENSE" ]
classifiers = [
"Programming Language :: Python :: 3",
"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",
]

[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"
[project.urls]
homepage = "https://github.com/supabase/supabase-py"
repository = "https://github.com/supabase/supabase-py"
documentation = "https://github.com/supabase/supabase-py"

[project.scripts]
tests = "cli_scripts:run_tests"
build_sync = "cli_scripts:build_sync"

[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.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