Skip to main content

unlok

PyPI version PyPI pyversions

The python client for lok, the authentication and identity server of an Arkitekt deployment: users and groups, apps, releases and their clients, the services a deployment composes, and the mandates whose keys log deployed apps in.

Installation

pip install unlok

With arkitekt, pip install "arkitekt[rekuest,unlok]" brings it in.

Usage

Every lok operation is a method of the Unlok client, in a blocking and an a-prefixed async flavour (unlok.me(), await unlok.ame()).

Unlike the other service clients, unlok requires nothing from the deployment: it talks to the app's own lok server, the one the app authenticated against.

In an arkitekt app

Add the service to your app and ask for unlok: Unlok; the client is injected by annotation. Services travel between actions by id (@lok/service):

from arkitekt import App, run
from unlok import Unlok, unlok_service

app = App("whoami", "0.1.0", services=[unlok_service])


@app.action
def whoami(unlok: Unlok) -> str:
    """Who Am I

    The user this app is acting for.
    """
    return unlok.me().username


if __name__ == "__main__":
    run(app)

From a script

from arkitekt import easy
from unlok import unlok_service

with easy("my-script", unlok_service) as unlok:
    for service in unlok.list_services():
        print(service.identifier, service.name)

Testing

Unit tests need nothing but the package:

uv run pytest -k "not integration"

The integration tests start a real lok (plus postgres, redis and minio) with docker compose through dokker, enrol into it by device code (approved with lok's validatecode), and then exercise the client against it, including the mandate-key flow a deployer drives: issuing a key and logging a second session in with it through the fakts mandate-key grant:

uv run pytest -m integration

The stack runs the published jhnnsrs/lok:${LOK_SERVICE_TAG:-latest} image, so the schema under test is whatever was last pushed to :latest. CI defaults to the same tag; set the repository variable LOK_SERVICE_TAG (or export it locally) to test against another published tag, such as next. To test against a local server checkout instead, drop a gitignored tests/integration/docker-compose.local.yml next to the compose file that builds the lok service from that checkout; the fixtures pick it up automatically.

Metadata

Release files for unlok 5.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unlok 5.4.0
File Size Uploaded Provenance Actions
unlok-5.4.0.tar.gz 41.2 kB Without provenance Details for unlok-5.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for unlok 5.4.0
File Interpreter ABI Platform Actions
unlok-5.4.0-py3-none-any.whl Python 3 none any Details for unlok-5.4.0-py3-none-any.whl

Total release size: 82.9 kB

Release files / unlok-5.4.0.tar.gz

Download URL unlok-5.4.0.tar.gz
Size 41.2 kB
Tags Source
SHA-256 checksum
How to use checksums
137cdbed93b19ddd1314961b53c53bfab2447b1dcb33351e634c005121a47415
BLAKE2b-256 checksum
How to use checksums
5eda014b7edeac35ac7dc0fed8d7faa67a7d8a8b6545d7723d56f8a19be7f1d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / unlok-5.4.0-py3-none-any.whl

Download URL unlok-5.4.0-py3-none-any.whl
Size 41.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
102e42b9e4caa997f63d2f000781a4d13f15504f3895686da742bb9f3fd706bf
BLAKE2b-256 checksum
How to use checksums
248be6ca1e3c1b5f2325b7e19b30a0631ace15f07b51cb49cc9dbf4ecd92cd81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for unlok 5.4.0

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.

Release history Release notifications | RSS feed

This release

5.4.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page