Skip to main content

LocalPort

Universal port forwarding manager with intelligent health monitoring

LocalPort is a Python CLI that manages port forwarding across kubectl and SSH with automatic health monitoring, intelligent restart policies, and a background daemon. Feedback and issue reports are welcome.

Why LocalPort?

  • Universal — kubectl and SSH tunnels managed with one tool
  • Self-healing — health monitoring with restart policies and exponential backoff
  • Hot reload — config changes applied live in daemon mode (via watchdog)
  • Daemon mode — background operation with monitoring
  • Rich CLI — clean output with progressive verbosity (-v, -vv, --debug)
  • Flexible config — YAML with environment variable substitution and validation

Installation

Python 3.11+ required. LocalPort runs on Linux and macOS only (the daemon relies on POSIX fork and Unix signals — Windows is not supported).

# pipx (recommended)
pipx install localport

# with optional health-check extras
pipx install "localport[kafka,postgres]"

# or with uv
uv tool install localport

Install from GitHub or Test PyPI:

pipx install git+https://github.com/dawsonlp/localport.git
pipx install git+https://github.com/dawsonlp/localport.git@v1.1.1   # specific tag

Need Python 3.11+? Install it via Homebrew (brew install python@3.11), your distro's package manager, or pyenv. Verify with localport --version.

Quick Start (5 minutes)

  1. Create localport.yaml:
version: "1.0"

services:
  - name: postgres
    technology: kubectl
    local_port: 5432
    remote_port: 5432
    connection:
      resource_name: postgres
      namespace: default
    tags: [database]

  - name: redis
    technology: kubectl
    local_port: 6379
    remote_port: 6379
    connection:
      resource_name: redis
      namespace: default
    tags: [cache]
  1. Start your services (start requires service names, --tag, or --all):
localport start --all              # everything
localport start postgres redis     # specific services
localport start --tag database     # by tag
  1. Check status and connect:
localport status
psql -h localhost -p 5432 -U postgres
redis-cli -h localhost -p 6379

Your services are now forwarded locally with automatic health monitoring and restarts. See the full command list and configuration options.

Documentation

Status

Stable (v1.x) — core functionality is production-ready.

Implemented:

  • kubectl port forwarding (services, deployments, pods)
  • SSH port forwarding, including bastion/jump hosts
  • Health monitoring (TCP, HTTP/HTTPS, Kafka, PostgreSQL) with restart policies
  • Daemon mode with hot configuration reload
  • Cluster health monitoring for Kubernetes contexts
  • Configuration management (config add/remove/list/validate/export)
  • Service logging and diagnostics

PostgreSQL and Kafka health checks need the optional extras (localport[postgres], localport[kafka]) and credentials — see the Configuration Guide.

Roadmap

Direction, not commitments — priorities follow community demand and contributions:

  • Reverse proxy — HTTP/HTTPS proxying with load balancing
  • Advanced routing — multi-hop and service-mesh connectivity
  • Enhanced logging — ring-buffer storage with real-time streaming
  • AI integration — natural-language service management via MCP
  • Enterprise security — mTLS, RBAC, and identity-provider integration
  • Developer tools — IDE plugins and environment templates

See the full roadmap and vote on GitHub issues.

Links

Download files

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

Source Distribution

localport-1.2.0.tar.gz (261.7 kB view details)

Uploaded Source

Built Distribution

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

localport-1.2.0-py3-none-any.whl (239.7 kB view details)

Uploaded Python 3

File details

Details for the file localport-1.2.0.tar.gz.

File metadata

  • Download URL: localport-1.2.0.tar.gz
  • Upload date:
  • Size: 261.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for localport-1.2.0.tar.gz
Algorithm Hash digest
SHA256 911c9f4dd9af56dfa08284391ee4bcf24d5a4cafb89ebda502a027d90f02fecb
MD5 b01aa4ccd95069d3d170821febf32ec2
BLAKE2b-256 7b5df6a3d2521a583842a88796dec39f9808d2c634017345a4fe1d0135fd8dd9

See more details on using hashes here.

File details

Details for the file localport-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: localport-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 239.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for localport-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49ba5a5383471bc31d3b022ea9d0171afd3356e1ea17f1862e850473570191e4
MD5 bb2df375f35a1adacce15a5d2fde4f0e
BLAKE2b-256 0ff2d2da4ad9701c6ad6b3adda6855c8e199870d019fc74f8fc0beda48e0888d

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