{ "info": { "author": "Mikhail Korobov", "author_email": "kmike84@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP :: Site Management", "Topic :: System :: Installation/Setup", "Topic :: System :: Systems Administration" ], "description": "========\nport-for\n========\n\n.. image:: https://img.shields.io/pypi/v/port-for.svg\n :target: https://pypi.python.org/pypi/port-for\n :alt: PyPI Version\n\n.. image:: https://img.shields.io/travis/kmike/port-for/master.svg\n :target: http://travis-ci.org/kmike/port-for\n :alt: Build Status\n\n.. image:: http://codecov.io/github/kmike/port-for/coverage.svg?branch=master\n :target: http://codecov.io/github/kmike/port-for?branch=master\n :alt: Code Coverage\n\n\n``port-for`` is a command-line utility and a python library that\nhelps with local TCP ports management.\n\nIt can find an unused TCP localhost port and remember the association::\n\n $ sudo port-for foo\n 37987\n\nThis can be useful when you are installing a stack of software\nwith multiple parts needing port numbers.\n\n.. note::\n\n If you're looking for a temporary port then ``socket.bind((host, 0))``\n is your best bet::\n\n >>> import socket\n >>> s = socket.socket()\n >>> s.bind((\"\", 0))\n >>> s.getsockname()\n ('0.0.0.0', 54485)\n\n ``port-for`` is necessary when you need *persistent* free local port number.\n\n ``port-for`` is the exact opposite of ``s.bind((host, 0))``\n in the sense that it shouldn't return ports that ``s.bind((host, 0))``\n may return (because such ports are likely to be temporary used by OS).\n\n\nThere are several rules ``port-for`` is trying to follow to find and\nreturn a new unused port:\n\n1) Port must be unused: ``port-for`` checks this by trying to connect\n to the port and to bind to it.\n\n2) Port must be IANA unassigned and otherwise not well-known:\n this is acheived by maintaining unassigned ports list\n (parsed from IANA and Wikipedia).\n\n3) Port shouldn't be inside ephemeral port range.\n This is important because ports from ephemeral port range can\n be assigned temporary by OS (e.g. by machine's IP stack) and\n this may prevent service restart in some circumstances.\n ``port-for`` doesn't return ports from ephemeral port ranges\n configured at the current machine.\n\n4) Other heuristics are also applied: ``port-for`` tries to return\n a port from larger port ranges; it also doesn't return ports that are\n too close to well-known ports.\n\nInstallation\n============\n\nSystem-wide using easy_install (something like ``python-setuptools``\nshould be installed)::\n\n sudo pip install port-for\n\nor::\n\n sudo easy_install port-for\n\nor inside a virtualenv::\n\n pip install port-for\n\nScript usage\n============\n\n``port-for `` script finds an unused port and associates\nit with ````. Subsequent calls return the same port number.\n\nThis utility doesn't actually bind the port or otherwise prevents the\nport from being taken by another software. It tries to select\na port that is less likely to be used by another software\n(and that is unused at the time of calling of course). Utility also makes\nsure that ``port-for bar`` won't return the same port as ``port-for foo``\non the same machine.\n\n::\n\n $ sudo port-for foo\n 37987\n\n $ port-for foo\n 37987\n\nYou may want to develop some naming conventions (e.g. prefix your app names)\nin order to enable multiple sites on the same server::\n\n $ sudo port-for example.com/apache\n 35456\n\nPlease note that ``port-for`` script requires read and write access\nto ``/etc/port-for.conf``. This usually means regular users can read\nport values but sudo is required to associate a new port.\n\nList all associated ports::\n\n $ port-for --list\n foo: 37987\n example.com/apache: 35456\n\nRemove an association::\n\n $ sudo port-for --unbind foo\n $ port-for --list\n example.com/apache: 35456\n\n\nLibrary usage\n=============\n\n::\n\n >>> import port_for\n >>> port_for.select_random()\n 37774\n\n >>> port_for.select_random()\n 48324\n\n >>> 80 in port_for.available_good_ports()\n False\n\nDig into source code for more.\n\nContributing\n============\n\nDevelopment happens at github: https://github.com/kmike/port-for/\n\nIssue tracker: https://github.com/kmike/port-for/issues/new\n\nIn order to run tests make sure you have `tox `_\ninstalled, then type\n\n::\n\n tox\n\nfrom the source checkout.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kmike/port-for/", "keywords": "", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "port-for", "package_url": "https://pypi.org/project/port-for/", "platform": "", "project_url": "https://pypi.org/project/port-for/", "project_urls": { "Homepage": "https://github.com/kmike/port-for/" }, "release_url": "https://pypi.org/project/port-for/0.4/", "requires_dist": null, "requires_python": "", "summary": "Utility that helps with local TCP ports managment. It can find an unused TCP localhost port and remember the association.", "version": "0.4" }, "last_serial": 3034316, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "75b32b5069d4969c69d0dbcf4a6e6044", "sha256": "96ea5be645f592afb9a1e757e051e2a30c6aee692f5a0cad9361c7b13b6a8f9c" }, "downloads": -1, "filename": "port-for-0.1.tar.gz", "has_sig": false, "md5_digest": "75b32b5069d4969c69d0dbcf4a6e6044", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13381, "upload_time": "2012-06-15T09:35:48", "url": "https://files.pythonhosted.org/packages/39/b4/777176f849fcd7f677f1ed06fc01dbd193fbd8e5c58d6c8da145ed224fca/port-for-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "f89aeef3f0a322fde5d0026b13aa46e2", "sha256": "edc4dcb9dec10c29bdeb74a0896db141da751db5334c630411528f798272bd45" }, "downloads": -1, "filename": "port-for-0.2.tar.gz", "has_sig": false, "md5_digest": "f89aeef3f0a322fde5d0026b13aa46e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14140, "upload_time": "2012-06-15T13:56:04", "url": "https://files.pythonhosted.org/packages/11/d1/45b71861f331bf20b2b3e1c944f89fdfd563d15853b3080a3f1f401c9156/port-for-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "42cda1d22dfaef1810c1987dc1c69f40", "sha256": "89a53e4ac858899b9c3dc69f6aedc1abb0b00dced6bb73fc31575b8050bdc479" }, "downloads": -1, "filename": "port-for-0.3.tar.gz", "has_sig": false, "md5_digest": "42cda1d22dfaef1810c1987dc1c69f40", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18053, "upload_time": "2012-06-18T10:39:42", "url": "https://files.pythonhosted.org/packages/5f/e4/3eeb1d5bdf37f388d9d5bd5fe86735441034fef7b7bfca861ef1b53af4c3/port-for-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "e6f4c466ce82fc9e9e0cb8ddee26a4c7", "sha256": "b16a84bb29c2954db44c29be38b17c659c9c27e33918dec16b90d375cc596f1c" }, "downloads": -1, "filename": "port-for-0.3.1.tar.gz", "has_sig": false, "md5_digest": "e6f4c466ce82fc9e9e0cb8ddee26a4c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18652, "upload_time": "2014-08-27T00:53:56", "url": "https://files.pythonhosted.org/packages/ec/f1/e7d7a36b5f3e77fba587ae3ea4791512ffff74bc1d065d6185e463279bc4/port-for-0.3.1.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "6ef1f878314af9e2d8e2c48e17df97ea", "sha256": "247b4db1901aa3d9906258308e40dfbadf65275b27ca77faa0b9a876b7284970" }, "downloads": -1, "filename": "port_for-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6ef1f878314af9e2d8e2c48e17df97ea", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 21235, "upload_time": "2017-07-19T14:55:25", "url": "https://files.pythonhosted.org/packages/42/06/f7c7b57221480da632bfe7545d0ff6fa98498da515183a6c3392ddb9f0c0/port_for-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "75c696654463820bcebc46417a869576", "sha256": "47b5cb48f8e036497cd73b96de305cecb4070e9ecbc908724afcbd2224edccde" }, "downloads": -1, "filename": "port-for-0.4.tar.gz", "has_sig": false, "md5_digest": "75c696654463820bcebc46417a869576", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19450, "upload_time": "2017-07-19T14:54:08", "url": "https://files.pythonhosted.org/packages/cd/68/57f6d5cae15125acc0f3e2a5117de5e2d83f4e96c4d97e088122557b3d70/port-for-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6ef1f878314af9e2d8e2c48e17df97ea", "sha256": "247b4db1901aa3d9906258308e40dfbadf65275b27ca77faa0b9a876b7284970" }, "downloads": -1, "filename": "port_for-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6ef1f878314af9e2d8e2c48e17df97ea", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 21235, "upload_time": "2017-07-19T14:55:25", "url": "https://files.pythonhosted.org/packages/42/06/f7c7b57221480da632bfe7545d0ff6fa98498da515183a6c3392ddb9f0c0/port_for-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "75c696654463820bcebc46417a869576", "sha256": "47b5cb48f8e036497cd73b96de305cecb4070e9ecbc908724afcbd2224edccde" }, "downloads": -1, "filename": "port-for-0.4.tar.gz", "has_sig": false, "md5_digest": "75c696654463820bcebc46417a869576", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19450, "upload_time": "2017-07-19T14:54:08", "url": "https://files.pythonhosted.org/packages/cd/68/57f6d5cae15125acc0f3e2a5117de5e2d83f4e96c4d97e088122557b3d70/port-for-0.4.tar.gz" } ] }