Skip to main content

Port allocation cleanup usage reporting

Project description

TooManyPorts

A lightweight Python library for port allocation, monitoring, and management.

Installation

Install via pip:

pip install port-manager-pkg

Usage

from toomanyports import PortManager

pm = PortManager()

Examples

Find a free port

Find a single available port starting from 3000:

port = pm.find(3000, 1)[0]

Find multiple free ports

ports = pm.find(3000, 2)

Kill a process on a specific port

success = pm.kill(8080)

Kill processes on multiple ports

results = pm.kill_all([8080, 8081])

List port usage

Retrieve the process IDs listening on ports 3000 through 3010:

usage = pm.list_usage((3000, 3010))

Obtain a random ephemeral port

random_port = pm.random_port()

Shorthand call

free_port = pm(3000)

Testing

Run the test suite with:

pytest tests_core.py

License

This project is licensed under the MIT License.

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

toomanyports-0.1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

toomanyports-0.1.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file toomanyports-0.1.1.tar.gz.

File metadata

  • Download URL: toomanyports-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for toomanyports-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dbd6ed44451c6a0a14ec87967f9bd1a88ef879374491593f012637b2c24aca3b
MD5 d4ba4af1e21dc5d8b78c7c80a3b4ff4b
BLAKE2b-256 0ea20b22cac505aa1e07bfb8664dbcb22b1f3e0c71aee1d4d4e7474bc10b1648

See more details on using hashes here.

File details

Details for the file toomanyports-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: toomanyports-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for toomanyports-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc7a8f44b980baec94b817bddd6c27d76d5fd9fc3eb7cf8700effc7379cbd023
MD5 f3e7d9a131fb8d0ed41d0797c1e67477
BLAKE2b-256 8a717faec809b19b4244bf1b7690b10815b5bc78a06fcea9edfac99b28241146

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