Skip to main content

polars-gdx

Lazy, prefiltered Polars access to GAMS GDX files — no GAMS installation required.

  • scan_gdx(path, symbol=...) returns a pl.LazyFrame; nothing is read until collect(), and column projection is pushed down via Polars' IO-source interface. read_gdx(...) is the eager convenience wrapper (scan_gdx(...).collect(), same arguments).
  • Predicates on key columns (key_filter={dim_index: allowed_labels} or filter()) are folded into a native, index-based prefilter inside the Rust read loop, so unwanted records are never materialized — unlike the official gamsapi reader, which must load everything into pandas first.
  • Under the hood: hand-written FFI to the vendored MIT-licensed GDX C library, extracted from lolow/gdxcomp, building on GAMS-dev/gdx.

Usage

import polars as pl
from polars_gdx import scan_gdx, list_symbols

list_symbols("trnsport.gdx").filter(pl.col("type") == "Param")

# lazy: nothing read yet
x = scan_gdx("trnsport.gdx", symbol="x")

# read only the seattle rows, skipping all others natively
x.filter(pl.col("dim_0") == "seattle").collect()

# eager convenience: read_gdx = scan_gdx(...).collect()
from polars_gdx import read_gdx
df = read_gdx("trnsport.gdx", symbol="x", key_filter={0: ["seattle"]})

Benchmark

vs gamsapi 54.5.0 (pandas-backed), on a 2M-record parameter (80 MB GDX); best of 5 runs. See benchmarks/bench_vs_gamsapi.py (run as a CI job on every push).

Scenario polars-gdx gamsapi (pandas)
Full read (2M rows) 0.126 s 0.086 s
filter(dim_0 == label) — 1000 of 2M rows 0.081 s 0.087 s¹
Explicit key_filter — 1000 rows 0.080 s —

¹ gamsapi has no lazy loading or pushdown: it must materialize the whole symbol, then filter. The advantage of polars-gdx grows with predicate selectivity.

Build

maturin develop --release   # builds the vendored GDX C library + extension
pytest

Requires a C++17 compiler and CMake ≥ 3.5 at build time; runtime has no GAMS dependency.

Layout

crates/gdx-sys        # raw FFI; builds vendored GDX-dev/gdx via CMake
crates/gdx            # safe RAII wrapper (global lock; lazy UEL interning)
crates/polars-gdx     # PyO3 extension: symbol listing + Arrow streaming with prefiltering
python/polars_gdx     # Python layer: scan_gdx / list_symbols

Metadata

Release files for polars-gdx 0.1.1

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

Source distribution (sdist)

Source distribution for polars-gdx 0.1.1
File Size Uploaded
polars_gdx-0.1.1.tar.gz 2.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for polars-gdx 0.1.1
File
polars_gdx-0.1.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
polars_gdx-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
polars_gdx-0.1.1-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
polars_gdx-0.1.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
polars_gdx-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.1 MB

Release files / polars_gdx-0.1.1.tar.gz

Download URL polars_gdx-0.1.1.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
b4ddee020897729647442ddafc4251c0722fa1a354e46a1597ac0ac2a502eb34
BLAKE2b-256 checksum
How to use checksums
1d802e9e5147b07583610985535284f3d51820ac1757a09415451b66e9edb8b9
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 Oct 3, 2026.

Transparency log

Release files / polars_gdx-0.1.1-cp39-abi3-win_amd64.whl

Download URL polars_gdx-0.1.1-cp39-abi3-win_amd64.whl
Size 680.6 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3ceacff1b03f8f9fb925c144f59ad6ce0d0e33c272a8eb0cad887cf95dad9567
BLAKE2b-256 checksum
How to use checksums
bd2a263476c9d19daba9aceaf23093b3a52b029955ddacb13f19650722c14911
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 Oct 3, 2026.

Transparency log

Release files / polars_gdx-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL polars_gdx-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl
Size 569.8 kB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
4a6f77d6784d4365de7e1239b3c9891b3e4ab4f649c859c4b646123f9e1a25a8
BLAKE2b-256 checksum
How to use checksums
b3488f384e74e0750adf3f94b759e74ab2670f2a81b3a3d314646764dae0c442
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 Oct 3, 2026.

Transparency log

Release files / polars_gdx-0.1.1-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL polars_gdx-0.1.1-cp39-abi3-manylinux_2_28_aarch64.whl
Size 542.9 kB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
4625e31912bd836e3546c5506845490e1844021882be89dd9ad0b260392d5c2a
BLAKE2b-256 checksum
How to use checksums
2b0f63c1f3cdc9c795410a6f1cd3ca9e97f348727e1b31f756135b4d92ade56a
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 Oct 3, 2026.

Transparency log

Release files / polars_gdx-0.1.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL polars_gdx-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Size 472.9 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
626fb4befdec42941fe1f9cf34e7e9f15b84c065ceb0bb9d8ecbf917bab52be6
BLAKE2b-256 checksum
How to use checksums
2739ff0bdd1298d3b74aa7eb497f9b30bd922706ed7e48401ebb1498dbf6070c
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 Oct 3, 2026.

Transparency log

Release files / polars_gdx-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL polars_gdx-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 508.8 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7a49de2c4b2543988ecc3e8df13856db1aa29283efadfa1d67bc1c675fefcbb4
BLAKE2b-256 checksum
How to use checksums
18130a15fa10acd9a02bd1f55754ef1ed8ab07a14ba7f4eed2e28c529a3e040f
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 Oct 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.0

6 release files

0.5.0

6 release files

0.4.0

6 release files

0.3.1

6 release files

0.3.0

6 release files

0.2.0

6 release files

0.1.3

6 release files

0.1.2

6 release files

This release

0.1.1 This release

6 release files

0.1.0

6 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