brunns-row
Convenience wrapper for DB API and csv.DictReader rows, and similar, inspired by Greg Stein's lovely dtuple module.
Installation
Install with pip:
pip install brunns-row
Or with uv:
uv add brunns-row
Usage
The basic approach is to create a wrapper object from some kind of description - typically a
DBAPI cursor's
description, or a
csv.DictReader's
fieldnames attribute - then to use the wrapper's
wrap(row) method to wrap each row. wrap(row) returns an object from which you can access the row's fields as
attributes. A couple of simple examples:
DB API
cursor = conn.cursor()
cursor.execute("SELECT kind, rating FROM sausages ORDER BY rating DESC;")
wrapper = RowWrapper(cursor.description)
rows = [wrapper.wrap(row) for row in cursor.fetchall()]
for row in rows:
print(row.kind, row.rating)
csv.DictReader
reader = csv.DictReader(csv_file)
wrapper = RowWrapper(reader.fieldnames)
rows = [wrapper.wrap(row) for row in reader]
for row in rows:
print(row.kind, row.rating)
Attributes names are simply the column names where possible, converted to valid identifiers where necessary by replacing invalid characters with "_"s, prefixing any leading numerics with "a_", and de-duplicating where necessary by adding numeric suffixes.
Development
This project uses uv for dependency management and development.
Setup
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and setup
git clone https://github.com/brunns/brunns-row.git
cd brunns-row
uv sync --all-extras
Common Commands
# Run tests
make test
# Run tests with coverage
make coverage
# Format code
make format
# Lint
make lint
# Type check
make typecheck
# Build docs
make docs
# Run all pre-commit checks
make precommit
For more options:
make help
Releasing
Releases are automated via GitHub Actions. To release version n.n.n:
- Update version in
pyproject.toml(usinguv version --bump major|minor|patch) anddocs/conf.py. - Run
make precommitto ensure all checks pass - Commit and tag:
version=`uv version --short` git pull -r git commit -am "Release v$version" git tag "v$version" git push origin master --tags
The GitHub Actions workflow will automatically:
- Run tests and coverage checks
- Build distribution packages
- Publish to PyPI (using OIDC trusted publishing)
- Create a GitHub release with auto-generated notes
Metadata
Release files for brunns-row 2.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| brunns_row-2.3.1.tar.gz | 72.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| brunns_row-2.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.7 kB
Release files / brunns_row-2.3.1.tar.gz
| Download URL | brunns_row-2.3.1.tar.gz |
|---|---|
| Size | 72.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53f1999e3b4712fa6600d1c5078edb5422ea2f0c2840428529e335882c9e0cf7
|
|
BLAKE2b-256 checksum How to use checksums |
694c0d43ad7a88404dec39fd22051bd62015f6aae59aafe245e493683078cd1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency logRelease files / brunns_row-2.3.1-py3-none-any.whl
| Download URL | brunns_row-2.3.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2ee3f4b0095aa31113003651a939342d1413c9f0899ea751747197f66a79fe8
|
|
BLAKE2b-256 checksum How to use checksums |
e833c20da1f4845aed8462c343ed808964a3cc5ab8be5e784128aa3d4376b596
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency log