Skip to main content

gretl

Python SDK for Gretl — control local services by name or port number.

Install

pip install gretl

Quick start

from gretl import gr

# List all monitored ports
ports = gr.ports()

# Start / stop by name or port number
gr.start("api")
gr.stop("3000")

# Start / stop an entire group
gr.start_group("backend")
gr.stop_group("backend")

# Wait for a service to come up (useful in tests)
gr.wait_for_active("postgres", timeout=30)

# Add a new port to monitoring
gr.add(7401, name="jobs-server", cmd="node jobs.js", group="backend")

API

Method Description
gr.ports() Return all monitored ports
gr.port(query) Find ports by name substring or exact port number
gr.active() Only running ports
gr.inactive() Only stopped ports
gr.start(query) Start matching service(s)
gr.stop(query) Stop matching service(s)
gr.remove(query) Remove from monitoring
gr.start_group(group) Start all ports in a group
gr.stop_group(group) Stop all ports in a group
gr.status_group(group) List all ports in a group
gr.wait_for_active(query, timeout, interval) Block until active
gr.wait_for_inactive(query, timeout, interval) Block until inactive
gr.add(port, name, cmd, group, cwd) Register a new port

Kubernetes & cloud

gr.k8s exposes the Gretl cloud API for managing Kubernetes workloads. Set GR_TOKEN in your environment or pass token= to GretlClient.

from gretl import gr
# GR_TOKEN is read automatically from os.environ

clusters = gr.k8s.clusters()
workloads = gr.k8s.workloads(cluster_id=clusters[0]["id"])

# Sleep / wake a workload
gr.k8s.sleep(workloads[0]["id"])
gr.k8s.wake(workloads[0]["id"])

# Tether a container port to a public tunnel URL
tether = gr.k8s.tether(workloads[0]["id"], container_port=8000)
print(tether["tunnel_url"])

# Force a cluster sync
gr.k8s.sync(clusters[0]["id"])

# Configure auto-sleep
gr.k8s.set_auto_sleep(workloads[0]["id"], enabled=True, idle_timeout_minutes=30)
Method Description
gr.k8s.clusters() List connected clusters
gr.k8s.workloads(cluster_id=None) List workloads
gr.k8s.sync(cluster_id) Force cluster sync
gr.k8s.sleep(workload_id) Scale to zero
gr.k8s.wake(workload_id) Restore replicas
gr.k8s.tether(workload_id, container_port, label=None) Create public tunnel
gr.k8s.detach(tether_id) Deactivate a tether
gr.k8s.tethers() List active tethers
gr.k8s.auto_sleep(workload_id) Get auto-sleep config
gr.k8s.set_auto_sleep(workload_id, enabled, idle_timeout_minutes) Update auto-sleep config

Requirements

The Gretl daemon must be running for local port methods. Download free at gretl.dev. K8s methods require a GR_TOKEN from your Gretl dashboard.

Metadata

Release files for gretl 1.1.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 gretl 1.1.0
File Size Uploaded Provenance Actions
gretl-1.1.0.tar.gz 5.4 kB Without provenance Details for gretl-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 10.9 kB

Release files / gretl-1.1.0.tar.gz

Download URL gretl-1.1.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cb7c236553a9063e523697cf7ff027af5f75cde4e3466b41fe85cf0ba8772677
BLAKE2b-256 checksum
How to use checksums
5436acb039917aa90c0401788b538f588d0d3972fe392b1dbf876e868f9c0f69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / gretl-1.1.0-py3-none-any.whl

Download URL gretl-1.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c011ca43f85cc17c274ed017ddd4f894568376193fca57a29bfc85914133c7e
BLAKE2b-256 checksum
How to use checksums
ab755fed539f56d173360b4a789eda5cfbcf14a45a0b564c1d33b01d97659cba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for gretl 1.1.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.

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