Skip to main content

handrolled

Hand-rolled, stdlib-only replacements for things you would normally pip install.

Every module here exists for the same reason: the obvious solution adds a dependency, and the dependency is bigger than the problem.

pip install handrolled        # installs nothing else

Python ≥ 3.10, no runtime dependencies. import handrolled never touches third-party code — the optional pieces import inside functions and return None when their dependency is missing.

What's in it

Module Instead of What it actually does
handrolled.text jieba, a query builder, PyYAML CJK bigram expansion for SQLite FTS5, FTS5 match-expression building (quotes and neutralises user input), and a YAML-subset front matter reader
handrolled.webdav requests + webdavclient3 WebDAV over the RFC 4918 subset that gets used: PROPFIND, GET, PUT, MKCOL, DELETE; Basic auth, mTLS, and connect-host/SNI separation for appliances whose certificate CN is not their address
handrolled.mounts parsing mount output Network mount inspection that reports the real filesystem rather than its autofs trigger, rw/ro state, and ESTALE/EACCES/ENOENT turned into sentences a human can act on
handrolled.pages + handrolled.importers hand-written one-off scripts Turn another tool's export into Markdown pages: mem0, Obsidian, Notion's Markdown export, basic-memory, plain JSON/JSONL, and a neutral records/v1 format. Deterministic, additive, guarded
handrolled.rerank sentence-transformers Cross-encoder reranking of (query, passage) pairs from an int8 ONNX model, with idle unloading so the memory comes back
handrolled.deeprank an SDK per vendor Let a remote chat model pick which candidate pages answer a query; any failure degrades to the original order
handrolled.embed_onnx sentence-transformers ONNX embedding backend (last-token pooling, L2 normalised), kept for A/B work

Design rules

  1. Standard library only. If a module cannot be written with the stdlib and a documented protocol, it does not belong here.
  2. Optional means optional. Anything needing a model or an extra package imports lazily and returns None/False when it is absent. Nothing raises at import time, and nothing silently changes behaviour because a package happens to be installed.
  3. No machine assumptions. Optional layers have no built-in paths: unset environment variable means the layer is off. Nothing guesses where your models or credentials live.
  4. Deterministic output. handrolled.pages renders the same records to the same bytes, so a second run is a no-op and a diff means something.

Quick example

from handrolled import importers
from handrolled.pages import plan, apply

records = importers.load("obsidian", "/path/to/vault")
planned = plan(policy, records, prefix="notes", zone="private")
print(f"{planned.items} records → {len(planned.pages)} pages")
apply(source, planned, write=True)

policy is any object with zones (things with a .name) and is_never(rel) -> bool — the caller owns the privacy model, not this library.

Where this comes from

Extracted from dsh-kb, a personal knowledge base built to be queried cheaply by AI agents. Those modules were written there, hardened against a real deployment, and turned out to have nothing to do with knowledge bases in particular.

Tests

PYTHONPATH=src python3 -m unittest discover -s tests -t .

Offline, dependency-free, no fixtures to download.

License

MIT — see LICENSE.

Metadata

Release files for handrolled 0.1.1

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

Source distribution (sdist)

Source distribution for handrolled 0.1.1
File Size Uploaded Provenance Actions
handrolled-0.1.1.tar.gz 44.2 kB Without provenance Details for handrolled-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for handrolled 0.1.1
File Interpreter ABI Platform Actions
handrolled-0.1.1-py3-none-any.whl Python 3 none any Details for handrolled-0.1.1-py3-none-any.whl

Total release size: 83.9 kB

Release files / handrolled-0.1.1.tar.gz

Download URL handrolled-0.1.1.tar.gz
Size 44.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ab2fb9be78b2266a8acb3b40a84a3ef67075d4d223c649719a7a7172cc2ec6a1
BLAKE2b-256 checksum
How to use checksums
7ad36291aefebddb48c24dbf4d0a28bed69fe181474712a48bca314ad8d61eec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / handrolled-0.1.1-py3-none-any.whl

Download URL handrolled-0.1.1-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4cebaf0913840810ddcccd4c8f465d35496df1e7489c27c44602e3de6927288
BLAKE2b-256 checksum
How to use checksums
a8d2d5977f54179cf1af18022557c23a69d84172313d532e0256b0db80b2b217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for handrolled 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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