Skip to content
Open
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
33 changes: 13 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,40 @@ jobs:
- name: Install Pre-Commit
run: python -m pip install pre-commit && pre-commit install
- name: Load cached Pre-Commit Dependencies
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Execute Pre-Commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
pyton_tests:
python_tests:
name: "Python Tests"
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v7.1.0
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load Cached Venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: v1-venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Python Dependencies
run: poetry install --no-interaction --no-root
python-version: ${{ inputs.python-version }}
activate-environment: true
cache-dependency-glob: "**/uv.lock"
- name: Install project
run: uv pip install .
- name: Set pythonpath
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
- name: Install library
run: poetry run maturin develop
run: uv run maturin develop
- name: Test
run: poetry run pytest
run: uv run pytest
rust_tests:
name: "Rust Tests"
runs-on: ubuntu-latest
Expand All @@ -83,14 +76,14 @@ jobs:
run: CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test
- name: Generate Coverage Report
run: mkdir coverage && grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o coverage.lcov
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4.6.2
with:
name: coverage-lcov
path: coverage.lcov
sonar:
name: "Sonar"
needs:
- pyton_tests
- python_tests
- rust_tests
- validate
if: github.event.pull_request.head.repo.fork == false
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
pip install pytest
pytest -v
- name: Upload wheels
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: dist
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
pip install pytest
python -m pytest -v
- name: Upload wheels
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: dist
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
pip install pytest
pytest -v
- name: Upload wheels
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: dist
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
pip install pytest
pytest -v
- name: Upload wheels
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: dist
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links /io/dist/ --force-reinstall
python3 -m pytest
- name: Upload wheels
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: dist
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
python3 -m pytest
- name: Upload wheels
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: dist
Expand Down
7 changes: 1 addition & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.285"
rev: "v0.14.1"
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
args: [--config=./pyproject.toml]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
Expand Down
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
[profile.release]
codegen-units = 1
lto = "fat"
panic = "abort"
strip = "symbols"

[package]
name = "fast_query_parsers"
authors = ["Na'aman Hirschfeld <nhirschfeld@gmail.com>"]
description = "Ultra-fast query string and url-encoded form-data parsers"
readme = "README.md"
license-file = "LICENSE"
repository = "https://github.com/starlite-api/fast-query-parsers"
repository = "https://github.com/litestar-org/fast-query-parsers"
version = "1.0.3"
edition = "2021"

Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
This library includes ultra-fast Rust based query string and urlencoded parsers. These parsers are used
by [`Litestar`](https://github.com/litestar-org/litestar), but are developed separately - and can of course be used separately.

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

</div>

## Installation
Expand Down Expand Up @@ -153,14 +150,14 @@ All contributions are of course welcome!

### Repository Setup

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

### Building

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

### Benchmarking

There are basic benchmarks using pyperf in place. To run these execute `poetry run python benchrmarks.py`.
There are basic benchmarks using pyperf in place. To run these execute `uv run benchmarks.py`.
2 changes: 2 additions & 0 deletions benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from urllib.parse import urlencode

import pyperf

from fast_query_parsers import parse_query_string, parse_url_encoded_dict

url_encoded_query = urlencode(
Expand All @@ -32,6 +33,7 @@ def parse_url_encoded_form_data(encoded_data: bytes) -> Dict[str, Any]:
Returns:
-------
A parsed dict.

"""
decoded_dict: DefaultDict[str, List[Any]] = defaultdict(list)
for k, v in stdlib_parse_qsl(encoded_data.decode(), keep_blank_values=True):
Expand Down
173 changes: 0 additions & 173 deletions poetry.lock

This file was deleted.

Loading
Loading