skillfed

ping3

A pure python3 version of ICMP ping implementation using raw socket.

ping3 v5.1.5 786.3K downloads/30d#5,067 on PyPI347
Permissive license MIT Active released

What it is and what it does

Ping3 is a pure Python implementation of ICMP ping that uses raw sockets to send echo requests and measure network latency. It works with both IPv4 and IPv6 addresses, supports custom timeouts, packet sizes, TTL values, and source addresses or interfaces. The package offers both a programmatic API (ping and verbose_ping functions) and a command-line tool.

The main use case is network diagnostics and connectivity testing from within Python applications without spawning external ping processes. It returns the round-trip delay as a float, False when a host cannot be resolved, or None on timeout. Optional DEBUG and EXCEPTIONS modes provide detailed packet inspection or exception-based error handling instead of return values.

Use it for:

  • Check if a remote host is reachable and measure latency before attempting a connection.
  • Monitor network connectivity in a background service or health-check daemon.
  • Diagnose network issues by pinging multiple hosts with custom timeouts and TTL values.
  • Build a network topology or reachability map by pinging a range of IP addresses.
  • Test IPv6 connectivity explicitly or auto-detect the appropriate protocol version.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Ping3 sends ICMP echo requests to hosts and measures round-trip time using raw sockets, returning latency in seconds or milliseconds or None on timeout.

Yes, if you need ICMP ping from Python and can work with the privilege requirement. The package is stable, actively maintained, has no external dependencies, and carries permissive licensing. It is well-suited for network diagnostics and connectivity checks in applications or scripts. The main gotcha is that most platforms require root or administrator privileges to send raw ICMP packets.

Install

ping3 on PyPI

pip

pip install ping3

uv

uv add ping3

poetry

poetry add ping3

Installing ping3

Before you install

Low install friction with no runtime dependencies. Active maintenance with recent commits and a stable release history since 2017. Requires Python 3.5 or later.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal obligations, making it safe for commercial and private projects.

Quickstart

pip install ping3

from ping3 import ping
delay = ping('example.com')  # Returns delay in seconds, False if host unknown, None if timeout
print(delay)

On most platforms, sending ICMP packets requires root or administrator privileges; some systems may need `sudo ping3` or equivalent elevated permissions.

Verify before relying

  • Whether the package works reliably across Windows, macOS, and Linux without platform-specific workarounds beyond privilege requirements.
  • Performance characteristics when pinging many hosts concurrently or in rapid succession.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.5)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 369 days since the last release
Last repo commit
First released
Downloads 786,264/month — #5,067 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ping3-5.1.5-py3-none-any.whl

Keywords: python3, ping, icmp, socket, tool

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: End Users/DesktopProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: System :: Networking

Tags

icmp ping pythonnetwork latency measurementhost reachability checkraw socket pingpython ping librarynetwork diagnostics toolip connectivity test
network-diagnosticsicmpraw-sockets

More Networking packages