Skip to content

Commit 0b7b1eb

Browse files
build: migrate from poetry to uv (#33)
Co-authored-by: Harshal Laheri <[email protected]>
1 parent 2a412bf commit 0b7b1eb

File tree

10 files changed

+506
-265
lines changed

10 files changed

+506
-265
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,40 @@ jobs:
2020
- name: Install Pre-Commit
2121
run: python -m pip install pre-commit && pre-commit install
2222
- name: Load cached Pre-Commit Dependencies
23-
id: cached-poetry-dependencies
2423
uses: actions/cache@v3
2524
with:
2625
path: ~/.cache/pre-commit/
2726
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
2827
- name: Execute Pre-Commit
2928
run: pre-commit run --show-diff-on-failure --color=always --all-files
30-
pyton_tests:
29+
python_tests:
3130
name: "Python Tests"
3231
runs-on: ubuntu-latest
3332
strategy:
3433
fail-fast: true
3534
matrix:
36-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
35+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3736
steps:
3837
- name: Checkout repository
3938
uses: actions/checkout@v4
4039
- name: Setup Python ${{ matrix.python-version }}
4140
uses: actions/setup-python@v5
4241
with:
4342
python-version: ${{ matrix.python-version }}
44-
- name: Install Poetry
45-
uses: snok/install-poetry@v1
43+
- name: Install uv
44+
uses: astral-sh/[email protected]
4645
with:
47-
virtualenvs-create: true
48-
virtualenvs-in-project: true
49-
installer-parallel: true
50-
- name: Load Cached Venv
51-
id: cached-poetry-dependencies
52-
uses: actions/cache@v3
53-
with:
54-
path: .venv
55-
key: v1-venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
56-
- name: Install Python Dependencies
57-
run: poetry install --no-interaction --no-root
46+
python-version: ${{ inputs.python-version }}
47+
activate-environment: true
48+
cache-dependency-glob: "**/uv.lock"
49+
- name: Install project
50+
run: uv pip install .
5851
- name: Set pythonpath
5952
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
6053
- name: Install library
61-
run: poetry run maturin develop
54+
run: uv run maturin develop
6255
- name: Test
63-
run: poetry run pytest
56+
run: uv run pytest
6457
rust_tests:
6558
name: "Rust Tests"
6659
runs-on: ubuntu-latest
@@ -83,14 +76,14 @@ jobs:
8376
run: CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test
8477
- name: Generate Coverage Report
8578
run: mkdir coverage && grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o coverage.lcov
86-
- uses: actions/upload-artifact@v3
79+
- uses: actions/upload-artifact@v4.6.2
8780
with:
8881
name: coverage-lcov
8982
path: coverage.lcov
9083
sonar:
9184
name: "Sonar"
9285
needs:
93-
- pyton_tests
86+
- python_tests
9487
- rust_tests
9588
- validate
9689
if: github.event.pull_request.head.repo.fork == false

.github/workflows/publish.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
pip install pytest
4848
pytest -v
4949
- name: Upload wheels
50-
uses: actions/upload-artifact@v3
50+
uses: actions/upload-artifact@v4.6.2
5151
with:
5252
name: wheels
5353
path: dist
@@ -81,7 +81,7 @@ jobs:
8181
pip install pytest
8282
python -m pytest -v
8383
- name: Upload wheels
84-
uses: actions/upload-artifact@v3
84+
uses: actions/upload-artifact@v4.6.2
8585
with:
8686
name: wheels
8787
path: dist
@@ -110,7 +110,7 @@ jobs:
110110
pip install pytest
111111
pytest -v
112112
- name: Upload wheels
113-
uses: actions/upload-artifact@v3
113+
uses: actions/upload-artifact@v4.6.2
114114
with:
115115
name: wheels
116116
path: dist
@@ -147,7 +147,7 @@ jobs:
147147
pip install pytest
148148
pytest -v
149149
- name: Upload wheels
150-
uses: actions/upload-artifact@v3
150+
uses: actions/upload-artifact@v4.6.2
151151
with:
152152
name: wheels
153153
path: dist
@@ -183,7 +183,7 @@ jobs:
183183
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links /io/dist/ --force-reinstall
184184
python3 -m pytest
185185
- name: Upload wheels
186-
uses: actions/upload-artifact@v3
186+
uses: actions/upload-artifact@v4.6.2
187187
with:
188188
name: wheels
189189
path: dist
@@ -221,7 +221,7 @@ jobs:
221221
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
222222
python3 -m pytest
223223
- name: Upload wheels
224-
uses: actions/upload-artifact@v3
224+
uses: actions/upload-artifact@v4.6.2
225225
with:
226226
name: wheels
227227
path: dist

.pre-commit-config.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ repos:
1616
- id: mixed-line-ending
1717
- id: trailing-whitespace
1818
- repo: https://github.com/charliermarsh/ruff-pre-commit
19-
rev: "v0.0.285"
19+
rev: "v0.14.1"
2020
hooks:
2121
- id: ruff
2222
args: ["--fix"]
23-
- repo: https://github.com/psf/black
24-
rev: 23.7.0
25-
hooks:
26-
- id: black
27-
args: [--config=./pyproject.toml]
2823
- repo: https://github.com/codespell-project/codespell
2924
rev: v2.2.5
3025
hooks:

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
[profile.release]
2+
codegen-units = 1
3+
lto = "fat"
4+
panic = "abort"
5+
strip = "symbols"
6+
17
[package]
28
name = "fast_query_parsers"
39
authors = ["Na'aman Hirschfeld <[email protected]>"]
410
description = "Ultra-fast query string and url-encoded form-data parsers"
511
readme = "README.md"
612
license-file = "LICENSE"
7-
repository = "https://github.com/starlite-api/fast-query-parsers"
13+
repository = "https://github.com/litestar-org/fast-query-parsers"
814
version = "1.0.3"
915
edition = "2021"
1016

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
This library includes ultra-fast Rust based query string and urlencoded parsers. These parsers are used
2525
by [`Litestar`](https://github.com/litestar-org/litestar), but are developed separately - and can of course be used separately.
2626

27-
> [!IMPORTANT]\
28-
> [**_Starlite has been renamed to Litestar_**](https://litestar.dev/about/organization.html#litestar-and-starlite)
29-
3027
</div>
3128

3229
## Installation
@@ -153,14 +150,14 @@ All contributions are of course welcome!
153150

154151
### Repository Setup
155152

156-
1. Run `cargo install` to setup the rust dependencies and `poetry install` to setup the python dependencies.
153+
1. Run `cargo install` to setup the rust dependencies and `uv sync` to setup the python dependencies.
157154
2. Install the pre-commit hooks with `pre-commit install` (requires [pre-commit](https://pre-commit.com/)).
158155

159156
### Building
160157

161-
Run `poetry run maturin develop --release --strip` to install a release wheel (without debugging info). This wheel can be
158+
Run `uv run maturin develop --release`. This wheel can be
162159
used in tests and benchmarks.
163160

164161
### Benchmarking
165162

166-
There are basic benchmarks using pyperf in place. To run these execute `poetry run python benchrmarks.py`.
163+
There are basic benchmarks using pyperf in place. To run these execute `uv run benchmarks.py`.

benchmarks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from urllib.parse import urlencode
88

99
import pyperf
10+
1011
from fast_query_parsers import parse_query_string, parse_url_encoded_dict
1112

1213
url_encoded_query = urlencode(
@@ -32,6 +33,7 @@ def parse_url_encoded_form_data(encoded_data: bytes) -> Dict[str, Any]:
3233
Returns:
3334
-------
3435
A parsed dict.
36+
3537
"""
3638
decoded_dict: DefaultDict[str, List[Any]] = defaultdict(list)
3739
for k, v in stdlib_parse_qsl(encoded_data.decode(), keep_blank_values=True):

poetry.lock

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

0 commit comments

Comments
 (0)