pyjwt-rs
jwt_rs는 PyJWT 호환을 목표로 하는 Rust 기반 Python 확장 모듈입니다.
핵심 목표는 두 가지입니다.
- 같은 코드에
import jwt_rs as jwt만 바꿔서 동작할 것 - Rust 코어로 주요 공개키 JWT workload에서
PyJWT보다 더 빠를 것
Current Status
현재 공개 표면은 PyJWT 스타일을 유지합니다.
encode(payload, key, algorithm="HS256", headers=None)decode(token, key, algorithms=None, options=None, audience=None, issuer=None, leeway=0)decode_complete(...)get_unverified_header(token)PyJWS,PyJWK, algorithm registry
현재 지원 알고리즘:
- HMAC:
HS256,HS384,HS512 - RSA:
RS256,RS384,RS512,PS256,PS384,PS512 - EC:
ES256,ES384,ES512,ES256K EdDSA
테스트 상태:
324 passed
품질 정책:
- 테스트는 hidden warning 없이 통과해야 합니다. CI는
-W error기반 게이트를 사용합니다. - 의도된 skip은
.quality/pytest-allowlist.json에 명시되어야 합니다. - 릴리스/호환성 작업은 공개 GitHub issue와 milestone으로 추적합니다.
- 자세한 운영 정책은 CONTRIBUTING.md, 호환성 갭은 COMPATIBILITY_CHECKLIST.md 에서 관리합니다.
Usage
import jwt_rs as jwt
token = jwt.encode({"sub": "alice"}, "secret", algorithm="HS256")
claims = jwt.decode(token, "secret", algorithms=["HS256"])
header = jwt.get_unverified_header(token)
Performance
성능 목표는 모든 경로 일괄 2배가 아니라, 먼저 실사용 공개키 경로에서 PyJWT를 확실히 추월하는 것입니다.
아래 블록은 benchmark 스크립트로 자동 생성됩니다. 수동으로 적지 않습니다.
Auto-generated from scripts/benchmark_same_api.py on 2026-04-21T07:14:04+00:00 using --iterations 150 --warmup 20.
현재 same-API benchmark 기준:
| Case | encode | decode | decode_complete |
|---|---|---|---|
hs256 |
1.43x |
2.10x |
2.04x |
rs256 |
59.10x |
2.15x |
2.13x |
es256 |
3.12x |
1.76x |
1.81x |
eddsa |
1.59x |
1.06x |
1.06x |
좋은 구간:
rs256.encode:jwt_rs가PyJWT대비59.10xes256.encode:jwt_rs가PyJWT대비3.12xes256.decode:jwt_rs가PyJWT대비1.76xeddsa.encode:jwt_rs가PyJWT대비1.59x
아직 미달인 구간:
- 현재 주요 추적 경로는 모두
PyJWT이상입니다.
해석:
1.00x초과면jwt_rs가 빠릅니다.2.00x이상이면 README 목표인PyJWT 대비 2배를 넘긴 것입니다.- 현재 목표는 특히 공개키 경로에서 이 값을 끌어올리는 것입니다.
벤치 재현 명령:
uv run --with pyjwt python scripts/benchmark_same_api.py --iterations 150 --warmup 20
README 자동 갱신 명령:
uv run python scripts/update_readme_bench.py
Development
source "$HOME/.cargo/env"
cd pyjwt-rs
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
uv run --with maturin maturin develop
uv run pytest -q
Notes
- Python은 호환 인터페이스를 담당하고, 코어 sign/verify hot path는 Rust가 담당합니다.
- 현재 공개키 알고리즘 경로는 Rust 내부 OpenSSL backend를 사용합니다.
options={"verify_signature": False}경로는 별도 insecure decode 흐름을 사용합니다.- 완전한
PyJWTparity를 목표로 하지만, 성능 최적화를 위해 내부 구현은PyJWT와 다릅니다. - 배포 버전과
PyJWT호환 버전 구분은 VERSIONING.md 에 정리했습니다.
Metadata
Release files for pyjwt-rs 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyjwt_rs-1.2.2.tar.gz | 181.0 kB | Without provenance | Details for pyjwt_rs-1.2.2.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pyjwt_rs-1.2.2-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details for pyjwt_rs-1.2.2-cp312-cp312-win_amd64.whl |
| pyjwt_rs-1.2.2-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details for pyjwt_rs-1.2.2-cp312-cp312-macosx_11_0_arm64.whl |
| pyjwt_rs-1.2.2-cp312-cp312-macosx_10_12_x86_64.whl | CPython 3.12 | CPython 3.12 | macOS 10.12+ x86-64 | Details for pyjwt_rs-1.2.2-cp312-cp312-macosx_10_12_x86_64.whl |
| pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details for pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_x86_64.whl |
| pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_aarch64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ ARM64 | Details for pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_aarch64.whl |
Total release size: 12.2 MB
Release files / pyjwt_rs-1.2.2.tar.gz
| Download URL | pyjwt_rs-1.2.2.tar.gz |
|---|---|
| Size | 181.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf430e71fd772e0e23ed1e69bc2840505a3c9edc89e32f698492ae8bbd270673
|
|
BLAKE2b-256 checksum How to use checksums |
bda139b122034986cb4e130f225a7d7a4ec39d711c04d2bc8d0d02f17d680ff1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / pyjwt_rs-1.2.2-cp312-cp312-win_amd64.whl
| Download URL | pyjwt_rs-1.2.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2dcf5a5dbfda3cfcf65263f6248f9f16a46106bbfa962355fe169e855d5861ed
|
|
BLAKE2b-256 checksum How to use checksums |
218e045e1b65c7b62b211932deba4f319bb576507edb30f6cb02cf935f691234
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / pyjwt_rs-1.2.2-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pyjwt_rs-1.2.2-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fba4cafdfdbe2f65b7b5f3df38ffa1042cbd0862367afc95ff9567a4e67f5038
|
|
BLAKE2b-256 checksum How to use checksums |
0fccdd7582650f41e0feed2976edb15b7f5c6fdd291be65beddb90ab62baf147
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / pyjwt_rs-1.2.2-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | pyjwt_rs-1.2.2-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
dd09613d7ddd2726f7529d4260c4802ddc5eff5b0e574ad89e539617c9829dae
|
|
BLAKE2b-256 checksum How to use checksums |
abd8ed66682a8b870b39aba1be0442f6ea3e5286f4c3dcadc94a48e8ad02dcc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6bd94da460216257751e66ce93558f248c9d01660e0e7265892a9ff0cc2d48a9
|
|
BLAKE2b-256 checksum How to use checksums |
8d8122f295453c44858b93ab971e2c2349b5ade66c7653e2fe12f8e75e0ffd54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_aarch64.whl
| Download URL | pyjwt_rs-1.2.2-cp310-cp310-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
b4440d2a8e894dd2bdb377014c5b756b3b29a245e3e82481d0248b627edca1eb
|
|
BLAKE2b-256 checksum How to use checksums |
e1e84d0de84f44d44bae0abb34541bb8054b9879d6d5a77fdfdff8a93fc7b9e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for pyjwt-rs 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.