Skip to main content

A bundeld set of tools, clients for the lange-suite of tools and more.

Project description

lange-python

Python helpers and clients for Lange services.

Distribution CLI

Publish a distribution artifact to the app services distribution system:

export LANGE_LABS_API_KEY="your-api-key"
lange distribution publish \
  --path ./dist/app.dmg \
  --version 1.2.3 \
  --distribution-name desktop-app \
  --os macos

Apply a macOS app update after downloading the published zip artifact:

from pathlib import Path

from lange.distribution import DistributionClient

client = DistributionClient(distribution_name="desktop-app", api_key="your-api-key")

latest = client.check_for_update("1.2.3")
if latest:
    version, artifact_path = client.download(current_version="1.2.3")
    print(version, artifact_path)
    update_metadata = client.update(
        current_version="1.2.3",
        installed_app_path=Path("/Applications/Desktop App.app"),
        relaunch=True,
    )
    print(update_metadata["version"])
    # The caller should now shut down so the detached helper can replace and relaunch the app.

The distribution client also exposes status and reload() for refresh-aware integrations:

client = DistributionClient(distribution_name="desktop-app", api_key="your-api-key")

latest_version = client.search_for_update("1.2.3")
print(client.status)  # connected
print(client.update_state["can_download"])

client.reload()  # repeats the last update check
client.reload(api_key=None)  # clears authentication and marks the client unauthenticated

Tunnel worker

from lange.tunnel import Tunnel

tunnel = Tunnel(
    host="wss://api.lange-labs.com",
    api_key="your-bearer-token",
    target="http://localhost:3000",
)

tunnel.start()
# ...
tunnel.reload()  # restarts the connection flow with the current API key
tunnel.reload(api_key=None)  # clears authentication and leaves the client unauthenticated
tunnel.stop()

Tunnel clients also expose a status property with one of: "unauthenticated", "off", "pending", "connected", or "failed".

The worker connects to /api/v1/tunnels/worker, consumes the worker_connected welcome payload, forwards HTTP bodies as base64-encoded bytes, and supports websocket relay sessions through the same control socket.

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

lange_python-0.3.28.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

lange_python-0.3.28-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file lange_python-0.3.28.tar.gz.

File metadata

  • Download URL: lange_python-0.3.28.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.9 Darwin/25.1.0

File hashes

Hashes for lange_python-0.3.28.tar.gz
Algorithm Hash digest
SHA256 d5f6a98cfa55ff329ccfa1f58e8fe4bd202674d469339d9c61f2682621f1e141
MD5 c8f11eb2b901603f57b5b0e4d37af7a0
BLAKE2b-256 06c809eb78b3fd6e817ee3fad82473579ff8c39b6a901cab481ed5f671d31f04

See more details on using hashes here.

File details

Details for the file lange_python-0.3.28-py3-none-any.whl.

File metadata

  • Download URL: lange_python-0.3.28-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.9 Darwin/25.1.0

File hashes

Hashes for lange_python-0.3.28-py3-none-any.whl
Algorithm Hash digest
SHA256 92ae1ef09eab628788bf2b60538bfe8bc9d4b9c92b5e82e6bea0afe9cfc443b1
MD5 a9d4aa74d24858417f285af299e9f9f2
BLAKE2b-256 59be76fbd8df2794ab80ce56b5cc1da1b32a75cd7c900922947ada3fdfa1903d

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