Beispiel
polars-runtime-32 1.43.2: Observe that the polars-runtime-32 backend requires explicit config reload to reflect in-process environment variable mutations and falls back to auto mode on unrecognized engine names.
Verifiziertes Beispiel für pypi polars-runtime-32 1.43.2: Observe that the polars-runtime-32 backend requires explicit config reload to reflect in-process…
sha256:bd700a56665e54f4af3f73bb5d8410f64255d33c55bc0976cc5b253c5d3406fb
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 2
- Signaturschlüssel, die es gebaut haben
- 2
Deklarierte Umgebung
python linux x64 python python pip
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1 |
2026-08-17 |
| python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1 |
2026-08-18 |
Fall
HOW- Ziel
- Observe that the polars-runtime-32 backend requires explicit config reload to reflect in-process environment variable mutations and falls back to auto mode on unrecognized engine names.
- Pakete
- Symbole
-
- _polars_runtime.config_reload_env_var
- _polars_runtime.get_engine_affinity
- Umgebung
- python
- Erstellt
- 2026-08-17T23:49:14Z
Contract
- In-process mutations to POLARS_ENGINE_AFFINITY do not take effect until config_reload_env_var is explicitly invoked, and unrecognized engine names fall back to auto rather than raising an exception.
- assert _polars_runtime.get_engine_affinity() defaults to 'auto'
- assert mutating os.environ['POLARS_ENGINE_AFFINITY'] does not change get_engine_affinity() before reload
- assert config_reload_env_var('POLARS_ENGINE_AFFINITY') applies the updated engine affinity
- assert setting an unrecognized engine affinity resets get_engine_affinity() to 'auto'
- assert set_float_fmt only accepts 'full' or 'mixed', raising ValueError on other formats like 'scientific'
- assert set_decimal_separator requires a string of length 1, raising ValueError on empty or multi-character strings
Dateien
- NOTES.md
- csx.json
- requirements.txt
- test/contract.py
Quelltext
# polars-runtime-32 Configuration and Environment Reloading
The search answered with an existing published sample (`sha256:f47e6aa3e74e03080d7e712a8e228e6cdecf55d56e14a2dd83a3d248f5bb8a75`) documenting that the package exports no top-level module under the package name. This sample investigates the internal native configuration system in `_polars_runtime_32._polars_runtime`.
The exact release pinned is `1.43.2`.
## Observed Behaviour
1. **Environment Variable Synchronization**:
- Mutating environment variables such as `POLARS_ENGINE_AFFINITY` in Python (`os.environ["POLARS_ENGINE_AFFINITY"] = "streaming"`) does not automatically update the runtime's internal state.
- Calling `_polars_runtime.get_engine_affinity()` continues returning `"auto"` until `_polars_runtime.config_reload_env_var("POLARS_ENGINE_AFFINITY")` or `_polars_runtime.config_reload_env_vars()` is explicitly called.
- If an unrecognized engine name is passed, the runtime prints a warning and falls back to `"auto"` rather than raising an exception. A caller expecting an immediate error or dynamic automatic propagation will observe default execution behavior.
2. **Formatting Option Validation**:
- Native float formatting configured via `_polars_runtime.set_float_fmt()` strictly enforces the allowed set `{'full', 'mixed'}` and fails loudly with `ValueError` when given options like `'scientific'`.
- Native decimal separator configured via `_polars_runtime.set_decimal_separator()` enforces single-character length, failing loudly with `ValueError` if passed an empty or multi-character string.
{"case":{"believed":"Mutating the POLARS_ENGINE_AFFINITY environment variable at runtime immediately updates the engine affinity of the polars runtime, and setting an unrecognized engine name raises an exception.","caseId":"case:sha256:f9fa3c8a505847d6f17b2e2bc4e0e8decb23fada70b86a02009b79ea57393da6","contract":["In-process mutations to POLARS_ENGINE_AFFINITY do not take effect until config_reload_env_var is explicitly invoked, and unrecognized engine names fall back to auto rather than raising an exception.","assert _polars_runtime.get_engine_affinity() defaults to 'auto'","assert mutating os.environ['POLARS_ENGINE_AFFINITY'] does not change get_engine_affinity() before reload","assert config_reload_env_var('POLARS_ENGINE_AFFINITY') applies the updated engine affinity","assert setting an unrecognized engine affinity resets get_engine_affinity() to 'auto'","assert set_float_fmt only accepts 'full' or 'mixed', raising ValueError on other formats like 'scientific'","assert set_decimal_separator requires a string of length 1, raising ValueError on empty or multi-character strings"],"goal":"Observe that the polars-runtime-32 backend requires explicit config reload to reflect in-process environment variable mutations and falls back to auto mode on unrecognized engine names.","kind":"HOW","packages":["pkg:pypi/polars-runtime-32@1.43.2"],"schemaVersion":1,"symbols":["_polars_runtime.config_reload_env_var","_polars_runtime.get_engine_affinity"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","ecosystem":"pypi","executionContext":"python","language":"python","os":"linux","packageManager":"pip","runtime":"python","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/polars-runtime-32@1.43.2"],"schemaVersion":1,"symbols":["_polars_runtime.config_reload_env_var","_polars_runtime.get_engine_affinity"],"verifierAdapter":"python@1"}
polars-runtime-32==1.43.2
import os
import _polars_runtime_32
import _polars_runtime_32._polars_runtime as pr
def test_engine_affinity_configuration():
# 1. Default engine affinity is 'auto'
assert pr.get_engine_affinity() == "auto"
# 2. Mutating os.environ does not immediately alter native engine affinity
os.environ["POLARS_ENGINE_AFFINITY"] = "streaming"
assert pr.get_engine_affinity() == "auto", (
"Engine affinity should remain 'auto' until explicitly reloaded"
)
# 3. Explicit config_reload_env_var updates native state
pr.config_reload_env_var("POLARS_ENGINE_AFFINITY")
assert pr.get_engine_affinity() == "streaming"
# 4. config_reload_env_vars reloads all runtime options
os.environ["POLARS_ENGINE_AFFINITY"] = "in-memory"
pr.config_reload_env_vars()
assert pr.get_engine_affinity() == "in-memory"
# 5. Unrecognized engine names fall back to 'auto'
os.environ["POLARS_ENGINE_AFFINITY"] = "unrecognized_engine"
pr.config_reload_env_vars()
assert pr.get_engine_affinity() == "auto"
def test_runtime_metadata_and_format_config():
# 6. Runtime representation is 'rt32' and build flags are exported
assert pr.RUNTIME_REPR == "rt32"
assert hasattr(_polars_runtime_32, "BUILD_FEATURE_FLAGS")
assert isinstance(_polars_runtime_32.BUILD_FEATURE_FLAGS, str)
# 7. Float formatting only accepts {'full', 'mixed'}
assert pr.get_float_fmt() == "mixed"
pr.set_float_fmt("full")
assert pr.get_float_fmt() == "full"
try:
pr.set_float_fmt("scientific")
raise AssertionError("set_float_fmt('scientific') should have failed")
except ValueError as exc:
assert "fmt must be one of {'full', 'mixed'}" in str(exc)
# 8. Decimal separator requires single-character strings
assert pr.get_decimal_separator() == "."
pr.set_decimal_separator(",")
assert pr.get_decimal_separator() == ","
try:
pr.set_decimal_separator("..")
raise AssertionError("set_decimal_separator('..') should have failed")
except ValueError as exc:
assert "expected a string of length 1" in str(exc)
try:
pr.set_decimal_separator("")
raise AssertionError("set_decimal_separator('') should have failed")
except ValueError as exc:
assert "expected a string of length 1" in str(exc)
# 9. Thousands separator configuration
assert pr.get_thousands_separator() == ""
pr.set_thousands_separator("_")
assert pr.get_thousands_separator() == "_"
if __name__ == "__main__":
test_engine_affinity_configuration()
test_runtime_metadata_and_format_config()