Skip to main content

pyportscanner

CI status Latest PyPI version Python 3.11 and newer Apache-2.0 license

Check TCP port reachability on a single IPv4 host using only the Python standard library.

API reference · Changelog · Releases

Installation

python -m pip install "pyportscanner>=0.4.0"

From a local checkout, run python -m pip install . in the repository root.

Quickstart

Check a local service on port 8000.

from pyportscanner import PortScanner

scanner = PortScanner(target_ports=[8000], timeout=0.5)
print(scanner.scan("127.0.0.1"))
{8000: 'OPEN'}

The example output assumes a service is listening. The result uses "CLOSE" when a connection fails, including when it times out. To try it with a listener that the example starts for you, run python examples/PortScanExample.py from an installed checkout.

Port selection

Input Ports checked
target_ports=[8000, 8443] The listed ports
target_ports=3 The first three ports in the built-in priority list
target_ports=None All 24 built-in ports

The legacy import from pyportscanner import pyscanner still works. Version 0.4 replaces the bundled Nmap service database with the built-in list. Pass explicit ports to keep the same targets across versions.

Contributing

See the contribution guide for local setup, tests, and reporting bugs.

Build distributions

python -m pip install build twine
python -m build
python -m twine check --strict dist/*

The build writes a wheel and source distribution to dist/.

License

Apache-2.0. See the license text.

Metadata

Release files for pyportscanner 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyportscanner 0.4.1
File Size Uploaded Provenance Actions
pyportscanner-0.4.1.tar.gz 23.0 kB With provenance Details for pyportscanner-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyportscanner 0.4.1
File Interpreter ABI Platform Actions
pyportscanner-0.4.1-py3-none-any.whl Python 3 none any Details for pyportscanner-0.4.1-py3-none-any.whl

Total release size: 33.0 kB

Release files / pyportscanner-0.4.1.tar.gz

Download URL pyportscanner-0.4.1.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d04e75d47403719871dcf5a8ce2494aaae6caacd1535c984e6561c0ec68d8503
BLAKE2b-256 checksum
How to use checksums
5a778b6e6f4ab1a1578bf544701c9e71011f482981545d2443f13a5bcaf22c4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / pyportscanner-0.4.1-py3-none-any.whl

Download URL pyportscanner-0.4.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d591ff1743ca0c8277093570ce9fb1b0cbc40465e4d34da2d9190dfba635e6d1
BLAKE2b-256 checksum
How to use checksums
b9b3f23ba64e4b834ee228227677564c8737edb7fd5c6f8b72e56d4bfaca563f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for pyportscanner 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyportscanner-0.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page