Skip to content

Commit 054f605

Browse files
authored
chore: use uv instead of poetry (#1186)
1 parent 12c5fc9 commit 054f605

File tree

7 files changed

+1418
-90
lines changed

7 files changed

+1418
-90
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,14 @@ jobs:
2828
- name: Clone Repository
2929
uses: actions/checkout@v4
3030

31-
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v5
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v6
3333
with:
34+
version: "0.8.2"
3435
python-version: ${{ matrix.python-version }}
3536

36-
- name: Set up Poetry
37-
run: pipx install poetry==1.8.5 --python python${{ matrix.python-version }}
38-
3937
- name: Run Tests
40-
run: poetry run tests
38+
run: uv run tests
4139

4240
- name: Upload coverage to Coveralls
4341
uses: coverallsapp/github-action@v2
@@ -85,25 +83,20 @@ jobs:
8583
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
8684
contents: write # needed for github actions bot to write to repo
8785
steps:
88-
- name: Set up Python 3.11
89-
uses: actions/setup-python@v5
90-
with:
91-
python-version: 3.11
92-
9386
- name: Clone Repository
9487
uses: actions/checkout@v4
9588
with:
9689
ref: ${{ github.ref }}
9790
fetch-depth: 0
9891

99-
- name: Set up Poetry
100-
run: pipx install poetry==1.8.5 --python python3.11
101-
102-
- name: Install dependencies
103-
run: poetry install
92+
- name: Install uv
93+
uses: astral-sh/setup-uv@v6
94+
with:
95+
version: "0.8.2"
96+
python-version: "3.11"
10497

10598
- name: Build package dist directory
106-
run: poetry build
99+
run: uv build
107100

108101
- name: Publish package distributions to PyPI
109102
uses: pypa/gh-action-pypi-publish@release/v1

Makefile

Lines changed: 0 additions & 27 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ cd supabase-py
1818

1919
### Create and Activate a Virtual Environment
2020

21-
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/).
21+
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/).
22+
23+
Using uv:
24+
```
25+
uv venv supabase-py
26+
source supabase-py/bin/activate
27+
```
2228

2329
Using venv (Python 3 built-in):
2430

cli_scripts.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import subprocess
2+
3+
4+
def uvx(*cmds: str):
5+
return subprocess.run(["uv", "run", *cmds], check=True)
6+
7+
8+
def precommit():
9+
return uvx("pre-commit", "run", "--all-files")
10+
11+
12+
def pytest():
13+
return uvx("pytest", "--cov=./", "--cov-report=xml", "--cov-report=html", "-vv")
14+
15+
16+
def unasync():
17+
return uvx("unasync", "supabase", "tests")
18+
19+
20+
def sed(before: str, after: str):
21+
return subprocess.run(["sed", "-i", "", before, after], check=True)
22+
23+
24+
def build_sync():
25+
substs = [
26+
(
27+
"s/asyncio.create_task(self.realtime.set_auth(access_token))//g",
28+
"supabase/_sync/client.py",
29+
),
30+
("s/asynch/synch/g", "supabase/_sync/auth_client.py"),
31+
("s/Async/Sync/g", "supabase/_sync/auth_client.py"),
32+
("s/Async/Sync/g", "supabase/_sync/client.py"),
33+
("s/create_async_client/create_client/g", "tests/_sync/test_client.py"),
34+
("s/SyncClient/Client/gi", "tests/_sync/test_client.py"),
35+
("s/SyncHTTPTransport/HTTPTransport/g", "tests/_sync/test_client.py"),
36+
("s/SyncMock/Mock/g", "tests/_sync/test_client.py"),
37+
]
38+
unasync()
39+
for left, right in substs:
40+
sed(left, right)
41+
42+
43+
def run_tests():
44+
precommit()
45+
pytest()

poetry_scripts.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

