Skip to main content

DefPixel

Define your data connections, models, and access in Python.

Define your pixels.
Shape your voxels.

DefPixel is a Python library for defining data source connections, models, and access. Use a provided data access implementation or build your own, and work with data directly or through standard dataclasses.

Connect · model · use

  • Define connections: storage-specific configuration and data access capabilities.
  • Define models: storage specifications and validation rules attached to standard dataclasses.
  • Use your data: direct access without models, or storage and retrieval through models.

Configuration and Connection provide connection foundations. Database, KeyValue, Document, and Index Protocols describe capabilities. Modeling approaches and support vary by implementation. Validators also provide independent value validation and conversion.

Requirements and installation

Python 3.9+ is required.

pip install DefPixel

Usage at a glance

Database

SQLite

Execute SQL directly for dictionary results or map standard dataclasses to tables and retrieve objects. This complete example requires SQLite 3.35+ as used by Python.

from dataclasses import dataclass
from DefPixel.DataAccessObject.Implements.Sqlite import (
  Configuration, Connection, column, table,
)
from DefPixel.DataAccessObject.Implements.Sqlite.Constraints import PrimaryKey
from DefPixel.DataAccessObject.Implements.Sqlite.Executors import Create, Insert, Select
from DefPixel.DataAccessObject.Implements.Sqlite.Types import Integer, Text


@table(name='users', constraints=(PrimaryKey('id'),))
@dataclass
class User:
  id: int = column(Integer())
  name: str = column(Text())


connection = Connection(Configuration(':memory:'))
connection.connect()
try:
  with connection.session() as session:
    session.run(Create(User))
    session.run(Insert(User).values(id=1, name='Alice'))

    rows = session.execute(
      'SELECT id, name FROM users WHERE id = ?', 1,
    ).rows()
    print(rows)

    users = session.run(Select(User), fetch=User)
    print(users)
finally:
  connection.close()

Output:

[{'id': 1, 'name': 'Alice'}]
[User(id=1, name='Alice')]

Sessions commit on normal completion and roll back on exceptions. Direct SQL does not require models. Models remain ordinary Python objects; attribute assignment does not automatically persist changes. No custom Model base class or Service/Repository/DTO structure is required.

Supported implementations

  • SQLite: direct SQL, dataclass mappings, CRUD, tables, views, constraints, indexes, joins, aggregates, and transactions. SQLite modeling requires SQLite 3.35+.

Build your own

Implement the capability Protocols for the store you need, without inheriting a provided implementation or adapting every store to SQL.

The source repository includes step-by-step implementation development guides and a SQLite user manual.

Metadata

Release files for DefPixel 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DefPixel 0.1.0
File Size Uploaded Provenance Actions
defpixel-0.1.0.tar.gz 118.2 kB Without provenance Details for defpixel-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for DefPixel 0.1.0
File Actions
defpixel-0.1.0-58-py3-none-any.whl Python 3 none any Details for defpixel-0.1.0-58-py3-none-any.whl
defpixel-0.1.0-40-py3-none-any.whl Python 3 none any Details for defpixel-0.1.0-40-py3-none-any.whl
defpixel-0.1.0-37-py3-none-any.whl Python 3 none any Details for defpixel-0.1.0-37-py3-none-any.whl
defpixel-0.1.0-4-py3-none-any.whl Python 3 none any Details for defpixel-0.1.0-4-py3-none-any.whl
defpixel-0.1.0-3-py3-none-any.whl Python 3 none any Details for defpixel-0.1.0-3-py3-none-any.whl

Total release size: 439.0 kB

Release files / defpixel-0.1.0.tar.gz

Download URL defpixel-0.1.0.tar.gz
Size 118.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2f0f4f1e14acbded842a67918b0c5e769ddb2a64433bce301b04419d93e1156a
BLAKE2b-256 checksum
How to use checksums
4e45450e88e412c87202569b3f91659e7669766f12c7e70796d287020216be74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / defpixel-0.1.0-58-py3-none-any.whl

Download URL defpixel-0.1.0-58-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
806a15ccd860e5edcdddd1601402b712bb755dca2fb3072b2c840bf694a4ecfb
BLAKE2b-256 checksum
How to use checksums
3b469ced40dfff73fe97f258a9c21b3a2a632984aa3db2d64f774447ee4f75e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / defpixel-0.1.0-40-py3-none-any.whl

Download URL defpixel-0.1.0-40-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7250b49f3a3cf01d2564b4cbd01632eba33fcf0616592bfc5bb7b7212c4d0826
BLAKE2b-256 checksum
How to use checksums
86b042d89369a9859e22ecafa1033c50dbcf08296ad91ce5185e89b79e0d2fa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / defpixel-0.1.0-37-py3-none-any.whl

Download URL defpixel-0.1.0-37-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b5c0f259d79d25e3f7bb7fb29f1f29fa4ea37074bc4e49ede9bb075ae07c80a
BLAKE2b-256 checksum
How to use checksums
8084acdd6d3a05d0a576f2371e7d900d7d50951a253d759c7e89ee6fa59bb90e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / defpixel-0.1.0-4-py3-none-any.whl

Download URL defpixel-0.1.0-4-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8242cbae564e6e9259b0951ce2ba8b3b891d3b511c567c642994ec335f813fd0
BLAKE2b-256 checksum
How to use checksums
7408e991f1be3e5dba2c6a25e93d8354179f4cd2e95ebe00f88806eb9204d869
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / defpixel-0.1.0-3-py3-none-any.whl

Download URL defpixel-0.1.0-3-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a1cf9e94947c7260cdfe0622b807311398c7cc33c6ccbe053955ad19dc8d108
BLAKE2b-256 checksum
How to use checksums
509530729a4b1a9d8fb04278f8030a9e7d08dcee60fe8ad869fe45d71b161941
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for DefPixel 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page