Skip to content

Environment Variables ​

This page lists the implemented TYWRAP_* environment variables in the repo today.

Bridge and Codec ​

These affect the Python bridge or decoded runtime behavior.

VariableScopeDefaultPurpose
TYWRAP_CODEC_FALLBACKPython bridgeunsetSet to json to allow JSON fallback when Arrow encoding is unavailable
TYWRAP_CODEC_MAX_BYTESPython bridgeunsetReject response payloads larger than this byte count (applied post-reassembly)
TYWRAP_REQUEST_MAX_BYTESPython bridgeunsetReject request payloads larger than this byte count (applied post-reassembly)
TYWRAP_TORCH_ALLOW_COPYPython bridgeoffAllow GPU-to-CPU or contiguous-copy conversion when serializing torch.Tensor
TYWRAP_ALLOWED_MODULESPython bridgeunsetComma- and/or whitespace-separated import allowlist; blank is unset, while a non-empty value permits only named modules plus bridge-required stdlib modules. See SECURITY.md.
TYWRAP_ALLOW_PRIVATE_ATTRSPython bridgeoffSet to 1, true, or yes to allow underscore-prefixed attribute access; otherwise it is blocked

Logging ​

These control the structured logger in the JavaScript runtime.

VariableDefaultPurpose
TYWRAP_LOG_LEVELWARNOne of DEBUG, INFO, WARN, ERROR, SILENT
TYWRAP_LOG_JSONfalseSet to 1 or true for JSON log output

Repo Test and Benchmark Knobs ​

These are used by the tywrap test suite and maintenance workflows. They are not required for normal library use.

VariablePurpose
TYWRAP_CODEC_PYTHONPython executable for codec-heavy tests
TYWRAP_PERF_BUDGETSEnable performance budget suites
TYWRAP_PERF_TIME_BUDGET_MSTime budget for generator performance tests
TYWRAP_PERF_MEMORY_BUDGET_MBMemory budget for generator performance tests
TYWRAP_CODEC_PERF_ITERATIONSIteration count for codec performance tests
TYWRAP_CODEC_PERF_TIME_BUDGET_MSTime budget for codec performance tests
TYWRAP_CODEC_PERF_MEMORY_BUDGET_MBMemory budget for codec performance tests
TYWRAP_ADVERSARIALEnable adversarial bridge tests
TYWRAP_ADVERSARIAL_PYTHONPython executable override for adversarial tests

Common Examples ​

Use JSON fallback:

bash
export TYWRAP_CODEC_FALLBACK=json

Cap response and request payload size:

bash
export TYWRAP_CODEC_MAX_BYTES=10485760
export TYWRAP_REQUEST_MAX_BYTES=1048576

Enable JSON logs:

bash
export TYWRAP_LOG_LEVEL=INFO
export TYWRAP_LOG_JSON=1

Not Configured Through Env Vars ​

Python executable and virtual environment selection are configured through code or config files today:

ts
new NodeBridge({ pythonPath: '/usr/bin/python3', virtualEnv: './venv' });
ts
import { defineConfig } from 'tywrap';

export default defineConfig({
  runtime: {
    node: {
      pythonPath: 'python3',
      virtualEnv: './venv',
      timeout: 30000,
    },
  },
});

Released under the MIT License.