Skip to main content

fitsolver-client

A minimal, dependency-free ctypes client for the FitSolver C ABI (fitsolver_lib). JSON in, JSON out -- the same contract as fitsolver.solve(), but without needing a compiled CPython extension.

Install

As a normal dependency (portal team, deployments)

Released wheels vendor the native fitsolver_lib inside the package, so there is nothing else to build or configure:

pip install fitsolver-client
# requirements.txt / pyproject.toml
fitsolver-client>=0.4.0

One wheel is published per OS (Linux manylinux_2_28, macOS x86_64 + arm64, Windows x64); each is valid for every Python >= 3.9. See .github/workflows/wheels.yml for how they are built and published.

From a local checkout (multi-repo development)

pip install -e path/to/FantasticSolver/python/fitsolver_client \
  --config-settings editable_mode=compat

editable_mode=compat writes a plain-path .pth instead of an import hook, so editors / Pylance resolve import fitsolver_client statically. An editable install has no vendored library; it uses your local build/ (see below), so a cmake --build is picked up with no reinstall.

The shared library

Resolution order at the first solve() call:

  1. FITSOLVER_LIB_PATH -- exact path to the .dll / .so / .dylib.
  2. FITSOLVER_REPO_ROOT -- looked up under <root>/build/.
  3. A build/ directory found by walking up from this package's location (covers pip install -e from inside a FitSolver checkout).
  4. fitsolver_client/_libs/ -- the copy vendored into a release wheel.

Importing the package never fails on its own; only solve() does, with SolverUnavailableError, if none of the above resolve.

To build the library for a local checkout:

cmake -B build
cmake --build build --config Release --target fitsolver_lib

Building a wheel by hand

cmake --build build --config Release --target fitsolver_lib
python python/fitsolver_client/tools/vendor_lib.py --build-dir build
python -m build --wheel python/fitsolver_client
# optional: normalise the tag to py3-none-<platform>
python -m wheel tags --python-tag py3 --abi-tag none \
  --platform-tag win_amd64 --remove python/fitsolver_client/dist/*.whl

Releasing a new version to PyPI

PyPI versions are immutable, so a release is always a deliberate version bump + tag. Publishing is automated (.github/workflows/wheels.yml) and uses Trusted Publishing (OIDC) -- no API token. Do it whenever the native fitsolver_lib behaviour changes (the wheels vendor the compiled library) or the client code itself changes.

  1. Bump the version. Edit version in python/fitsolver_client/pyproject.toml (semver: patch for a bug-fix-only lib rebuild, minor for new/changed packing behaviour, major for a breaking request/response change). Note the same version in this README's install snippet.

  2. Commit it on main.

    git add python/fitsolver_client/pyproject.toml python/fitsolver_client/README.md
    git commit -m "fitsolver-client: release vX.Y.Z"
    git push origin main
    

    The push runs the wheels workflow in build-and-smoke-test-only mode (no upload) -- check it is green before tagging.

  3. Tag and push the tag -- this is what publishes to PyPI.

    git tag vX.Y.Z          # tag name must match the pyproject version, with a leading v
    git push origin vX.Y.Z
    

    The tag push triggers the full matrix: per-OS wheels (Linux manylinux_2_28, macOS universal2, Windows x64) + an sdist, each smoke-tested in a clean venv, then publish-pypi uploads them.

  4. Verify. pip install fitsolver-client==X.Y.Z in a fresh venv; check https://pypi.org/project/fitsolver-client/ shows the new files.

  5. Bump consumers. Update fitsolver-client>=X.Y.Z in fantastic-portal/backend/pyproject.toml (and anywhere else it is pinned).

First-time setup (already done for this project)

On PyPI: Account -> Publishing -> add a pending publisher -- project fitsolver-client, owner FantasticDivision, repo Solver, workflow wheels.yml, environment pypi. Create a matching pypi environment under the GitHub repo's Settings -> Environments. No secrets are stored.

Usage

import fitsolver_client

response = fitsolver_client.solve({
    "items": [
        {"ItemCode": "ITM-001", "ItemReference": "Widget A",
         "Width": 100, "Length": 200, "Depth": 50, "Weight": 1.0},
    ],
    "boxes": [
        {"Reference": "SML", "Width": 150, "Length": 150, "Depth": 150,
         "MaxWeight": 8.5},
    ],
})

See the FitSolver README's "Request / response JSON schema" section for the exact shape of the request and response dicts.

Release files for fitsolver-client 0.4.0

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

Source distribution (sdist)

Source distribution for fitsolver-client 0.4.0
File Size Uploaded
fitsolver_client-0.4.0.tar.gz 5.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fitsolver-client 0.4.0
File Interpreter ABI Platform
fitsolver_client-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
fitsolver_client-0.4.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
fitsolver_client-0.4.0-py3-none-macosx_11_0_universal2.whl Python 3 none macOS 11.0+ universal2 (ARM64, x86-64) Details

Total release size: 548.1 kB

Release files / fitsolver_client-0.4.0.tar.gz

Download URL fitsolver_client-0.4.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bada8018ac49d7f8e4c2d362f276a3386c11a3749e5aa4be9285fbdb14d435d8
BLAKE2b-256 checksum
How to use checksums
9421529e21a08f4cda12fbba437350168ed3d3e70ff65d8bf22aeafeb1587c50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 14, 2026.

Transparency log

Release files / fitsolver_client-0.4.0-py3-none-win_amd64.whl

Download URL fitsolver_client-0.4.0-py3-none-win_amd64.whl
Size 113.4 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
cc6715ea14c056eb23e2f637f142823a8121478e8a31d855946d68fba9dd8231
BLAKE2b-256 checksum
How to use checksums
7b5474fa675a987ff0f6e3709a626325846f6a2ae7ed612beda3b1895b8fb002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 14, 2026.

Transparency log

Release files / fitsolver_client-0.4.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL fitsolver_client-0.4.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 186.7 kB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
64cb242250340353f06230f6e891a7f32b62ddee6af3b56e70c308a9db07f94d
BLAKE2b-256 checksum
How to use checksums
a7ccc32c0171d32547b0b3aa6a794c56b71421dde9834e3e1f93b779fb8b2ce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 14, 2026.

Transparency log

Release files / fitsolver_client-0.4.0-py3-none-macosx_11_0_universal2.whl

Download URL fitsolver_client-0.4.0-py3-none-macosx_11_0_universal2.whl
Size 242.2 kB
Tags Python 3 macOS 11.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
1317a4f6fd6d1cd9ebdfa3d02a55a76def7338f371e08e13d4b185dbd4000d09
BLAKE2b-256 checksum
How to use checksums
64cbdbab6b9442853d80a02dbc4689564f5a5bd6a443e0adc5b4e77c45a7ee11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 14, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.1

4 release files

0.7.0

4 release files

0.6.1

4 release files

0.6.0

4 release files

0.5.0

4 release files

This release

0.4.0 This release

4 release files

0.3.0

4 release files

0.2.0

4 release files

0.1.0

4 release 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