Skip to content

feat: use one bundled CoolProp backend#21

Merged
wlaur merged 5 commits into
mainfrom
feat/native-coolprop-only
Jul 21, 2026
Merged

feat: use one bundled CoolProp backend#21
wlaur merged 5 commits into
mainfrom
feat/native-coolprop-only

Conversation

@wlaur

@wlaur wlaur commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • remove the Python coolprop package from runtime dependencies
  • turn the existing _internal cdylib into one dual-purpose artifact:
    • a direct PyO3 scalar/metadata/validation bridge
    • the existing Polars plugin ABI for every array and expression size
  • reuse bounded thread-local AbstractState handles for scalar calls and keep one-property-per-node Polars evaluation unchanged
  • delete the Python backend split, threshold dispatch, low-level loops, function-identity routing, and duplicated phase constants
  • pin the bundled CoolProp version/commit in one build-info source and ship its license
  • keep Python CoolProp 8.0.0 only in the opt-in oracle dependency group for independent parity CI
  • update README, usage docs, contributor guidance, architecture notes, performance results, and package-size expectations

Correctness and CI coverage

  • committed golden cases cover Water, HEOS, incompressibles, embedded fractions, explicit composition, assumed phase, non-PT pairs, and humid air across scalar, NumPy, Series, and Expr magnitudes
  • oracle CI compares the bundled implementation with Python CoolProp across the reviewed input-pair table (all 35 families), parsing, mixtures, phases, invalid rows, and threaded evaluation
  • normal wheel/dependency-floor tests assert that Python CoolProp is absent from both metadata and the environment
  • added a visible, non-publishing Python 3.14t readiness smoke; Python 3.15t publication remains gated on the released Polars/PyO3 stack and the full PLAN.md verification gate

Local verification:

  • pre-commit: pass
  • pyright strict, pyrefly, ty: pass with zero errors
  • Rust fmt/clippy/tests: pass
  • source suite with oracle: 1,135 passed
  • clean installed final wheel without Python CoolProp: 790 passed, 19 oracle/tooling skips
  • executable docs/static typing: 253 passed
  • Sphinx -W build and ReadTheDocs-parity build: pass
  • local Python 3.14t smoke: GIL stayed disabled for scalar and Polars evaluation

Performance

Apple M4 Pro, CPython 3.14.3, Polars 1.42.1, medians of seven warmed runs:

workload v1.8.0 this branch change
public IF97 scalar 62.49 us 59.68 us -4.5%
public HEOS scalar 97.36 us 65.14 us -33.1%
public humid-air scalar 57.35 us 55.30 us -3.6%
HEOS array, 100k rows 470.49 ms 469.92 ms -0.1%
3 HEOS properties, 100k rows 534.06 ms 537.51 ms +0.6%

The permanent benchmark also records bundled-C-ABI references, first call, warm call, cache hit/miss, and cache eviction.

Wheel size

macOS arm64 artifacts:

  • old resolved wheels: 19,614,998 bytes (encomp 9,043,747 + Python CoolProp 10,571,251)
  • new resolved wheel: 9,079,148 bytes
  • net download reduction: 10,535,850 bytes (53.7%)

The encomp artifact itself grows by 35,401 bytes for the direct bridge, tests, and bundled license; the installation saving comes from removing the separate 10.57 MB Python CoolProp wheel. The final wheel contains exactly one libCoolProp, no runtime CoolProp requirement, and the upstream license.

Release gate

This PR deliberately does not bump the version, tag, publish, merge, or enable a Python 3.15t release. Those actions remain gated on maintainer review as requested.

@wlaur
wlaur merged commit 6ef4266 into main Jul 21, 2026
21 checks passed
@wlaur
wlaur deleted the feat/native-coolprop-only branch July 21, 2026 15:26
@wlaur wlaur mentioned this pull request Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant