postkit SDK
Python client for postkit.
Installation
pip install postkit
Usage
import psycopg
from postkit.authz import AuthzClient
from postkit.authn import AuthnClient
conn = psycopg.connect("postgresql://...")
cursor = conn.cursor()
# Authorization
authz = AuthzClient(cursor, namespace="my-app")
authz.set_hierarchy("repo", "admin", "write", "read")
authz.grant("admin", resource=("repo", "api"), subject=("user", "alice"))
if authz.check(("user", "alice"), "read", ("repo", "api")):
print("Access granted")
# Authentication
authn = AuthnClient(cursor, namespace="my-app")
user_id = authn.create_user("alice@example.com", password_hash="argon2...")
session_id = authn.create_session(user_id, token_hash="sha256...")
Requirements
- PostgreSQL 14+
- The postkit SQL schema installed in your database
See the main repository for SQL installation instructions.
Release files for postkit 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| postkit-0.4.0.tar.gz | 226.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| postkit-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 281.2 kB
Release files / postkit-0.4.0.tar.gz
| Download URL | postkit-0.4.0.tar.gz |
|---|---|
| Size | 226.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5456d22fb10e3121fe92953c8a6e1564a51b2475f9c118d04417373d75a7589f
|
|
BLAKE2b-256 checksum How to use checksums |
9793a7961669cef63cba41ccab7e19591d1a5db241b2184fe44b7e380248da1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 3, 2026.
Transparency logRelease files / postkit-0.4.0-py3-none-any.whl
| Download URL | postkit-0.4.0-py3-none-any.whl |
|---|---|
| Size | 55.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa4e3ad90f57313df8cd36d598949186eaffb392057d994d2c0113abdbc9da96
|
|
BLAKE2b-256 checksum How to use checksums |
7d245341f925266a2c8c53bdfba622560205b8d7b27aa603dd68b7aa8b9ddc69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 3, 2026.
Transparency log