Skip to content


General helpers required for tqdm.std.


[view source]

def envwrap(prefix, types=None, is_method=False)

Override parameter defaults via os.environ[prefix + param_name]. Maps UPPER_CASE env vars map to lower_case param names. camelCase isn't supported (because Windows ignores case).

Precedence (highest first):

  • call (foo(a=3))
  • environ (FOO_A=2)
  • signature (def foo(a=1))


  • prefix: str
    Env var prefix, e.g. "FOO_"
  • types: dict, optional
    Fallback mappings {'param_name': type, ...} if types cannot be inferred from function signature. Consider using types=collections.defaultdict(lambda: ast.literal_eval).
  • is_method: bool, optional
    Whether to use functools.partialmethod. If (default: False) use functools.partial.


$ cat
from tqdm.utils import envwrap
def test(a=1, b=2, c=3):
    print(f"received: a={a}, b={b}, c={c}")

$ FOO_A=42 FOO_C=1337 python -c 'import foo; foo.test(c=99)'
received: a=42, b=2, c=99

CallbackIOWrapper Objects#

[view source]

class CallbackIOWrapper(ObjectWrapper)


[view source]

def disp_len(data)

Returns the real on-screen length of a string which may contain ANSI control codes and wide chars.


[view source]

def disp_trim(data, length)

Trim a string which may contain ANSI control characters.