Skip to main content

Netsome

pypi downloads downloads versions license coverage Ask DeepWiki

A Python library for working with common networking types and conversions, including IPv4/IPv6 addresses/networks, MAC addresses, BGP ASNs, VLANs and network interfaces.

Installation

pip install netsome

Features

  • IPv4 & IPv6 address and network manipulation (addresses, networks, interfaces)
  • IPv6 Support: Full IPv6 address handling with compression, special address types, and IPv4-mapped addresses
  • MAC address handling (MAC-48/EUI-48)
  • BGP AS number conversions (asplain, asdot, asdotplus formats)
  • VLAN ID validation and management
  • Network interface name parsing and standardization
  • Robust validation for all data types
  • Type-safe implementation with proper error handling

Basic Usage

from netsome.types import (
    IPv4Address,
    IPv4Network,
    IPv4Interface,
    IPv6Address,
    IPv6Network,
    IPv6Interface,
    MacAddress,
    ASN,
    VID,
    Community,
    Interface,
)

# IPv4 address and network manipulation
ipv4_addr = IPv4Address("192.168.1.1")
print(ipv4_addr.address)  # "192.168.1.1"
print(ipv4_addr.cidr)  # "192.168.1.1/32"

ipv4_net = IPv4Network("192.168.1.0/24")
print(ipv4_net.prefixlen)  # 24
print(ipv4_net.netaddress)  # "192.168.1.0"

ipv4_interface = IPv4Interface("192.168.1.1/24")
print(ipv4_interface.address)  # "192.168.1.1"
print(ipv4_interface.network)  # "192.168.1.0/24"

# IPv6 address and network manipulation
ipv6_addr = IPv6Address("2001:db8::1")
print(ipv6_addr.address)  # "2001:db8::1"
print(ipv6_addr.expanded)  # "2001:0db8:0000:0000:0000:0000:0000:0001"
print(ipv6_addr.is_global)  # True

ipv6_net = IPv6Network("2001:db8::/32")
print(ipv6_net.prefixlen)  # 32
print(len(list(ipv6_net.subnets(prefixlen=64))))  # 4294967296

ipv6_interface = IPv6Interface("2001:db8::1/64")
print(ipv6_interface.address)  # "2001:db8::1"
print(ipv6_interface.network)  # "2001:db8::/64"

# IPv6 special address detection
link_local = IPv6Address("fe80::1")
print(link_local.is_link_local)  # True

multicast = IPv6Address("ff02::1")
print(multicast.is_multicast)  # True

# Work with MAC addresses
mac = MacAddress("001122334455")
print(mac.is_unicast())  # True
print(mac.oui)  # "001122"

# Handle BGP AS numbers
asn = ASN.from_asdot("64512.1")
print(asn.to_asplain())  # "4244897793"

# Work with BGP Communities
community = Community.from_str("65000:100")
print(str(community))  # "65000:100"
print(int(community))  # 4259840100

# Manage VLAN IDs
vid = VID(100)
print(vid.is_reserved())  # False

# Parse and work with network interface names
iface = Interface("eth0")
print(iface.type)  # IFACE_TYPES.ETHERNET
print(iface.value)  # "0"
print(iface.canonical_name)  # "Ethernet0"
print(iface.abbreviated_name)  # "Eth0"

Authors

  • Dmitriy Kudryavtsev - author - kuderr

Metadata

Release files for netsome 0.4.5

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

Source distribution (sdist)

Source distribution for netsome 0.4.5
File Size Uploaded Provenance Actions
netsome-0.4.5.tar.gz 17.8 kB Without provenance Details for netsome-0.4.5.tar.gz

Built distribution (wheel)

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

Total release size: 43.8 kB

Release files / netsome-0.4.5.tar.gz

Download URL netsome-0.4.5.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a393e758f9b2a3b3506ccc31848f34c154861927f30c75de4658a346de559178
BLAKE2b-256 checksum
How to use checksums
99673580f9625b42eb54568a3221f7edd9298b5deef02cbda476aad6c154fa7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.14.3 Darwin/25.0.0

Release files / netsome-0.4.5-py3-none-any.whl

Download URL netsome-0.4.5-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
008759f5b4055c4e29aa0d7fb190e7db110deab006e9dd69bb90348b3616f779
BLAKE2b-256 checksum
How to use checksums
58aaf9ee21a64747d1b878514ef4ea4e452b507a93f51ed4a1cf26ba8d034f01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.14.3 Darwin/25.0.0

Security for netsome 0.4.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.4.5 This release

2 release files No provenance

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