Registry / http-networking / ipy
library1.01pypypi✓ verified 21d ago

IPy is a Python library providing classes and tools for handling IPv4 and IPv6 addresses and networks. It aims to offer a comfortable parsing and manipulation interface for various IP address notations, similar to Perl's Net::IP module. The current version is 1.01, and it appears to be in maintenance mode with no recent updates.

pip install ipy
INSTALL
IMPORT
SIG · IPY
I
ipy
http-networkingpythonv1.01
Install
2.4s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IP
from IPy import IP
IPSet
from IPy import IP, IPSet

Demonstrates creating IP and IPSet objects, iterating through a network, checking IP types, and performing set operations.

from IPy import IP, IPSet # Working with individual IP addresses and networks ip_network = IP('192.168.1.0/24') print(f"Network: {ip_network}") print(f"Version: {ip_network.version()}") for ip_addr in ip_network: print(f" Host: {ip_addr}") ip_host = IP('::1') print(f"IPv6 Host: {ip_host}") print(f"Is loopback: {ip_host.iptype() == 'LOOPBACK'}") # Working with IPSet for multiple ranges s = IPSet([IP('10.0.0.0/22')]) s.add(IP('192.168.1.0/29')) print(f"IPSet: {s}") print(f"Is disjoint from 172.16.0.0/12: {s.isdisjoint(IPSet([IP('172.16.0.0/12')]))}")
Debug
Known issues
breakingIPy version 1.01 officially supports Python versions 2.6 through 3.7. Using it with newer Python versions (3.8+) may lead to compatibility issues or unexpected behavior as it has not been updated since December 2020.
fix
Consider migrating to Python's built-in `ipaddress` module for Python 3.3+ projects, or use an alternative actively maintained library for newer Python versions.
affects: >=3.8
gotchaWhen comparing IPv6 addresses, using `IP().len()` for comparison is recommended over `len(IP)`. Addresses with an integer value greater than 64 bits can cause incorrect results with `len(IP)`.
fix
Always use the `IP().len()` method for robust IPv6 address comparisons.
affects: 1.01
gotchaFuzz testing with `IPSet` may produce spurious errors when the `IPSet` module aggregates two smaller prefixes into a larger one that matches the random prefix being tested against. This is noted as an 'Errata' in the package description.
fix
Be aware of this specific behavior during testing and validation of `IPSet` aggregation logic. This is not a functional bug but a known testing artifact.
affects: 1.01
deprecatedThe `ipaddress` module, providing similar functionality for IPv4 and IPv6 address manipulation, has been part of the Python standard library since Python 3.3. For new projects on Python 3.3 and above, `ipaddress` is generally the preferred choice due to its native integration and ongoing maintenance.
fix
For Python 3.3+ projects, utilize the `ipaddress` module directly: `import ipaddress`. For Python versions where `ipaddress` is not available, `ipy` might still be a viable option, but consider its lack of recent updates.
affects: <3.3 (recommended to use `ipaddress` for >=3.3)
Errors
Common errors & fixes
ERROR: Could not find a version that satisfies the requirement IPy (from versions: none) ERROR: No matching distribution found for IPy
This error typically occurs when trying to install IPy with a Python version newer than 3.7, as IPy version 1.01 is only compatible with Python 2.6 through 3.7.
fix
Use a Python environment with version 3.7 or older, or manually install a compatible version if one exists for newer Python versions (though 1.01 is the latest and supports up to 3.7). A common approach is to use a virtual environment with an older Python version: `pyenv install 3.7.9 && pyenv virtualenv 3.7.9 ipy_env && pyenv activate ipy_env && pip install ipy`.
ModuleNotFoundError: No module named 'IPy'
This means the 'IPy' package is either not installed, or Python cannot find it in its configured paths. This can happen if installation failed, was done in a different environment, or there's a typo in the import statement.
fix
Ensure the package is correctly installed using `pip install ipy` (or `pip3 install ipy` for Python 3). If using virtual environments, activate the correct environment before installation. Verify installation by running `python -c "import IPy; print(IPy.IP('192.168.1.1'))"`.
AttributeError: 'IP' object has no attribute 'range'
This error indicates an attempt to access a method or attribute named 'range' on an IPy 'IP' object, but no such method or attribute exists in the IPy library for generating IP address ranges directly.
fix
Instead of trying to call a non-existent 'range' method, iterate over the IP object directly or use its `len()` method for numeric comparison and iteration, or use methods like `IP.iter()` to get an iterator over IP addresses within a network. Example: `for ip_addr in IP('192.168.1.0/24'): print(ip_addr)`.
Upgrade
Version history
1.01latest on PyPI · released Dec 1, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources