PYPI PACKAGE AUDIT v0.17.4 Needs Improvement

velocity-python

A rapid application development library for interfacing with data storage

PyPkgScore velocity-python
Methodology & Criteria โ™ฅ Donate
505 / 1000
Quick Install
pip install velocity-python
1. Governance
50/200
2. PEP Metadata
200/200
3. Security
100/200
4. Docs & SEO
155/200
5. CI Engineering
0/200
๐Ÿ“ฃ Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
1482
Last 30 days
11318
Total (180 days)
30864
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) โ€” PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) โœ• Not detected PyPI Integrity / Sigstore
Django Packages โ€” djangopackages.org
PyTech / PyPkgScore 505 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community50 / 200 โ–พ
LICENSEโœ“ 50 pts
SECURITY.mdโœ• 0 pts
CONTRIBUTING.mdโœ• 0 pts
CODE_OF_CONDUCT.mdโœ• 0 pts
2. PEP Metadata & Packaging200 / 200 โ–พ
Wheel (.whl)โœ“ 50 pts
pyproject.tomlโœ“ 50 pts
Project URLsโœ“ 50 pts
Trove Classifiersโœ“ 50 pts
3. Security & Supply Chain100 / 200 โ–พ
Zero CVEs (OSV)โœ“ 60 pts
Trusted Publishing (OIDC)โœ• 0 pts
Snyk / Audit Linkโœ“ 40 pts
HTTPS Repositoryโœ• 0 pts
4. Documentation, SEO & Ecosystem155 / 200 โ–พ
Structured READMEโœ“ 60 pts
Read the Docsโœ“ 50 pts
Django Packagesโœ• 0 pts
Website / Technical Articlesโœ“ 45 pts
5. Engineering, CI & Quality0 / 200 โ–พ
Automated Testsโœ• 0 pts
GitHub Actions CIโœ• 0 pts
CHANGELOG.mdโœ• 0 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)โœ• 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide โ€” velocity-python

PyPI Metadata v0.17.4
Show full original documentation (English README) โ–พ

Velocity-Python

A rapid application development library for Python that eliminates boilerplate between your code and your database. Write business logic, not SQL plumbing.

@engine.transaction
def create_order(tx, customer_email, items):
    customer = tx.table("customers").find({"email": customer_email})
    order = tx.table("orders").insert({
        "customer_id": customer["sys_id"],
        "status": "pending",
        "total": sum(i["price"] for i in items),
    })
    tx.table("order_items").insert_many([
        {"order_id": order["sys_id"], "product": i["name"], "price": i["price"]}
        for i in items
    ])
    return order

No connection management, no cursor juggling, no commit/rollback boilerplate. Velocity handles it all.

Python 3.9+ License: MIT


Why Velocity?

Most Python database libraries fall into two camps:

  1. Heavy ORMs (SQLAlchemy, Django ORM) โ€” powerful but complex. You write Python classes that map to tables, manage sessions, deal with migration frameworks, and learn a large API surface before writing your first query.

  2. Raw drivers (psycopg, sqlite3) โ€” full control, but you're writing SQL strings, managing connections, handling cursors, serializing parameters, and building your own transaction/error-handling patterns from scratch.

Velocity occupies the middle ground: a thin, opinionated layer that gives you the convenience of an ORM with the transparency of raw SQL. Tables are just names. Rows are just dicts. Transactions are just context managers. You don't define models โ€” Velocity discovers your schema at runtime and adapts to it.

Design Principles

Principle What It Means
Convention over configuration Sensible defaults everywhere. Override only what you need.
Dicts in, dicts out No custom model classes to learn. Rows are dictionaries.
Transaction-scoped Every operation runs inside an explicit transaction. No surprise autocommit.
Auto-schema Tables and columns are created on the fly in development. Locked down in production.
Driver-agnostic PostgreSQL (primary), MySQL, SQLite โ€” same API surface. SQL Server as a read-only source (tx.execute).
Lambda-native Connection pooling, warm-start reuse, and SQS batch handling built in.

Installation

# Core (no database driver โ€” useful for testing or SQLite)
pip install velocity-python

# PostgreSQL (recommended)
pip install velocity-python[postgres]

# With AWS Lambda support
pip install velocity-python[postgres,aws]

# Everything
pip install velocity-python[all]

Available Extras

Extra Packages Use Case
postgres psycopg[binary]>=3.2.0 PostgreSQL connections
aws boto3, requests Lambda handlers, SQS, Amplify
excel openpyxl Excel export
parquet pyarrow Parquet export
ods odfpy OpenDocument spreadsheet export
templates jinja2 Template rendering
pdf weasyprint HTML โ†’ PDF rendering (native Pango/Cairo from the OS or a layer)
http requests HTTP utilities
payment stripe, braintree Stripe and Braintree adapters
mysql mysql-connector-python MySQL connections
sqlserver python-tds SQL Server connections
redis, mongodb, elasticsearch, cassandra, couchbase the matching client NoSQL adapters (docs/nosql.md)
all postgres, aws, excel, templates, http, payment, pdf Typical full install

Requires Python 3.9+ and uses psycopg v3 (not psycopg2) for PostgreSQL.


Quick Start

1. Connect

from velocity.db.servers.postgres import initialize

# From environment variables (DBHost, DBDatabase, DBUser, DBPassword)
engine = initialize()

# Or explicit config
engine = initialize(config={
    "host": "localhost",
    "dbname": "myapp",
    "user": "postgres",
    "password": "secret",
})

2. Use Transactions

# As a decorator (recommended for Lambda handlers)
@engine.transaction
def get_active_users(tx):
    return tx.table("users").select(where={"active": True}).all()

# As a context manager
with engine.transaction() as tx:
    tx.table("users").insert({"name": "Alice", "email": "[email protected]"})

3. CRUD Operations

@engine.transaction
def demo(tx):
    users = tx.table("users")

    # Insert
    row = users.insert({"name": "Bob", "email": "[email protected]"})

    # Read
    user = users.row(row["sys_id"])                    # by primary key
    user = users.find({"email": "[email protected]"})    # by lookup

    # Update
    user["name"] = "Robert"                            # immediate write-through

    # Delete
    users.delete({"sys_id": row["sys_id"]})

4. Bulk Operations

@engine.transaction
def import_customers(tx, records):
    tx.table("customers").insert_many(records)              # multi-row INSERT
    tx.table("customers").upsert_many(records, pk="email")  # INSERT ... ON CONFLICT UPDATE

Documentation

Full documentation is included in the docs/ directory of the source distribution. What changed in each release, and what callers must do before upgrading, is in CHANGELOG.md (Breaking / Deploy ordering / Added / Fixed per version).

Guide File Description
Database ORM docs/database.md Connections, DB_TUNNEL, transactions, tables, rows, results, queries, purge, schema management
Schema Management docs/schema-management.md Runtime auto-heal, declarative ensure_schema(), schema locking, conflict handling
Performance & Optimization docs/performance.md Connection pooling, batch operations, query caching, prepared statements, N+1 prevention, observability
Configuration Reference docs/configuration.md Every environment variable and SSM config key velocity reads, ssm_config, S3 buckets, engine options
AWS Lambda Handlers docs/aws-handlers.md LambdaHandler, SqsHandler, auth modes, per-record transactions, DataService client boundary, async jobs (JobHandler + job result stores), failure events
AWS Auth Modes docs/AWS_HANDLERS_AUTH.md Cognito auth, public endpoints, webhooks
Deployment docs/deploy.md velocity.aws.deploy: least-privilege IAM, function settings, layers, SQS queue reconcile
Cross-database Mirroring docs/mirroring.md Keep a table identical in two databases (demo โ†” production) by natural key; rwx hooks, FK translation, reconcile
Operations Dashboard docs/operations.md What the automation is doing: schedules, jobs, failures, stuck work, with drill-down (velocity.aws.ops + velocity-react OpsDashboard)
NoSQL Adapters docs/nosql.md Redis, DynamoDB, MongoDB, Elasticsearch, Cassandra, Couchbase behind one capability-honest contract
Payment Processing docs/payment.md Stripe and Braintree adapters, processor mirrors, payment lifecycle
Utilities docs/utilities.md Excel/PDF export, data conversion, formatting, timers, email parsing and SMTP sending
Testing Guide docs/TESTING.md Running tests, markers, coverage
Security docs/SECURITY.md Pre-commit hooks, credential scanning
Changelog CHANGELOG.md Per-release breaking changes, deploy ordering, additions and fixes

Architecture

Engine (singleton โ€” survives Lambda warm starts)
โ”œโ”€โ”€ ConnectionPool (thread-safe, configurable min/max)
โ””โ”€โ”€ Transaction (one per request, borrows from pool)
     โ”œโ”€โ”€ Table (CRUD, batch ops, schema management)
     โ”‚    โ”œโ”€โ”€ Row (dict-like, lazy-cache, write-through, batch_update())
     โ”‚    โ””โ”€โ”€ Result (streaming cursor iteration, transforms)
     โ”œโ”€โ”€ View (create, grant, ensure)
     โ””โ”€โ”€ Sequence (create, next, current, configure)

Transactions auto-commit on success, auto-rollback on exception. Connections are returned to the pool (or discarded on error). The Engine persists across Lambda invocations, so the pool stays warm.


Multi-Database Support

Database Driver Status
PostgreSQL psycopg[binary]>=3.2.0 Primary, fully tested
MySQL mysql-connector-python Supported
SQLite sqlite3 (stdlib) Supported
SQL Server python-tds Read-only source: tx.execute(...) only (tx.table raises NotImplementedError); TLS required by default (encrypt)
# PostgreSQL
from velocity.db.servers.postgres import initialize
engine = initialize()

# MySQL
from velocity.db.servers.mysql import initialize
engine = initialize()

# SQLite
from velocity.db.servers.sqlite import initialize
engine = initialize(config={"database": "myapp.db"})

# SQL Server (read-only source: raw tx.execute only; encrypt="require" by default)
from velocity.db.servers.sqlserver import initialize
engine = initialize()

