⚡️ fastdsu
A fast disjoint sets implementation for Python, backed by Rust.
Accepts Arrow arrays via the C Data Interface (__arrow_c_array__) for zero-copy ingestion and zero-copy output. Works with any library that exports Arrow — PyArrow, Polars, pandas, and so on.
Why another implementation?
If you need disjoint sets / connected components over Arrow in Python, the common options are:
- A pure Python implementation
- SciPy's
connected_components - A graph library such as NetworkX or rustworkx
Pure Python requires leaving Arrow. SciPy requires leaving Arrow and constructing a sparse matrix — a large intermediate allocation entirely separate from the operation you actually want. Graph libraries bring heavy dependencies for what is fundamentally a simple algorithm.
fastdsu accepts Arrow arrays directly: no intermediate objects, no unnecessary allocations.
Requirements
Inputs must be non-nullable Arrow arrays, both of the same data type, using a fixed-width integer type (int8/int16/int32/int64/uint8/uint16/uint32/uint64).
fastdsu has no required Python dependencies — inputs and outputs use the Arrow C Data Interface protocol, so any Arrow-compatible library works at call time without being a declared dependency.
Usage
import pyarrow as pa
from fastdsu import DSU
dsu = DSU()
# Feed edge batches as they arrive: zero-copy in
dsu.union(batch_1_src, batch_1_dst)
dsu.union(batch_2_src, batch_2_dst)
# Extract components: zero-copy out, a two-column (key, label) Arrow table
components = dsu.components()
pa.record_batch(components) # consume with PyArrow
pl.from_arrow(components) # or Polars, or any Arrow-compatible library
Works naturally with Polars:
import polars as pl
from fastdsu import DSU
edges = pl.DataFrame({"src": [0, 1, 3, 4], "dst": [1, 2, 4, 5]}).cast(pl.UInt32)
dsu = DSU()
dsu.union(edges["src"].to_arrow(), edges["dst"].to_arrow())
components = pl.from_arrow(dsu.components())
result = edges.join(components, left_on="src", right_on="key", how="left")
One-shot convenience function
For a single batch of edges, connected_components skips constructing a DSU:
import pyarrow as pa
from fastdsu import connected_components
components = connected_components(src, dst)
pa.record_batch(components)
Contributing
pre-commit is mandatory and must be turned on.
pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit
This repo uses just as its task runner.
Metadata
Release files for fastdsu 0.0.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 | Actions |
|---|---|---|---|---|
| fastdsu-0.0.0.tar.gz | 38.1 kB | With provenance | Details for fastdsu-0.0.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| fastdsu-0.0.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for fastdsu-0.0.0-cp311-abi3-win_amd64.whl |
| fastdsu-0.0.0-cp311-abi3-manylinux_2_28_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ x86-64 | Details for fastdsu-0.0.0-cp311-abi3-manylinux_2_28_x86_64.whl |
| fastdsu-0.0.0-cp311-abi3-manylinux_2_28_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ ARM64 | Details for fastdsu-0.0.0-cp311-abi3-manylinux_2_28_aarch64.whl |
| fastdsu-0.0.0-cp311-abi3-macosx_11_0_x86_64.whl | CPython 3.11 | abi3 | macOS 11.0+ x86-64 | Details for fastdsu-0.0.0-cp311-abi3-macosx_11_0_x86_64.whl |
| fastdsu-0.0.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for fastdsu-0.0.0-cp311-abi3-macosx_11_0_arm64.whl |
Total release size: 14.9 MB
Release files / fastdsu-0.0.0.tar.gz
| Download URL | fastdsu-0.0.0.tar.gz |
|---|---|
| Size | 38.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebaf712832bbe0c0bb041a678462d4759bc3d5b34e5618d1b849cc88a5dc19af
|
|
BLAKE2b-256 checksum How to use checksums |
a6c7a988cc15f568e42d15ed76a29e089e3dfac757dc590610f41161b39d7288
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logRelease files / fastdsu-0.0.0-cp311-abi3-win_amd64.whl
| Download URL | fastdsu-0.0.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
bc46ad7347ef8c9f78bdcfd62644395610a1bfc6f6f67749a772c45173fda189
|
|
BLAKE2b-256 checksum How to use checksums |
b9bb53331c8a06743df893f89eda58aecf82f7bb7d203c0b5cdcb84f32e83d6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logRelease files / fastdsu-0.0.0-cp311-abi3-manylinux_2_28_x86_64.whl
| Download URL | fastdsu-0.0.0-cp311-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d2d81268d35c2f804df5d6d7d98f27dfa1c7b42d04c9674043fe28dca6bf9a07
|
|
BLAKE2b-256 checksum How to use checksums |
45dd0e1e8fdc67e659efaf64a99fb87bcec7c6f6c9f32775d38079b7988610c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logRelease files / fastdsu-0.0.0-cp311-abi3-manylinux_2_28_aarch64.whl
| Download URL | fastdsu-0.0.0-cp311-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
737d1e2461035a3739771c75c961de81aea23da42947eea60368c5b32fe6917b
|
|
BLAKE2b-256 checksum How to use checksums |
ed044f178d4315f6f05ef4623190c8efbb09dda5ea30e9723fcb22dd4e2fee23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logRelease files / fastdsu-0.0.0-cp311-abi3-macosx_11_0_x86_64.whl
| Download URL | fastdsu-0.0.0-cp311-abi3-macosx_11_0_x86_64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
68b533ea5e5a53c2a41a3f2f055302c0d6e806953e533876f9c34b3c40911846
|
|
BLAKE2b-256 checksum How to use checksums |
a343906cfe4d214e145e65003661383ac9a11f7edda74e7f06c138e761c4e985
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logRelease files / fastdsu-0.0.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | fastdsu-0.0.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0c746377601ab55dfa8b4bcab53392aa3679e789867ebda47d892961ba5ca9c6
|
|
BLAKE2b-256 checksum How to use checksums |
9c1e55ea3ec4a8c6a37e6b5e72fbd50fba1e241adc730b022d64ed74e4eaff78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logSecurity for fastdsu 0.0.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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for fastdsu-0.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.
Transparency logA 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.