Skip to main content

goatd for Python

Python bindings for goatd, built with PyO3 and maturin.

pip install goatd

Wheels cover CPython 3.10 and later on Linux x86-64, macOS arm64 and Windows x64. Anywhere else, pip builds from the source distribution, which needs a Rust toolchain and a C++20 compiler.

import goatd

graph = goatd.Graph(4, [(0, 1), (1, 2), (2, 3), (3, 0), (0, 2)])
td = goatd.decompose(graph, order="portfolio", budget_ms=100)

td.treewidth        # 2
td.bags             # [[0, 1, 2], [0, 2, 3]]
td.edges            # [(0, 1)] — pairs of positions in td.bags
td.validate(graph)  # raises goatd.Error if td does not decompose graph
print(td.to_td())   # PACE .td text

decompose takes the solver's knobs under the solver's names: order is one of minfill, mindegree, nested-dissection, flowcutter and portfolio; seed breaks ties; ties="sample" and weights control weighted sampling for the two greedy orders; steps gives flowcutter a repeatable step budget in place of a clock; refine=True re-cuts the result along FlowCutter separators. An argument the chosen order cannot act on raises ValueError naming both. Budgets are milliseconds, so the name is budget_ms rather than the command line's --budget.

goatd.Graph.from_gr and TreeDecomposition.from_td read the PACE formats; to_gr and to_td write them.

goatd is single-threaded. The interpreter lock is released for the whole of a solve, so a caller can decompose several graphs at once from Python threads.

Building

The extension builds against the published goatd crate rather than the checkout around it, so it needs a Rust toolchain, a C++20 compiler for the vendored FlowCutter, and maturin.

PEP 639 resolves license-files against the directory holding pyproject.toml and forbids .., so the two notice files are copied in from the repository root first rather than kept here in a second copy:

mkdir -p bindings/python/notices
cp LICENSE docs/THIRD-PARTY.md bindings/python/notices/
pip install maturin
maturin build --release --manifest-path bindings/python/Cargo.toml

maturin develop installs the extension into the active virtualenv for pytest bindings/python/tests.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goatd-0.1.2.tar.gz (582.1 kB view details)

Uploaded Source

Built Distributions

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

goatd-0.1.2-cp310-abi3-win_amd64.whl (413.2 kB view details)

Uploaded CPython 3.10+Windows x86-64

goatd-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl (536.7 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

goatd-0.1.2-cp310-abi3-macosx_11_0_arm64.whl (473.0 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file goatd-0.1.2.tar.gz.

File metadata

  • Download URL: goatd-0.1.2.tar.gz
  • Upload date:
  • Size: 582.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for goatd-0.1.2.tar.gz
Algorithm Hash digest
SHA256 183fcabee6f6416189ad20fdb9ab70347a658756a47e4d479f5fd0f7be137cb3
MD5 1c0d2302e765ae1d9fb0ae46e9386ec9
BLAKE2b-256 12b7e7f7420b82de5402ce9c33cecfa6b962509dd1a916e448f8f56d477afa3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for goatd-0.1.2.tar.gz:

Publisher: wheels.yml on Tractables/goatd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file goatd-0.1.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: goatd-0.1.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 413.2 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for goatd-0.1.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 90f57373b61a26a98f4f19ba3f4863cf25b64eeae1260a4fe03dc2e934d61588
MD5 ef3d92f2bdb94716d9070a1adaf60d58
BLAKE2b-256 528c1b110c8509c7a83289031779fd11c6012d7035f8c06354cdf692afedc26e

See more details on using hashes here.

Provenance

The following attestation bundles were made for goatd-0.1.2-cp310-abi3-win_amd64.whl:

Publisher: wheels.yml on Tractables/goatd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file goatd-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for goatd-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d64763e2750734004afe7acb876fab9f483547ee8394cc3e777338a720ca10f
MD5 947881a52eea13ed151ef4e576306185
BLAKE2b-256 ee0ca8b7065537a74f03ad7e8e937abf8fcf2bef5cad41a8df0c7f61d7bddbbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for goatd-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on Tractables/goatd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file goatd-0.1.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: goatd-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 473.0 kB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for goatd-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77cd8b047f8efcce3efbc1b8d88bfcbe4496ce8f751dbc102618570734650f8a
MD5 632d64a6a24e8023037746e9bd5e7297
BLAKE2b-256 f86a524b31cefcbe1c03c2627fb4a16c05749b281a5d637eea2f54fcac7f95ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for goatd-0.1.2-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on Tractables/goatd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

4 files

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