Skip to content

myfjin/aura-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AURA Patterns

A curated library of production-grade Python patterns — every one verified to actually run.

18 complete, self-contained implementations of the patterns that show up again and again in real distributed systems and infrastructure: rate limiters, circuit breakers, write-ahead logs, gossip protocols, two-phase commit, authorization engines, and more. No fluff, no half-finished snippets — each file executes, and every one is pure standard library.

How this was built (honest version): these patterns were generated with a local large language model (Qwen, running on my own hardware — no cloud API), then filtered hard: every file is executed by a run-gate, and only the ones that actually run — cleanly, on the standard library alone — make it in. The broken, the trivial, the truncated, and the dependency-heavy are cut. What's left is the signal. The curation is the work.


Why this exists

Most "code pattern" collections are either toy snippets or AI-generated walls of text that don't run. This one is the opposite: a small, ruthlessly filtered set where the only entry requirement is that it works. If a file is here, it passed execution — exit 0, real output, no traceback, no third-party imports.

  • 18 complete systems, organized by domain
  • 23 reusable components indexed (the substantial classes inside the systems)
  • Verified — every file runs, and runs on the standard library alone (zero pip install)
  • MIT licensed — use them, ship them, no strings

The patterns

Every pattern below is stdlib-only (Python 3.10+) and runs directly.

distributed

Pattern What it does
gossip_protocol Gossip protocol for distributed membership
two_phase_commit Two-phase commit coordinator
leader_follower_replication Leader-follower replication protocol

async

Pattern What it does
pubsub_message_bus Pub/sub message bus with topic filtering
async_worker_pool Async worker pool, priority + graceful shutdown

networking

Pattern What it does
token_bucket_rate_limiter Token-bucket rate limiter
sliding_window_rate_limiter Sliding-window rate limiter (exact counts)

resilience

Pattern What it does
circuit_breaker Circuit breaker with half-open state

monitoring

Pattern What it does
metrics_exporter Metrics exporter (counters/gauges/histograms)

persistence

Pattern What it does
write_ahead_log Write-ahead log (WAL) for atomic transactions

data_structures

Pattern What it does
lru_cache_ttl Thread-safe LRU cache with TTL expiration

io

Pattern What it does
atomic_file_write Atomic file write — write-then-rename, never a half-written file
safe_tree_walker Filtered directory walker — by size / extension / age
file_deduplicator Find (and optionally remove) duplicate files by content hash
folder_organizer Rule-based folder organizer — sort files by type / date
bulk_renamer Bulk file renamer — regex or numbered templates, safely

security

Pattern What it does
authorization_engine Authorization engine (RBAC + ABAC)

architecture

Pattern What it does
resource_quota_manager Resource quota manager with burst allocation

Usage

Every pattern is stdlib-only (Python 3.10+) — clone and run, nothing to install:

python patterns/resilience/circuit_breaker.py

Verification

Every file in this repo was executed before inclusion by a run-gate: exit 0, real output, no traceback, and no third-party imports. The filter is simple and unforgiving — if it doesn't run on the standard library, it's not here. See COMPONENTS.md for the reusable classes inside each system.

License

MIT © 2026 Illia Hladkyi

About

Curated, verified production-grade Python patterns — every file runs. 18 systems + 23 components. MIT.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages