SchemaBind
SchemaBind reduces repetitive dictionary lookup boilerplate by exposing existing fields as readable Python attributes.
Instead of:
first_name = row["first_name"]
email = row["email_address"]
phone = row.get("phone_number")
Use:
from schemabind import bind
customer = bind(row)
customer.first_name
customer.email_address
customer.phone_number
SchemaBind is currently focused on dictionaries, including rows produced by csv.DictReader.
It does not create schemas, validate data, transform values, or infer new fields. It simply provides a cleaner way to access fields that already exist.
Example
import csv
from schemabind import bind
with open("samples/csv/customer.csv") as f:
rows = list(csv.DictReader(f))
customer = bind(rows[0])
print(customer.first_name)
print(customer.email_address)
print(customer.phone_number)
Missing attributes raise AttributeError instead of silently returning None, which helps catch typos in field names.
Field Normalization
SchemaBind supports simple field-name normalization for attribute access.
For example:
customer = bind({"First Name": "Kaladin"})
print(customer.first_name)
The original dictionary keys are preserved for dictionary-style helpers:
customer.keys()
customer.get("First Name")
If multiple fields normalize to the same attribute name, SchemaBind raises ValueError instead of guessing which field to use.
For example:
bind({
"First Name": "Dalinar",
"first_name": "Shallan",
})
Both fields would normalize to first_name, so the binding is rejected as ambiguous.
Metadata
Release files for schemabind 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| schemabind-0.1.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| schemabind-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / schemabind-0.1.0.tar.gz
| Download URL | schemabind-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdff6a5ff22439fface8e6b09af82ccd8c54be298699e557d2873617734574a5
|
|
BLAKE2b-256 checksum How to use checksums |
f19e10e7cd512379d58f53f4baf931fc1de63b2492cc72f906cf33932607cf83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Release files / schemabind-0.1.0-py3-none-any.whl
| Download URL | schemabind-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7646e66244b51a0634e6ca07816dd59160d1d462a93dd4cd0dec1e440539fcfe
|
|
BLAKE2b-256 checksum How to use checksums |
70972b2c363a6f458d7116c8c80074e4442ce00695aac361c7eda3174809d1b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|