Skip to main content

A client library for generating images through the flix-imagen API

Project description

Imagen SDK

A proprietary client library for generating images through the flix-imagen API.

Authorized Flixstock users only. A signed runtime license file is required before the SDK can be used.

Installation

pip install imagen-sdk

Runtime license file

Before creating a client, obtain an RSA-signed license file from Flixstock. The SDK verifies signatures using a public key bundled in the package; the private key never ships with the SDK.

The SDK checks for a license in this order:

  1. license_path argument to ImagenClient
  2. IMAGEN_SDK_LICENSE environment variable
  3. ./imagen-sdk.license or ./license.json in the working directory
  4. ~/.config/imagen-sdk/license.json

Example license format: see license.example.json.

Allowed email domains: @flixstock.com, @imageedit.ai.

Key setup (Flixstock admins, one-time)

Generate an RSA key pair. The public key is committed to the repo; the private key stays local.

pip install cryptography
python scripts/generate_keys.py
  • Public key: src/imagen_sdk/keys/license_public.pem (bundled in the wheel)
  • Private key: keys/license_private.pem (gitignored — store securely)

Issue a license (Flixstock admins)

python scripts/issue_license.py \
  --licensee "Jane Doe" \
  --email "jane.doe@flixstock.com" \
  --output imagen-sdk.license

Optional: --private-key /path/to/license_private.pem or set IMAGEN_SDK_PRIVATE_KEY.

Usage

from imagen_sdk import ImagenClient, LicenseError

try:
    client = ImagenClient(
        base_url="https://imagen-api.flixstock.com",
        api_key="your-api-key",
        license_path="/path/to/imagen-sdk.license",
    )
except LicenseError as exc:
    print(exc)

Or set the environment variable:

export IMAGEN_SDK_LICENSE=/path/to/imagen-sdk.license
from imagen_sdk import ImagenClient

client = ImagenClient(
    base_url="https://imagen-api.flixstock.com",
    api_key="your-api-key",
)

Development

python -m venv .venv
.venv\Scripts\activate          # Windows
# source .venv/bin/activate     # macOS/Linux

pip install --upgrade pip build twine pytest cryptography
pip install -e .
python scripts/generate_keys.py   # if keys do not exist yet
python scripts/issue_license.py --licensee "Dev User" --email "dev@flixstock.com"
pytest

Publishing to PyPI

Follow the Python Packaging User Guide.

1. Install build tools

pip install --upgrade pip build twine

2. Bump the version

Update version in pyproject.toml and __version__ in src/imagen_sdk/__init__.py. PyPI does not allow re-uploading the same version.

3. Build distribution archives

# Windows PowerShell
Remove-Item -Recurse -Force dist, build -ErrorAction SilentlyContinue
python -m build

This produces in dist/:

  • imagen_sdk-<version>.tar.gz — source distribution
  • imagen_sdk-<version>-py3-none-any.whl — wheel

4. Test on TestPyPI (recommended)

  1. Register at test.pypi.org and verify your email.
  2. Create an API token at test.pypi.org/manage/account/#api-tokens.
  3. Upload:
python -m twine upload --repository testpypi dist/*

When prompted:

  • Username: __token__
  • Password: your API token (including the pypi- prefix)
  1. Verify install:
pip install --index-url https://test.pypi.org/simple/ --no-deps imagen-sdk
  1. Check: https://test.pypi.org/project/imagen-sdk/

5. Publish to PyPI

  1. Register at pypi.org (separate from TestPyPI).
  2. Confirm imagen-sdk is available on pypi.org.
  3. Create a production API token at pypi.org/manage/account/#api-tokens.
  4. Upload:
python -m twine upload dist/*
  1. Install from PyPI:
pip install imagen-sdk

Optional: store credentials in .pypirc

[distutils]
index-servers =
    pypi
    testpypi

[pypi]
username = __token__
password = pypi-...

[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
password = pypi-...

Never commit .pypirc or API tokens to version control.

License

Proprietary — see LICENSE. Unauthorized use, copying, or distribution is prohibited.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imagen_sdk-0.0.2.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imagen_sdk-0.0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file imagen_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: imagen_sdk-0.0.2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for imagen_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 51d61083c93976f2cb88dacb820166972072ed13e667c3f6869cb6858508f649
MD5 feb774910b7c588a8f82c0ae94b06f55
BLAKE2b-256 29ad094ffc98931df365288c0c81f11034d8d52b9383a723820c40f19017dd2c

See more details on using hashes here.

File details

Details for the file imagen_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: imagen_sdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for imagen_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4646deb447903e8c13daa02c1b4940d5cd760ffdcff93886740fce345a18edfd
MD5 04d1e45d9357db100d5d31482ea82292
BLAKE2b-256 297ff8c215f25444fbe3f0afae22b4fca302210c8a87beb0c4e10e21f8f56bf7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page