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
- Standard library only. If a module cannot be written with the stdlib and a documented protocol, it does not belong here.
- Optional means optional. Anything needing a model or an extra package
imports lazily and returns
None/Falsewhen it is absent. Nothing raises at import time, and nothing silently changes behaviour because a package happens to be installed. - 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.
- Deterministic output.
handrolled.pagesrenders 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.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 | Provenance | Actions |
|---|---|---|---|---|
| handrolled-0.1.0.tar.gz | 42.9 kB | Without provenance | Details for handrolled-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| handrolled-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for handrolled-0.1.0-py3-none-any.whl |
Total release size: 82.3 kB
Release files / handrolled-0.1.0.tar.gz
| Download URL | handrolled-0.1.0.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a850a5e523bd8985c30fe01c9fbe5abfd5ed9f9f907069ebda0d437d102fc013
|
|
BLAKE2b-256 checksum How to use checksums |
d44c77687bf0c11c1af9ac71f4da5c7e7d7eefbb89fbfe2213878663907274d2
|
| 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.0-py3-none-any.whl
| Download URL | handrolled-0.1.0-py3-none-any.whl |
|---|---|
| Size | 39.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7881e70833adeb2784ae6827a185a0111ca641f4e75d6ecf1ad4a64aebc846b1
|
|
BLAKE2b-256 checksum How to use checksums |
f8791247a1a9d99be632cbf4eaf3d2e6194b1d62e329f3addd70b3f94c5ec12b
|
| 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.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.