Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Functions for server command-line arguments used by humans.

Project description


Functions for command-line server tools used by humans.


Path-and-address resolves ambiguities for command-line interface applications
with the following pattern:

$ your_app [<path>] [<address>]

The library applies [the principal of least surprise][pols] to command-line

Some examples:

$ your_app .
* Serving . on http://localhost:5000/

$ your_app 80
* Serving . on http://localhost:80/

$ your_app ./80
* Serving ./80 on http://localhost:5000/

$ your_app path/to/file
* Serving path/to/file on http://localhost:5000/

$ your_app
* Serving on http://localhost:5000/

$ your_app .
* Serving . on

$ your_app
* Serving . on


Implement a CLI front-end in Python that exposes the above `[path] [address]`
pattern. Then call `resolve(path, address)`.

Example, using `sys.argv` directly:

import sys
from path_and_pattern import resolve

path, address = resolve(*argv[1:])

More examples can be found in the "examples" directory.


To install, simply:

$ pip install path-and-address

Or put it in your project's `requirements.txt`.


1. Check the open issues or open a new issue to start a discussion around
your feature idea or the bug you found
2. Fork the repository, make your changes, and add yourself to [][]
3. Send a pull request

[]: ./

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date (6.5 kB) Copy SHA256 hash SHA256 Source None Jul 21, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page