Little Fluffy Clouds: Gather a bunch of small adjacent networks into larger ones.
Sometimes you find yourself staring at a bunch of networks that look like they could be combined if you could just kind of smoosh them together enough.
littlefluffyclouds is that smoosher.
For example, this AS has a huge number of small networks. In many cases, two /24 networks are adjacent and could be combined into a single /23. There's also a big /14 network with 252 smaller networks inside it. If you use that raw output in a command or a firewall rule, etc., then you'd have to add 7,945 networks. Wow! That's too many.
$ curl -s https://ip.guide/AS9121 | jq -r .routes.v4[]
2.17.224.0/22
2.17.228.0/22
2.17.232.0/22
2.17.236.0/22
2.20.24.0/22
23.55.52.0/22
[7,933 similar lines]
212.175.175.0/24
212.175.246.0/24
212.175.250.0/24
212.175.251.0/24
212.175.252.0/24
212.175.255.0/24
Instead, let's let littlefluffyclouds mash all those little clouds into a smaller number of big ones that cover the exact same collection of addresses:
$ curl -s https://ip.guide/AS9121 |
jq -r .routes.v4[] |
uv run littlefluffyclouds --stdin
2.17.224.0/20
2.20.24.0/22
23.55.52.0/22
62.248.0.0/17
78.160.0.0/11
81.212.0.0/14
85.96.0.0/12
88.224.0.0/11
93.155.104.0/22
95.0.0.0/12
176.52.176.0/22
193.110.209.0/24
194.54.32.0/19
195.174.0.0/15
212.156.0.0/16
212.174.0.0/15
The end result is 16 networks. Sixteen. That's just about 1/500th the original size with identical address space coverage. Yay, big clouds!
API
"But I don't want to use a command line," you might say. Neither did I! littlefluffyclouds makes that easy peasy lemon squeezy!
from ipaddress import IPv4Network as I
from littlefluffyclouds import gather
print(gather([
I('10.0.8.0/24'),
I('10.0.9.0/24'),
I('10.0.10.0/24'),
I('10.0.11.0/24')
]))
That prints [IPv4Network('10.0.8.0/22')]. Whoa! I know, right?
But... why?
Some differences with other packages which do the same thing:
- It's often way faster. Like ridiculously faster. Think milliseconds versus minutes faster.
- It's written with modern Python with typing and ruff and formatting and all that.
- Its command line is optional. All the work is done in a handy API that you can call from your own project.
- It gives correct results, even in pathological cases where little networks are intermingled with bigger ones. That case causes several other packages to only merge the big networks or the little ones, even when you could combine a bunch of little ones with one big one.
Authors
Little Fluffy Clouds is copyright 2025 by Kirk Strauser kirk@strauser.com.
License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Version history
v0.2.0, 2025-09-19: Add --stdin flag. License fix.
v0.1.0, 2025-09-17: Initial release.
Metadata
Release files for littlefluffyclouds 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| littlefluffyclouds-0.2.0.tar.gz | 81.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| littlefluffyclouds-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 99.5 kB
Release files / littlefluffyclouds-0.2.0.tar.gz
| Download URL | littlefluffyclouds-0.2.0.tar.gz |
|---|---|
| Size | 81.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb47add50cf4aaf21416e9f41065ba6333497f276622dd3ca1e5ab9296e867ed
|
|
BLAKE2b-256 checksum How to use checksums |
7ac474cf10f5db140e93133cf660c0d8a0e3e25d502dd668486f33090df62f5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Release files / littlefluffyclouds-0.2.0-py3-none-any.whl
| Download URL | littlefluffyclouds-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb512cc009efc0e894917c0d4c363bc17f728f4e73a1e7563693ae74464d127d
|
|
BLAKE2b-256 checksum How to use checksums |
18ef7174969f1f50453bff4d489b3259c8b97d13d1cdd870413dc503a8194bc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Security for littlefluffyclouds 0.2.0
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.