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
44 changes: 40 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,47 @@ jobs:


build-wheels:
name: Build wheels (${{ matrix.os }}, py${{ matrix.python-version }})
name: Build wheels (${{ matrix.os }}, ${{ matrix.target || 'native' }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
needs: [test-native]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
# macOS ARM64 (native on macos-latest which is ARM)
- os: macos-latest
target: aarch64-apple-darwin
python-version: "3.10"
- os: macos-latest
target: aarch64-apple-darwin
python-version: "3.11"
- os: macos-latest
target: aarch64-apple-darwin
python-version: "3.12"
- os: macos-latest
target: aarch64-apple-darwin
python-version: "3.13"
- os: macos-latest
target: aarch64-apple-darwin
python-version: "3.14"
# macOS x86_64 (cross-compile from ARM runner)
- os: macos-latest
target: x86_64-apple-darwin
python-version: "3.10"
- os: macos-latest
target: x86_64-apple-darwin
python-version: "3.11"
- os: macos-latest
target: x86_64-apple-darwin
python-version: "3.12"
- os: macos-latest
target: x86_64-apple-darwin
python-version: "3.13"
- os: macos-latest
target: x86_64-apple-darwin
python-version: "3.14"

steps:
- name: Checkout
Expand All @@ -71,19 +104,22 @@ jobs:

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

# Build typeid-python wheel (includes rust extension)
- name: Build wheels (maturin)
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist
args: --release --out dist -i python${{ matrix.python-version }}
target: ${{ matrix.target }}
manylinux: "2_28"

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
name: wheels-${{ matrix.os }}-${{ matrix.target || 'native' }}-py${{ matrix.python-version }}
path: dist/*.whl

build-sdist:
Expand Down
19 changes: 2 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ Included:
```console
$ pip install typeid-python[yaml] # YAML schema support
$ pip install typeid-python[cli] # CLI tools
$ pip install typeid-python[pydantic] # Pydantic integration
```

Extras are **strictly optional**.
Expand Down Expand Up @@ -163,10 +162,6 @@ Integrations are provided as optional adapters, installed explicitly and kept se
* **Pydantic (v2)**
Native field type with validation and JSON Schema support.

```bash
pip install typeid-python[pydantic]
```

```python
from typing import Literal
from pydantic import BaseModel
Expand All @@ -176,19 +171,9 @@ Integrations are provided as optional adapters, installed explicitly and kept se
id: TypeIDField[Literal["user"]]
```

* **FastAPI**
Works automatically via Pydantic (request/response models, OpenAPI).

```bash
pip install typeid-python[fastapi]
```

* **SQLAlchemy**
Column types for storing TypeIDs (typically as strings).
* **FastAPI** (Coming Soon 🚧)

```bash
pip install typeid-python[sqlalchemy]
```
* **SQLAlchemy** (Coming Soon 🚧)

All integrations are **opt-in via extras** and never affect the core package.

Expand Down
20 changes: 3 additions & 17 deletions docs/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ Native support for using TypeID in Pydantic v2 models.
* Clean JSON Schema / OpenAPI output

```bash
pip install typeid-python[pydantic]
pip install typeid-python pydantic
```

See: [Pydantic v2](https://akhundmurad.github.io/typeid-python/integrations/pydantic/) documentation page for details and examples.

### FastAPI
### FastAPI (Coming Soon 🚧)

FastAPI builds on Pydantic v2, so TypeID works automatically in:

Expand All @@ -35,24 +35,10 @@ FastAPI builds on Pydantic v2, so TypeID works automatically in:

No separate FastAPI-specific adapter is required.

```bash
pip install typeid-python[fastapi]
```

See: [Pydantic v2](https://akhundmurad.github.io/typeid-python/integrations/fastapi/) documentation page for details and examples.

### SQLAlchemy
### SQLAlchemy (Coming Soon 🚧)

Column types for storing TypeIDs in relational databases.

Typical usage stores the full TypeID string (`prefix_suffix`) for clarity and debuggability.

```bash
pip install typeid-python[sqlalchemy]
```

See: [Pydantic v2](https://akhundmurad.github.io/typeid-python/integrations/sqlalchemy/) documentation page for details and examples.

## Design notes

* The TypeID core never imports framework code
Expand Down
15 changes: 0 additions & 15 deletions docs/integrations/pydantic.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ The adapter:

---

## Installation

```bash
pip install typeid-python[pydantic]
```

This installs the latest version of Pydantic v2.

## Basic usage

Use `TypeIDField` with a fixed prefix.
Expand Down Expand Up @@ -161,13 +153,6 @@ This works cleanly with:
Using `Literal` makes the prefix a real compile-time constant and avoids
annotation edge cases.

## FastAPI

FastAPI uses Pydantic v2, so no extra integration is needed.

TypeID fields work automatically in request and response models,
including OpenAPI output, as soon as you use them in a Pydantic model.

## Design notes

* The TypeID core does not import Pydantic.
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "typeid-python"
version = "0.3.7"
version = "0.3.8"
description = "Python implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs"
authors = [{ name = "Murad Akhundov", email = "akhundov1murad@gmail.com" }]
requires-python = ">=3.10,<4"
Expand All @@ -22,7 +22,6 @@ dependencies = ["uuid-utils>=0.12.0"]
[project.optional-dependencies]
cli = ["click"]
yaml = ["PyYAML"]
pydantic = ["pydantic>=2,<3"]

[project.urls]
Homepage = "https://github.com/akhundMurad/typeid-python"
Expand Down Expand Up @@ -51,6 +50,8 @@ dev = [
"pytest-benchmark>=5.0.1",
"maturin>=1.5; platform_system != 'Windows'",
"pre-commit>=4.5.1",
"httpx>=0.28.1",
"pydantic>=2,<3",
]

[tool.black]
Expand Down
2 changes: 1 addition & 1 deletion rust-base32/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-base32/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "typeid-base32"
version = "0.3.7"
version = "0.3.8"
edition = "2021"

description = "Rust-accelerated base32 codec for typeid-python"
Expand Down
63 changes: 57 additions & 6 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.