Skip to main content

Port manager for developing multiple local web apps.

Project description

When you’re building several web apps simultaneously (an increasingly common situation with microservices) it’s annoying to try and remember which app is on which port. plut (port lookup table) does it for you.

Installation

Run

pip install plut

Usage

plut maps names to ports. You supply a name and get back the port it’s mapped to.

Imagine you have a web app with two microservices responsible for authentication and the user dashboard. Each of these services needs to know what port to bind to when it starts up, and what port the other is on, so they can talk. In this case, you might code-name these services auth and dashboard respectively. Inside the authentication service, you’d say:

import plut

port = plut.port('userauth')

run_webserver(port=port)

Now imagine the authentication service exposes an API. Inside the dashboard service you could say:

import plut

base_url = 'http://localhost:%d/api/v1' % plut.port('userauth')
# use requests or something to send requests to base_url

Functions

  • plut.port(name) returns the port that name maps to. The same port will be returned for each name, user-wide.

  • plut.services() returns a dict mapping names to ports.

Command-Line

  • plut shows all names and ports.

  • plut <name> shows the port of a name. This prints out a single integer, so you can use its output as a command-line argument for another program.

  • plut rm <name> removes a port. (There’s no programmatic API for this at the moment. Should I add it? I’m a bit lazy.)

Notes

plut saves everything to ~/.plutfile. If you delete this you’ll lose (or voluntarily reset) your mappings.

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

plut-0.5.3.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file plut-0.5.3.tar.gz.

File metadata

  • Download URL: plut-0.5.3.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for plut-0.5.3.tar.gz
Algorithm Hash digest
SHA256 798a5eafa00b8de500e82e3734af9bd62af23b4ab38876727db3fa4601b10595
MD5 0ecd1669fa13586fb9498a63a21b85d3
BLAKE2b-256 c196b73cffe95304d15a838c5ad633fc2d98be965d7aca211e68a8f0480da2ec

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