Project Structure

velocity-python/
โ”œโ”€โ”€ src/velocity/
โ”‚   โ”œโ”€โ”€ cache.py                  # Process-level read cache (cache_ttl / memo)
โ”‚   โ”œโ”€โ”€ logging.py                # Logging setup (JSON in Lambda, text elsewhere)
โ”‚   โ”œโ”€โ”€ db/
โ”‚   โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ engine.py         # Engine, ConnectionPool, @engine.transaction
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ lazy_engine.py    # LazyEngine (build on first use)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ transaction.py    # Transaction, query timing, caching, on_commit
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ table.py          # Table CRUD, batch ops, purge, schema
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ row.py            # Row (dict-like, write-through, batch_update())
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ result.py         # Result (cursor wrapper, transforms)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ column.py         # Column helpers
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ database.py       # Database-level operations
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ jsonproxy.py      # Live list/dict values for JSON columns
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ view.py           # View management
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ sequence.py       # Sequence management
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ decorators.py     # @create_missing, @return_default, retries
โ”‚   โ”‚   โ”œโ”€โ”€ servers/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ postgres/         # PostgreSQL dialect + initializer (primary)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ mysql/            # MySQL dialect
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ sqlite/           # SQLite dialect
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ sqlserver/        # SQL Server dialect
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ tablehelper.py    # Where/column/pointer-join compiler
โ”‚   โ”‚   โ”œโ”€โ”€ fragments.py          # Literal / @@ token handling
โ”‚   โ”‚   โ”œโ”€โ”€ maintenance.py        # DatabaseMaintenance (clone, snapshot, prune)
โ”‚   โ”‚   โ”œโ”€โ”€ migrations.py         # `velocity` CLI: migration runner
โ”‚   โ”‚   โ”œโ”€โ”€ tunnel.py             # DB_TUNNEL support
โ”‚   โ”‚   โ””โ”€โ”€ exceptions.py         # Db* exception hierarchy
โ”‚   โ”œโ”€โ”€ aws/
โ”‚   โ”‚   โ”œโ”€โ”€ handlers/             # LambdaHandler, SqsHandler, context, mixins
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ mixins/           # DataService, client-input guard, jobs, sessions, web
โ”‚   โ”‚   โ”œโ”€โ”€ capabilities/         # Per-site capability registry and provisioning
โ”‚   โ”‚   โ”œโ”€โ”€ assets/               # Asset store: indexing, references, usage
โ”‚   โ”‚   โ”œโ”€โ”€ deploy/               # Platform-neutral deployment engine
โ”‚   โ”‚   โ”œโ”€โ”€ ssm_config.py         # SSM-backed config (project, then /Global)
โ”‚   โ”‚   โ”œโ”€โ”€ s3.py                 # Presigned URLs, configured buckets
โ”‚   โ”‚   โ”œโ”€โ”€ failures.py           # Failure events (SNS)
โ”‚   โ”‚   โ”œโ”€โ”€ feature_flags.py      # sys_feature_flags cache + mirror
โ”‚   โ”‚   โ”œโ”€โ”€ mirror.py             # Cross-database table mirroring
โ”‚   โ”‚   โ”œโ”€โ”€ job_lifecycle.py      # Job status tracking
โ”‚   โ”‚   โ”œโ”€โ”€ job_results.py        # Job result stores
โ”‚   โ”‚   โ”œโ”€โ”€ dirty_pipeline.py     # sys_dirty / on_dirty pipeline
โ”‚   โ”‚   โ”œโ”€โ”€ ops.py                # Operations dashboard data
โ”‚   โ”‚   โ”œโ”€โ”€ email.py / sms.py     # SES email, SMS
โ”‚   โ”‚   โ””โ”€โ”€ amplify.py, amplify_build.py, blobs.py, facets.py
โ”‚   โ”œโ”€โ”€ nosql/                    # NoSQL store contract + adapters
โ”‚   โ”œโ”€โ”€ payment/
โ”‚   โ”‚   โ”œโ”€โ”€ base_adapter.py       # Abstract payment interface
โ”‚   โ”‚   โ”œโ”€โ”€ stripe_adapter.py     # Stripe
โ”‚   โ”‚   โ”œโ”€โ”€ braintree_adapter.py  # Braintree
โ”‚   โ”‚   โ”œโ”€โ”€ *_mirror.py           # Processor mirror tables
โ”‚   โ”‚   โ””โ”€โ”€ money.py, charge_rules.py, redact.py
โ”‚   โ””โ”€โ”€ misc/                     # conv (iconv/oconv), export, format, mail, pdf, timer, ...
โ”œโ”€โ”€ tests/                        # Unit tests (make test-unit)
โ”œโ”€โ”€ docs/                         # Detailed documentation
โ””โ”€โ”€ pyproject.toml

Development

# Install with dev dependencies
pip install -e ".[dev,test,postgres]"

# Run the unit suite (no database needed)
make test-unit

# Or directly
pytest

# Run with coverage
pytest --cov=velocity --cov-report=html

# Run specific test file
pytest tests/test_connection_pool.py -v

License

MIT