Developer Tools

vwarnings

Warnings you can filter, show once, silence or make fatal.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/warnings.ven"

A minimal warn and filter API, distinct from structured logging: a warning is a conditional signal about something that might be wrong, not an unconditional record of what happened, built on Venutian's own map, shape and print builtins. A warning can be filtered by category, so a program can quiet the ones it has already accounted for.

vwarnings.ven
st = warnings_state()
print st.filters
:: prints: {}
Reference (5 functions)

API reference

warnings_state()

Builds a fresh WarningState with no filters set.

st = warnings_state()
print st.filters
:: prints: {}

filterwarnings(state, action, category)

Sets the action for one category on state.

st = warnings_state()
filterwarnings(st, "once", "DeprecationWarning")
issue_warning(st, "low disk space", "DeprecationWarning")
issue_warning(st, "low disk space", "DeprecationWarning")
:: prints: DeprecationWarning: low disk space

simplefilter(state, action)

Sets action as the action for every category at once on state.

st = warnings_state()
simplefilter(st, "ignore")
issue_warning(st, "noisy", "AnyCategory")
print "done"
:: prints: done

resetwarnings(state)

Clears every filter and "seen once" record on state.

st = warnings_state()
simplefilter(st, "ignore")
resetwarnings(st)
issue_warning(st, "back to default", "UserWarning")
:: prints: UserWarning: back to default

issue_warning(state, message, category)

Issues a warning against state, honoring its filter for category.

st = warnings_state()
issue_warning(st, "deprecated argument 'x'", "DeprecationWarning")
:: prints: DeprecationWarning: deprecated argument 'x'

Get notified when vwarnings changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.