How nshaibu/formax works
Formax is a Python model-building and validation library. A developer declares a BaseModel schema; class construction prepares configured fields and hooks, then model initialization applies formatting and validation before storing values or raising errors. Models can also encode and decode dict, JSON, and CSV data through registered formatters. The graph reflects the README’s documented features; unsampled runtime modules are included only where their paths and responsibilities are clear from the tree.
Main entry points: base.py BaseModel · fields.py Field descriptors · make_init.py Init strategies · formatters.py Formatters
Components 15
Schema construction
- BaseModel
src/formax/base.py - Model configuration
src/formax/typing.py - Field metadata
src/formax/typing.py - Hook decorators
src/formax/decorators.py
Model runtime
- Init strategies
src/formax/make_init.py - Field descriptors
src/formax/fields.py - Optimized setters
src/formax/optimised_funcs.py
Validation and typing
- Type resolution
src/formax/typing.py - Type and constraints
src/formax/fields.py - Custom callbacks
src/formax/base.py
Formatting and errors
- Validation errors
src/formax/exceptions.py - Error processing
src/formax/utils.py - Formatters
src/formax/formatters.py
Other components
- Developer
- Model or data
Connections 17
- Developer → BaseModel: declares schema
- BaseModel → Model configuration: reads config
- BaseModel → Field metadata: prepares fields
- BaseModel → Hook decorators: collects hooks
- BaseModel → Init strategies: selects initializer
- BaseModel → Field descriptors: installs descriptors
- BaseModel → Type resolution: resolves annotations
- Init strategies → Field descriptors: initializes fields
- Init strategies → Optimized setters: uses optimized functions
- Field descriptors → Type and constraints: validates values
- Field descriptors → Custom callbacks: runs field hooks
- Field descriptors → Error processing: processes failures
- Error processing → Validation errors: collects or raises
- Field descriptors → Model or data: stores field values
- Developer → Formatters: requests conversion
- Formatters → Field descriptors: coerces input
- Formatters → Model or data: encodes or decodes