tamga-python
Official Python SDK for Tamga. Integrate license activation, offline verification, and machine management into your Python applications.
Pure Python — no Rust extension, no native build step. Every cryptographic primitive (Ed25519,
RSA-PKCS1/PSS, ECDSA-P256, AES-256-GCM, HKDF) is implemented natively via the
cryptography package; HTTP transport is httpx.
Install
pip install tamga-sdk
Published to PyPI as tamga-sdk (the bare tamga name is
taken by an unrelated logging library); the importable package name is tamga.
Quickstart
from tamga import TamgaClient, TamgaConfig
client = TamgaClient(
TamgaConfig(account_id="your-account-id", host="api.tamga.sh"),
)
result = client.licenses.validate_by_key("YOUR-LICENSE-KEY")
if result.meta.valid:
print("License is valid:", result.meta.code)
else:
print("License is not valid:", result.meta.code, result.meta.detail)
More examples in examples/:
validate_license.py— validate by key and by ID with a scope.checkout_and_verify.py— offline.liccheckout, plain and encrypted, full verify pipeline.machine_activation_flow.py— create machine → validate → handle over-limit rollback.heartbeat_scheduler.py— machine (600s window) vs. process (30s window) heartbeat scheduling side by side.offline_proof.py— air-gapped machine proof generation + verification.
Auth transports
The SDK supports 4 of the server's 5 documented auth transports (session-cookie auth is browser/portal-only and out of scope for a non-browser SDK):
from tamga.transport import BasicAuth, BearerAuth, LicenseAuth, QueryParamAuth
# 1. Bearer token (SDK default when default_auth is set to one)
TamgaConfig(account_id="...", host="...", default_auth=BearerAuth(token="tok-..."))
# 2. HTTP Basic — three sub-forms
TamgaConfig(
account_id="...", host="...", default_auth=BasicAuth(email="you@example.com", password="...")
)
TamgaConfig(account_id="...", host="...", default_auth=BasicAuth(token="tok-..."))
TamgaConfig(account_id="...", host="...", default_auth=BasicAuth(license_key="..."))
# 3. License key — the primary transport for embedded/client apps
TamgaConfig(account_id="...", host="...", default_auth=LicenseAuth(key="YOUR-LICENSE-KEY"))
# 4. Query parameter
TamgaConfig(account_id="...", host="...", default_auth=QueryParamAuth(value="tok-..."))
licenses.validate_by_key(key) always sends Authorization: License <key> for the key being
validated, regardless of default_auth, since it already has the credential in hand.
Offline verification
.lic license files and machine files can be verified fully offline once the account's public
key is embedded in your application — no network round-trip required on every check:
from tamga.checkout.license_file import LicenseFile
certificate = client.licenses.check_out(license_id, as_bytes=True)
license_file = LicenseFile.parse(certificate.decode())
license_resource = license_file.verify(public_key=YOUR_ED25519_PUBLIC_KEY_BYTES)
See examples/checkout_and_verify.py for the full flow,
including encrypted checkout.
What this SDK does not do
Per tamga-api's Known Server-Side Gaps:
no client-side rate-limit/backoff handling (the server never returns 429), no
Tamga-Environment header, no release/auto-update checking (GET /releases/actions/upgrade is
unusable server-side today). See CLAUDE.md for the full gotcha list.
Documentation
- tamga-api
docs/sdk.md— the authoritative wire-level protocol reference this SDK implements against, including the Known Server-Side Gaps section describing which documented features are not yet live server-side. CLAUDE.md— dense, gotcha-first architecture/crypto reference for anyone modifying this codebase.SECURITY.md— the crypto assumptions an integrator is trusting, and how to report a vulnerability.CONTRIBUTING.md— dev setup, test/lint/type-check commands, PR expectations.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tamga_sdk-0.1.1.tar.gz.
File metadata
- Download URL: tamga_sdk-0.1.1.tar.gz
- Upload date:
- Size: 154.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e044827750da2cd36fe2c7ba382877f857e76813823b929e50fa004e13c1d79f
|
|
| MD5 |
90fb6b287755d64cd0598bc86ad6d28d
|
|
| BLAKE2b-256 |
7a7bcbc30a1f384d8d344d4ef626e964389ee9919f36ce011474a92df430b02d
|
Provenance
The following attestation bundles were made for tamga_sdk-0.1.1.tar.gz:
Publisher:
release.yml on tamga-sh/tamga-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tamga_sdk-0.1.1.tar.gz -
Subject digest:
e044827750da2cd36fe2c7ba382877f857e76813823b929e50fa004e13c1d79f - Sigstore transparency entry: 2415901963
- Sigstore integration time:
-
Permalink:
tamga-sh/tamga-python@a8c966b61ed7b96dfbd0148c7ca81eba1934a266 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tamga-sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a8c966b61ed7b96dfbd0148c7ca81eba1934a266 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tamga_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tamga_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 49.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
454db06f8a9d12b02a16011027f0cafb2e51c6a3068e6a971bf886bd43f18246
|
|
| MD5 |
f93436066bd0fd26f24a5b65b700977d
|
|
| BLAKE2b-256 |
4be06d6fc668e57855088aaf9ebf22d54df06d4c7954d2271586b48c56574f7b
|
Provenance
The following attestation bundles were made for tamga_sdk-0.1.1-py3-none-any.whl:
Publisher:
release.yml on tamga-sh/tamga-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tamga_sdk-0.1.1-py3-none-any.whl -
Subject digest:
454db06f8a9d12b02a16011027f0cafb2e51c6a3068e6a971bf886bd43f18246 - Sigstore transparency entry: 2415902102
- Sigstore integration time:
-
Permalink:
tamga-sh/tamga-python@a8c966b61ed7b96dfbd0148c7ca81eba1934a266 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tamga-sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a8c966b61ed7b96dfbd0148c7ca81eba1934a266 -
Trigger Event:
push
-
Statement type: