Environment Variables#

These variables tune logging, the session store and parallelism. Set them in your shell or in your process’s environment. isocenter does not read a .env file. To use one, call dotenv.load_dotenv() yourself before you import isocenter.

A flag whose default is 0 is on only when its value is exactly 1. Isocenter ignores true, yes and on, and gives no warning.

Each variable’s name, default and documented behaviour are part of the 1.0 freeze (API stability). The table is the index. Each variable has its own section below, with its default, what it does, what it does not reach, and its floor.

Variable

Default

Summary

ISOCENTER_LOG_LEVEL

DEBUG

Logging verbosity, for the console and the log file.

ISOCENTER_LOG_FILE

isocenter.log

Where the log file is written.

ISOCENTER_DB_PATH

isocenter.db

The store that Session() opens when it is given none. :memory: is accepted.

ISOCENTER_MAX_WORKERS

os.cpu_count()

How many workers a parallel pass uses. redact() has its own default.

ISOCENTER_CHUNKSIZE

1

How many items each worker task carries.

ISOCENTER_MAX_TASKS_PER_CHILD

Unlimited

Recycle each worker process after N tasks. It always means processes.

ISOCENTER_DISABLE_GC

0

1 disables garbage collection in worker processes.

ISOCENTER_FORCE_THREADS

0

1 runs audit(), scan_pixel_content() and redact() in threads.

ISOCENTER_FORCE_PROCESSES

0

1 runs in processes on a free-threaded build too.

ISOCENTER_SHOW_PROGRESS

1

0 turns every progress bar off.

ISOCENTER_REQUIRE_TEXT_DETECTOR

0

Test suite only: 1 makes the real text-detector tests fail instead of skip when the detector cannot run.

ISOCENTER_REQUIRE_NLP_MODEL

0

Test suite only: 1 makes the real spaCy-model tests fail instead of skip when spaCy or en_core_web_sm cannot load.

ISOCENTER_WORKER_FAULTHANDLER

0

Diagnostic: 1 makes a worker process that is still alive after 240 s dump its stacks. It also ends a worker whose exit is not finished 15 s after the exit began.

ISOCENTER_LOG_LEVEL#

Default: DEBUG.

Logging verbosity: DEBUG, INFO, WARNING, ERROR or CRITICAL. It gates the console as well as the log file. At ERROR or CRITICAL, the unsaved-instances warning of close() reaches neither stdout nor isocenter.log.

ISOCENTER_LOG_FILE#

Default: isocenter.log.

The path that the file handler writes to. The file handler takes DEBUG and above. The console handler takes WARNING and above, and this variable does not affect it. An explicit log_file argument to configure_logger() wins over this variable.

ISOCENTER_DB_PATH#

Default: isocenter.db.

The path to the session store, a SQLite database. Isocenter reads this variable when Session() is given no persistence_file. Name a path on a local disk. The store uses SQLite’s WAL mode and flock locks, and neither is dependable over a network filesystem (see Keep the store on local disk).

:memory: is accepted, here or as Session(":memory:"):

  • The index lives in memory. The pixel sidecar lives in a temporary file under $TMPDIR, which should be local too. The store removes that file on close().

  • redact() runs in threads on every interpreter. If worker recycling is asked for, redact() refuses (see ISOCENTER_FORCE_PROCESSES and ISOCENTER_MAX_TASKS_PER_CHILD).

ISOCENTER_MAX_WORKERS#

Default: one worker per CPU (os.cpu_count(), or 1 when it cannot answer), except redact(), below.

Floor: 1. A value below 1, 0 or any negative, is not a worker count. Isocenter reports it with a warning that names the variable and the value, and uses the default instead. To ask for a single worker, set 1.

How many workers a parallel run uses, processes or threads, whichever the three levers resolve to. The same number sizes all three pools:

  • The pool of audit(), scan_pixel_content() and export(). Its default is one per CPU.

  • The session’s shared pool, the process pool that ingest() runs on. It has the same default.

    • Isocenter reads the variable at Session() and again at the start of every ingest(). That ingest() rebuilds the pool when the width changed. A value set after the session opens reaches the next ingest(). An unchanged width rebuilds nothing, so an ordinary session keeps one pool for its lifetime.

    • The one exception is a second ingest() running on another thread of the same session. The two calls share the pool, and to shut the pool down would cancel the queued files of the call that is already running. So the resize is skipped, and one WARNING names this variable, the pool’s width and the width asked for. The next ingest() that starts with no other in flight is built at the new width.

    • The shared pool uses processes on every build, free-threaded ones included.

    • When a worker process of that pool ends during an ingest() (the out-of-memory killer, say), the files not yet returned are read again on fresh process pools. These pools have one worker while the file that ends a worker is found, then this many. See Architecture.

  • redact()’s pool. Its default is half the CPUs, capped at eight, never below one: max(1, min(cpu_count // 2, 8)). Each redaction worker holds a decoded frame, so that number is a memory ceiling, not a throughput choice. redact() reads this variable too. It treats a value below 1 the same way, and falls back to its own default.

This variable overrides both defaults, with the same floor. The below-1 warning also appears once when Session() opens, because the build of the shared pool reads the variable. It appears again once per ingest(), because each ingest() resolves the variable again.

ISOCENTER_CHUNKSIZE#

Default: 1.

Floor: 1. A value below 1, 0 or any negative, is not a batch size. Isocenter reports it with a warning that names the variable and the value, and uses the default of 1 instead. ISOCENTER_MAX_WORKERS and ISOCENTER_MAX_TASKS_PER_CHILD have the same floor.

The batch size for inter-process communication. A larger value (5 or 10, say) can improve performance for very small items.

The retry rounds ingest() runs after a worker process ends ignore this variable and send one file per task. A chunk is one task. So a death anywhere in a chunk loses every result in that chunk. Also, the file that ended the worker cannot be told from the other files in its chunk. The first round of each call uses the value set here, as every other parallel step does.

ISOCENTER_MAX_TASKS_PER_CHILD#

Default: Unlimited (workers are not recycled).

Floor: 1. A value below 1, 0 or any negative, is not a recycling interval. Isocenter reports it with a warning that names the variable and the value, and uses no recycling.

Restart worker processes after N tasks to release memory. This is useful if you suspect memory leaks in underlying libraries.

  • Setting it at all turns threads off for every call site it reaches. Only a process can be recycled. See Which levers win.

  • redact() on a :memory: store refuses it. That store’s redaction asks for threads, and this variable would override that request. Instead, redact() raises RuntimeError. The message names the store and this variable. It also says why processes cannot work for an in-memory database, and gives two remedies: unset the variable, or use a file-backed store. redact() raises before any work starts, so nothing has happened when the error arrives. except RedactionError does not catch the refusal. except RuntimeError does.

  • It cannot reach session.export() in either direction. An export always recycles each worker after 25 tasks, so neither raising nor lowering this changes what an export does.

  • Nor does it reach ingest(). ingest() runs on the session’s own process pool, which never recycles a worker. That pool is rebuilt when ISOCENTER_MAX_WORKERS changes, and never for this variable. Each ingest() that has files to read logs one WARNING. The warning says that the variable had no effect on that ingest() and that its result is unaffected. When ISOCENTER_FORCE_THREADS is also set, the warning is one line that names both variables. An ingest() with nothing new to read is silent.

ISOCENTER_DISABLE_GC#

Default: 0.

Set to 1 to disable garbage collection in worker processes. This can speed up processing significantly but increases memory usage.

ISOCENTER_FORCE_THREADS#

Default: 0.

Set to 1 to run in threads instead of processes. This is useful for debugging audit(), scan_pixel_content() and redact() in the calling process.

It reaches audit(), scan_pixel_content() and redact(). It reaches neither export() nor ingest(), for different reasons:

  • export() recycles each worker after 25 tasks, and therefore runs in processes on every interpreter, free-threaded builds included. Recycling reclaims memory that the imaging C libraries leak, and a thread pool has no process to recycle. A WARNING reports the ignored request.

  • ingest() runs on the session’s own process pool. The variable is ignored there, and each ingest() that dispatches work says so with one WARNING that names the variable. When worker recycling is also set, that warning is one line that names both variables. An ingest() with nothing new to read is silent.

discover_redaction_zones() asks for threads itself, so this variable changes nothing there. discover_redaction_zones() runs in processes only under ISOCENTER_MAX_TASKS_PER_CHILD, which outranks that request.

So export() and ingest() are the two paths you cannot step through with a debugger in the calling process.

ISOCENTER_FORCE_PROCESSES#

Default: 0.

Set to 1 to force processes instead of threads. It is the mirror of ISOCENTER_FORCE_THREADS, and it exists for the free-threaded default. On a free-threaded build (Python 3.14t), a parallel pass picks threads, because there is no GIL to escape and pickling every item across a pipe is pure cost. This variable pins processes anyway.

Except redact() on a :memory: store, which runs in threads on every interpreter, whatever this variable says. The redaction worker writes redacted frames back to the store, and a process cannot share an in-memory database. redact() says so with a WARNING that names this variable, once per redact() call. The pass is correct. The variable is the one thing about the pass that did not apply, and the variable still applies to every other parallel pass in the process.

Which levers win#

The three threads-or-processes levers have a fixed order:

  1. ISOCENTER_MAX_TASKS_PER_CHILD beats both force variables and always means processes (see ISOCENTER_MAX_TASKS_PER_CHILD).

  2. Then ISOCENTER_FORCE_THREADS, which wins when both force variables are set.

  3. Then ISOCENTER_FORCE_PROCESSES.

  4. Then the free-threaded default.

ISOCENTER_SHOW_PROGRESS#

Default: 1.

Set to 0 (or false, off, no) to disable every progress bar that the library draws:

  • the bars of the parallel passes (ingest, audit, pixel scan, redaction and export)

  • the bars of anonymize(), release_memory() (which every export() runs) and lock_identities()

This is useful for cleaner logs in CI/CD environments.

This variable can only switch a bar off. An explicit show_progress=False, where a call takes one, is honoured whatever this variable says. export(show_progress=False) silences the memory-release bar too.

ISOCENTER_REQUIRE_TEXT_DETECTOR#

Default: 0.

Read by Isocenter’s own test suite, never by the package. Set to 1 to make the real-model tests of burned_in_text: {detector: db} fail, rather than skip, when the text detector cannot run. The detector cannot run when the textdetect extra is not installed, or when the shipped model is not the pinned file. tests.yml sets it on every job that is not free-threaded. So a CI install that silently lost OpenCV is a red test, not a skip that reads as a pass (#44’s shape, #1121). The variable stays 0 on the free-threaded build, where OpenCV publishes no wheel and the detector cannot run.

ISOCENTER_REQUIRE_NLP_MODEL#

Default: 0.

Read by Isocenter’s own test suite, never by the package. The real-model tests of SCRUB target orgs and of burned_in_text target names are in tests/test_scrub_orgs_with_the_real_model.py. Set this variable to 1 to make those tests fail, rather than skip, when spaCy or en_core_web_sm cannot load.

On every job that is not free-threaded, tests.yml installs the nlp extra, installs a model with python -m spacy download en_core_web_sm, and sets this variable. That command installs whichever model spaCy picks for the installed spaCy. So a CI install that silently lost the model is a red test, not a skip that reads as a pass (#44’s shape, #1130). The model is deliberately not pinned (owner ruling of 2026-10-16), so those tests assert properties, not figures. The variable stays 0 on the free-threaded build, where spaCy and thinc publish no wheel. A contributor without the model sees those tests skip.

ISOCENTER_WORKER_FAULTHANDLER#

Default: 0.

Diagnostic. Set to 1 to have every worker process arm faulthandler.dump_traceback_later(240, exit=False) at start. A worker that is still alive after 240 seconds then dumps the traceback of every one of its threads to stderr, and keeps running. The parent’s faulthandler cannot see into children. So this is how a stall inside a pool child becomes a stack trace instead of a silent hang. With the variable set, a worker’s exit is also bounded. SIGALRM ends a worker whose exit is not finished 15 seconds after the exit began. So a dump that never finishes cannot hold its pool’s shutdown (#844). Leave it off in production runs.