pyproject.toml

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,76 @@
1-
[tool.poetry]
1+
[project]
22
name = "supabase"
33
version = "2.17.0" # {x-release-please-version}
44
description = "Supabase client for Python."
5-
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>"]
6-
homepage = "https://github.com/supabase/supabase-py"
7-
repository = "https://github.com/supabase/supabase-py"
8-
documentation = "https://github.com/supabase/supabase-py"
5+
authors = [
6+
{ name = "Joel Lee", email = "joel@joellee.org" },
7+
{ name = "Leon Fedden", email = "leonfedden@gmail.com" },
8+
{ name = "Daniel Reinón García", email = "danielreinon@outlook.com" },
9+
{ name = "Leynier Gutiérrez González", email = "leynier41@gmail.com" },
10+
{ name = "Anand" },
11+
{ name = "Andrew Smith", email = "a.smith@silentworks.co.uk" },
12+
]
913
readme = "README.md"
1014
license = "MIT"
15+
license-files = [ "LICENSE" ]
1116
classifiers = [
1217
"Programming Language :: Python :: 3",
13-
"License :: OSI Approved :: MIT License",
1418
"Operating System :: OS Independent"
1519
]
20+
requires-python = ">=3.9"
21+
dependencies = [
22+
"postgrest == 1.1.1",
23+
"realtime == 2.6.0",
24+
"gotrue == 2.12.3",
25+
"storage3 == 0.12.0",
26+
"supafunc == 0.10.1",
27+
"httpx >=0.26,<0.29",
28+
]
1629

17-
[tool.poetry.dependencies]
18-
python = "^3.9"
19-
postgrest = "1.1.1"
20-
realtime = "2.6.0"
21-
gotrue = "2.12.3"
22-
storage3 = "0.12.0"
23-
supafunc = "0.10.1"
24-
httpx = ">=0.26,<0.29"
25-
26-
[tool.poetry.group.dev.dependencies]
27-
pre-commit = "^4.1.0"
28-
pytest = "^8.4.1"
29-
pytest-cov = "^6.2.1"
30-
commitizen = "^4.8.3"
31-
python-dotenv = "^1.1.1"
30+
[project.urls]
31+
homepage = "https://github.com/supabase/supabase-py"
32+
repository = "https://github.com/supabase/supabase-py"
33+
documentation = "https://github.com/supabase/supabase-py"
34+
35+
[project.scripts]
36+
tests = "cli_scripts:run_tests"
37+
build_sync = "cli_scripts:build_sync"
38+
39+
[dependency-groups]
40+
dev = [
41+
{ include-group = "pre-commit" },
42+
{ include-group = "tests" },
43+
{ include-group = "lints" },
44+
]
45+
pre-commit = [
46+
"pre-commit >= 4.1.0",
47+
"commitizen >=4.8.3",
48+
]
49+
tests = [
50+
"pytest >= 8.4.1",
51+
"pytest-cov >= 6.2.1",
52+
"pytest-asyncio >=0.24,<1.1",
53+
"python-dotenv >= 1.1.1",
54+
]
55+
lints = [
56+
"unasync-cli",
57+
"ruff >=0.12.1",
58+
]
59+
60+
[tool.uv]
61+
default-groups = [ "dev" ]
62+
63+
64+
[tool.uv.sources]
3265
unasync-cli = { git = "https://github.com/supabase-community/unasync-cli.git", branch = "main" }
33-
pytest-asyncio = ">=0.24,<1.1"
34-
ruff = "^0.12.1"
3566

36-
[tool.poetry.scripts]
37-
tests = 'poetry_scripts:run_tests'
67+
[build-system]
68+
requires = ["uv_build>=0.8.3,<0.9.0"]
69+
build-backend = "uv_build"
70+
71+
[tool.uv.build-backend]
72+
module-name = "supabase"
73+
module-root = ""
3874

3975
[tool.pytest.ini_options]
4076
asyncio_mode = "auto"
41-
42-
[build-system]
43-
requires = ["poetry-core>=1.0.0"]
44-
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)