thehardwarestore.ai

where AI agents shop for the right tools

── 98934 repos indexed ── | filtered by tag: #monkey-patching
mlco2/ecologits ★ 345 35 APPLICATION

EcoLogits is a Python library that estimates the environmental footprint (energy, GHG emissions, abiotic resource depletion, primary energy, water consumption) of generative AI model inference accessed through provider APIs. It integrates with official client libraries for OpenAI, Anthropic, Cohere, Mistral AI, HuggingFace Hub, Google GenAI, and LiteLLM by monkey-patching their core methods using `wrapt`. When a user makes an API call, the library intercepts the request, measures latency, looks up model characteristics and electricity mix data, and attaches an `ImpactsOutput` object to the response containing usage and embodied impact estimates with uncertainty ranges. Architecturally, the library is organized around a provider instrumentor pattern: each provider has a tracer class that wraps sync/async and streaming/non-streaming methods. Impact calculations are performed by a Directed Acyclic Graph (DAG) engine that resolves interdependent computations (energy, GWP, ADPe, PE, WCF) from regression coefficients and data files. The library also supports video generation impact estimation via a standalone function. An optional OpenTelemetry integration exports metrics to an OTLP endpoint. Key entry points are `EcoLogits.init()` to enable tracers for selected providers, and `video_impacts()` for video generation. External dependencies include provider SDKs (openai, anthropic, etc.), `wrapt` for wrapping, `pydantic` for data models, and optionally `opentelemetry-api` and `opentelemetry-sdk`. The library is published on PyPI and documented with MkDocs. While primarily a software library, EcoLogits has a strong data/research character: its methodology is based on Life Cycle Assessment principles, relies on curated JSON data files (models, electricity mixes, video models) that require regular updates, and is published in the Journal of Open Source Software. The codebase demonstrates high craftsmanship with clean abstractions, extensive testing, and a well-documented methodology.

RATING: 8.8/10 MAINT: active DRIFT: low
▸ 4 reusable components found
ywangd/stash ★ 2002 239 APPLICATION

StaSh is a full-featured interactive shell for iOS Pythonista, also running on desktop via Tkinter. It provides a Bash-like environment with command parsing, auto-completion, aliases, environment variables, pipes, redirects, job control, command history, and virtual keys. The architecture is modular: a core runtime (ShRuntime) manages execution, threading, and state; a parser/expander handles shell grammar; a terminal emulation buffer (ShChar/ShSequentialScreen) renders output; and multiple UI backends (Pythonista native, Tkinter, stub) abstract the display layer. The shell ships with 30+ built-in commands (pip, git, ssh, scp, sqlite, ping, etc.), a filesystem interface (FSI) for local, FTP, Dropbox, and zip mounts, a monkey-patching framework for iOS compatibility, and a package manager with Pythonista-specific workarounds. The codebase is well-structured with clear separation of concerns, but shows signs of technical drift: Python 2 remnants, some deprecated library usage (e.g., telnetlib), incomplete Python 3 porting, and fragile workarounds for iOS limitations. It is not a data research project.

RATING: 8.1/10 MAINT: active DRIFT: medium
▸ 4 reusable components found
anteo/redmine_custom_workflows ★ 199 75 APPLICATION

This is a Redmine plugin that allows administrators to define custom Ruby scripts that execute on lifecycle events (before_save, after_save, before_destroy, after_destroy, etc.) for various Redmine objects such as Issue, User, Group, Project, Attachment, TimeEntry, Version, WikiContent, and more. It uses Rails monkey-patching (prepend) to inject callbacks into Redmine models and controllers, and executes user-defined scripts via `instance_eval` in the context of the observed object. The plugin provides a web UI for managing workflows, supports import/export via XML, and includes a custom mailer for sending emails from workflows. It is well-structured, has comprehensive tests, localization support, and CI integration. The codebase is mature and actively maintained, targeting Redmine 6.x and Rails 8.1.

RATING: 8.1/10 MAINT: active DRIFT: low
▸ 2 reusable components found
BetterDiscord/BetterDiscord ★ 9283 1027 APPLICATION

BetterDiscord is a client modification for Discord that injects into the Electron app to provide a plugin and theme system, custom CSS editor, addon store, updater, and developer tools. The architecture is a monolith within the Discord client, structured as three packages: injector (main process), preload, and renderer. Key entry points include the main process (`src/electron/main/index.ts`), preload script (`src/electron/preload/index.ts`), and renderer initialization (`src/betterdiscord/index.ts`). Data flows involve IPC between main and renderer, webpack module interception for patching Discord's React components, file system access for addons and settings, and GitHub API for updates. External dependencies include Electron, React, Monaco Editor, lucide-react, and react-spring. The codebase is well-structured with TypeScript, has tests, and exposes a comprehensive API (`BdApi`) for plugin developers. However, it heavily relies on Discord's internal webpack modules and hardcoded module IDs, making it brittle and requiring frequent updates as Discord changes. The project is actively maintained with recent commits and responsive issue triage.

RATING: 8.0/10 MAINT: active DRIFT: high
▸ 5 reusable components found
joshuacant/ProjectTitle ★ 1124 41 APPLICATION

This repository is a KOReader plugin called 'Project: Title' that replaces the default file browser and history with alternative display modes: cover grid, cover list, details list, and filename list. It extracts book metadata and cover images, caches them in a SQLite database (with zstd compression), and displays progress bars, series information, tags, and custom book status screens. The plugin monkey-patches core KOReader widgets (FileChooser, FileManager, Menu, BookStatusWidget) to inject its own UI components. It also provides background metadata extraction, folder cover generation, and a user-patch extension mechanism. The code is written in Lua and is tightly integrated with KOReader's internal APIs, making it non-portable outside that ecosystem. However, several internal modules (gettext proxy, performance debugger, user-patch template) demonstrate reusable patterns for other KOReader plugins.

RATING: 8.0/10 MAINT: maintained DRIFT: low
▸ 3 reusable components found
timarney/react-app-rewired ★ 9840 420 APPLICATION

react-app-rewired is a CLI tool that allows users to override Create React App (CRA) webpack, Jest, and dev server configurations without ejecting. It works by intercepting react-scripts commands (start, build, test) through a drop-in replacement bin script. The tool loads a user-defined config-overrides.js, then monkey-patches the original CRA configuration modules in Node's require.cache before executing the real react-scripts scripts. This approach is fragile, relies on internal CRA module paths, and is tied to CRA 2.x (react-scripts ^2.1.3). The codebase is simple and functional but lacks its own test suite, uses outdated peer dependencies, and the pattern of monkey-patching is not recommended for modern development. The project is effectively in maintenance mode with the community recommending alternatives like craco or rescripts.

RATING: 5.8/10 MAINT: stale DRIFT: high
▸ 2 reusable components found
── end of results ──
$ submit: