Skip to main content

A Python DHCP library and server implementation

Project description

pydhcp

Version Python versions License: MIT Docs

A Python DHCP library and server implementation.

Features

  • DHCP Packet Parsing — Full support for parsing and constructing DHCP packets.
  • DHCP Server — Highly customizable and async-friendly DHCP server.

Installation

pip install pydhcp

Quick start

Synchronous Server

from pydhcp.server import DhcpServer

server = DhcpServer()
server.listen()

Asynchronous Server

import asyncio
from pydhcp.server import AsyncDhcpServer

async def main():
    server = AsyncDhcpServer()
    await server.start()
    # Keep running or handle other async tasks
    # To stop: await server.stop()

asyncio.run(main())

Command Line Interface (CLI)

pydhcp includes a command line interface for listing network adapters, decoding packets, running benchmarks, and starting servers.

# List all network interfaces
pydhcp interfaces

# Decode a hex-encoded DHCP packet
pydhcp packet --decode "01010600..."

# Run performance benchmarks
pydhcp bench

# Start the DHCP server from JSON or INI config
pydhcp server --config config.json

# Increase logging while debugging
pydhcp server --listen 127.0.0.1:6767 --log-level debug

Development

See development notes for environment setup, dependency install, and test commands.

Releasing

This project follows Semantic Versioning and keeps a CHANGELOG.md. Pushing a tag matching v* triggers the release workflow.

Documentation site

MkDocs builds the API reference from docs/, published on every release. The docs also include a "Common DHCP Options" page with typed examples.

License

MIT — see 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

pydhcp-0.2.1rc1.tar.gz (60.9 kB view details)

Uploaded Source

Built Distribution

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

pydhcp-0.2.1rc1-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file pydhcp-0.2.1rc1.tar.gz.

File metadata

  • Download URL: pydhcp-0.2.1rc1.tar.gz
  • Upload date:
  • Size: 60.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pydhcp-0.2.1rc1.tar.gz
Algorithm Hash digest
SHA256 affee3aaaed9e4b6fcc4161be45543a6a727296c6f70fc92031b32824b969c3c
MD5 5fc66a9d3dad0dfc4fe2e4a1aea8b775
BLAKE2b-256 a835fd98579f6739b228cef1dfda044dc115d56ea18d40ee9eab7173b5403669

See more details on using hashes here.

File details

Details for the file pydhcp-0.2.1rc1-py3-none-any.whl.

File metadata

  • Download URL: pydhcp-0.2.1rc1-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pydhcp-0.2.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 a17c2b67a0dbe1f317fb9f06af90c25f123e12804de6e27e15af76bdc72f1038
MD5 36e7a6eaf86dc8cbc872968926e7cea4
BLAKE2b-256 071dd3346949627c4199b97c6dc1d24b9c4956360806be77fc5ac773dfbdd0f0

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