Skip to content
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
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
name: Creating source release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v6.0.2

- name: Setting up Python
uses: actions/setup-python@v5.4.0
uses: actions/setup-python@v6.2.0
with:
python-version: 3.9
python-version: "3.9"

- name: Installing python build dependencies
run: |
Expand All @@ -35,7 +35,7 @@ jobs:
run: |
pytest

- uses: actions/upload-artifact@v4.3.1
- uses: actions/upload-artifact@v6.0.0
with:
name: dist-sdist
path: dist/*.tar.gz
Expand All @@ -50,32 +50,32 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, windows-2022, macos-13]
py: ["cp39", "cp310", "cp311", "cp312", "cp313"]
os: [ubuntu-22.04, windows-2022, macos-15]
py: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"]

steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v6.0.2

- uses: actions/setup-python@v5.4.0
- uses: actions/setup-python@v6.2.0
name: Setting up Python
with:
python-version: '3.9'
python-version: "3.9"

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3.7.0
with:
platforms: all

- name: Build & test wheels
uses: pypa/cibuildwheel@v2.22.0
uses: pypa/cibuildwheel@v3.3.1
env:
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
CIBW_BUILD: "${{ matrix.py }}-*"
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64"

- uses: actions/upload-artifact@v4.3.1
- uses: actions/upload-artifact@v6.0.0
with:
name: dist-${{ matrix.os }}-${{ matrix.py }}
path: ./wheelhouse/*.whl
Expand All @@ -85,13 +85,13 @@ jobs:
name: Uploading built packages to pypi for release.
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4.1.4
- uses: actions/download-artifact@v7.0.0
with:
pattern: dist-*
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@v1.8.14
- uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, windows-2022]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-22.04, macos-15, windows-2022]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v6.0.2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.python-version }}

Expand Down
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.15...3.30)
project(can_ada LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(nanobind CONFIG REQUIRED)

nanobind_add_module(can_ada src/binding.cpp src/ada.cpp)
target_compile_definitions(can_ada PRIVATE VERSION_INFO=${SKBUILD_PROJECT_VERSION})

install(TARGETS can_ada LIBRARY DESTINATION .)
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ C++17-or-greater compiler will be required to build the underlying Ada library.

## WHATWG URL compliance

Unlike the standard library's `urllib.parse` module, this library is compliant with the WHATWG URL specification.
Unlike the standard library's `urllib.parse` module, this library is compliant
with the WHATWG URL specification.

```python
import can_ada
Expand Down Expand Up @@ -82,13 +83,14 @@ print(params.values()) # ["usa", "off", "2", "3"]
We find that `can_ada` is typically ~4x faster than urllib:

```
---------------------------------------------------------------------------------
Name (time in ms) Min Max Mean
---------------------------------------------------------------------------------
test_can_ada_parse 54.1304 (1.0) 54.6734 (1.0) 54.3699 (1.0)
test_ada_python_parse 107.5653 (1.99) 108.1666 (1.98) 107.7817 (1.98)
test_urllib_parse 251.5167 (4.65) 255.1327 (4.67) 253.2407 (4.66)
---------------------------------------------------------------------------------
------------------------------------------------------------------------------------- benchmark: 4 tests ------------------------------------------------------------------------------------
Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_can_ada_parse 36.7565 (1.0) 40.3057 (1.0) 37.1606 (1.0) 0.6789 (1.0) 36.9869 (1.0) 0.2526 (1.0) 2;3 26.9102 (1.0) 27 1
test_ada_python_parse 134.0627 (3.65) 143.6443 (3.56) 135.8992 (3.66) 3.1977 (4.71) 134.7860 (3.64) 1.2441 (4.92) 1;1 7.3584 (0.27) 8 1
test_urllib_parse 208.8403 (5.68) 212.9208 (5.28) 211.2021 (5.68) 1.7273 (2.54) 211.3141 (5.71) 2.9319 (11.60) 1;0 4.7348 (0.18) 5 1
test_yarl_parse 238.6351 (6.49) 246.4206 (6.11) 242.4351 (6.52) 3.4108 (5.02) 241.8302 (6.54) 6.1566 (24.37) 2;0 4.1248 (0.15) 5 1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
```

To run the benchmarks locally, use:
Expand All @@ -97,4 +99,4 @@ To run the benchmarks locally, use:
pytest --runslow
```

[Ada]: https://ada-url.com/
[Ada]: https://ada-url.com/
25 changes: 20 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
[build-system]
requires = [
"setuptools>=42",
"pybind11>=2.10.0",
]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core>=0.10", "nanobind>=2.0.0"]
build-backend = "scikit_build_core.build"

[project]
name = "can_ada"
version = "3.0.0"
description = "Ada is a fast spec-compliant url parser"
readme = "README.md"
license = "MIT"
authors = [{ name = "Tyler Kennedy", email = "tk@tkte.ch" }]
requires-python = ">=3.9"

[project.urls]
Homepage = "https://github.com/tktech/can_ada"

[project.optional-dependencies]
test = ["pytest", "pytest-benchmark", "ada_url", "yarl"]

[tool.scikit-build]
wheel.packages = ["can_ada-stubs"]
36 changes: 0 additions & 36 deletions setup.py

This file was deleted.

Loading