frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: Cadence – A Guitar Theory App

https://cadenceguitar.com/
91•apizon•1w ago•14 comments

Show HN: Modshim – A new alternative to monkey-patching in Python

https://github.com/joouha/modshim
89•joouha•6d ago•22 comments

Show HN: Katakate – Dozens of VMs per node for safe code exec

https://github.com/Katakate/k7
113•gbxk•22h ago•50 comments

Show HN: bbcli – A TUI and CLI to browse BBC News like a hacker

https://github.com/hako/bbcli
75•wesleyhill•3d ago•15 comments

Show HN: Run any GitHub Action locally from your Cron job -- finally!

https://docs.dagu.io/features/executors/github-actions#basic-usage
16•yohamta•9h ago•0 comments

Show HN: ASCII Automata

https://hlnet.neocities.org/ascii-automata/
95•california-og•4d ago•10 comments

Show HN: AutoLearn Skills for self-improving agents

https://www.autolearn.dev
24•toobulkeh•10h ago•10 comments

Show HN: I'm making a detective game built on Wikipedia

https://detective.wiki/
303•jasonsmiles•4d ago•43 comments

Show HN: I created a cross-platform GUI for the JJ VCS (Git compatible)

https://judojj.com
138•bitpatch•1d ago•43 comments

Show HN: Playwright Skill for Claude Code – Less context than playwright-MCP

https://github.com/lackeyjb/playwright-skill
177•syntax-sherlock•2d ago•43 comments

Show HN: AI FinOps co-pilot that explains and integrates cloud cost insights

https://www.cloudtellix.com/
2•arknirmal•7h ago•0 comments

Show HN: SierraDB – A Distributed Event Store Built in Rust

https://tqwewe.com/blog/building-sierradb/
22•tqwewe•1d ago•2 comments

Show HN: I'm rewriting a web server written in Rust for speed and ease of use

https://ferron.sh/
68•dorianniemiec•1d ago•84 comments

Show HN: I'm 13 and built an AI that remembers context across conversations

https://ai.nityasha.com
8•nityasha•5h ago•6 comments

Show HN: GoSMig – minimal, type-safe SQL migrations written in Go

https://github.com/padurean/gosmig
7•padurean•16h ago•0 comments

Show HN: Django Keel – 10 Years of Django Best Practices in One Template

https://github.com/CuriousLearner/django-keel
21•sanyam-khurana•1d ago•22 comments

Show HN: BlurFaces – one‑tap face blurring in the browser (no upload)

https://blurfaces.org
2•n00bi3s2•9h ago•0 comments

Show HN: LunaRoute – a high-performance local proxy for AI coding assistants

https://github.com/erans/lunaroute
8•erans•14h ago•1 comments

Show HN: Buzzd Chat – a Yahoo Messenger revival project

https://buzzd.chat
3•bogdannbv•10h ago•0 comments

Show HN: I built TicketData – Ticket price trends and data for Sports & Concerts

https://www.ticketdata.com/
7•kapkapkap•22h ago•5 comments

Show HN: Streaky – GitHub Streak Monitor with Distributed Cron Processing

https://github.com/0xReLogic/Streaky
2•0xrelogic•13h ago•0 comments

Show HN: Pyversity – Fast Result Diversification for Retrieval and RAG

https://github.com/Pringled/pyversity
84•Tananon•2d ago•11 comments

Show HN: DocCraft AI – Generate professional business documents

2•iedayan03•15h ago•0 comments

Show HN: Asimov – Context Manager for Coding Agents

3•Ihmzf•15h ago•2 comments

Show HN: EloqDoc: MongoDB-compatible doc DB with object storage as first citizen

https://github.com/eloqdata/eloqdoc
45•iamlintaoz•2d ago•18 comments

Show HN: I use ChatGPT these days to develop new features quickly

https://chatgpt.com/share/68f7f17f-022c-800a-8a75-814847ffe87d
3•EGreg•16h ago•3 comments

Show HN: Open-Source Voice AI Badge Powered by ESP32+WebRTC

https://github.com/VapiAI/vapicon-2025-hardware-workshop
48•Sean-Der•1w ago•7 comments

Show HN: RunOS – Run Your Own Cloud on Your Own Infra

3•tylerreed•17h ago•0 comments

Show HN: ExprTk REPL – Explore math expressions in the browser with WebAssembly

https://www.partow.net/programming/exprtk/repl/index.html
8•exprtk•18h ago•0 comments

Show HN: MTOR – A free, local-first PWA to automate workout progression

https://mtor.club/
5•vmcallsm•19h ago•1 comments
Open in hackernews

Show HN: Modshim – A new alternative to monkey-patching in Python

https://github.com/joouha/modshim
89•joouha•6d ago
I've invented a new alternative to forking / vendoring / monkey-patching packages in Python.

It's a bit like OverlayFS for Python modules - it allows you write modifications for a target module (lower) in a new module (upper), and have these combined in a new virtual module (mount).

It works by rewriting imports using AST transformations, then running both the lower and upper module's code in the new Python module.

This prevents polluting the global namespace when monkey-patching, and means if you want to make changes to a third-party package, you don't have to take on the maintenance burden of forking, you can package and distribute just your changes.

Comments

satya71•5d ago
This is a nice system. I wonder if modshim can be used to or extended to do hot reload.
epgui•9h ago
I ported the clojure bond library over to python. It’s not quite as neat as the original, but IMO the pseudo-FP style is much more ergonomic.

https://github.com/epgui/pybond

Izkata•9h ago
Monkey-patching is altering the code at runtime, not the source code, so from the "alternative to forking and modifying" part it doesn't sound like an alternative to that.

Edit: okay Readme is clear on it and the description does make sense, the short description here just confused me.

BiteCode_dev•8h ago
The is really awesome and an original and clean solution to a dirty old problem. Kudos.
moezd•8h ago
This feels too much like breaking the guarantee sticker of a vendor code, and if your vendor pushes updates weekly, or daily, you are stuck pushing updates to your shimmed code, which officially becomes "unnamed fork". Even for tests, let's say that they changed an input type, I don't see an improvement in my workflow: I still need to update my "unnamed fork". At least with a fork I get to see the whole git history, including my contributions, and testing with monkey patching helps me create clear setUp and tearDown steps.

When you have a scalpel, you give it to operating doctors during the operation, not to 5 year olds on the street.

ramses0•16m ago
Yeah, but the example of "*.retries(...)", in the context of "import some_login_library.Login(...)" is quite powerful! It basically looks like a "super-decorator", and I can definitely see the utility of effectively re-compiling a (third-party) module at runtime to handle something that's more unique to your use case.

Your patch "with retries" might never be accepted, and maintaining any kind of fork(s) or "out-of-tree patches" is not as integrated into the programming environment. Being able to say "assert WrappedLoginLibrary().login(), '...with retries...'" keeps you testable and "in" the language proper.

o11c•8h ago
The import limitation seems to make this not useful for me. Usually when I am monkeypatching, it's because some code I do not control has a (possibly dynamic) import of the "buggy" module under another name, so I need to make my changes visible under the original name.

If I control all the imports I can usually subclass things myself just fine.

theptip•7h ago
> Because our enhanced Session class now enables retries by default, we don't even need to instantiate it directly. modshim's AST rewriting ensures that internal references within the requests module are updated. This means convenience functions like requests.get() will automatically use our enhanced Session class

This seems to explicitly handle the case you are interested in - automatically updating library-internal references to the lower to instead use the upper?

o11c•7h ago
That's talking about internal imports (and static - as much as python supports - ones at that), not external ones.

If A is my application, B is buggy, and C is some other library, consider:

  # A.py
  monkeypatch_B()
  import C

  # C.py
  B = __import__('B')

  # B.py
  bugs()
boxed•7h ago
Also check out https://github.com/adamchainz/patchy
Uptrenda•6h ago
What Python versions have you tested on, OP? Good license choice, by the way.
procaryote•6h ago
Of these:

> * Fix bugs in third-party libraries without forking

> * Modify the behavior of existing functions

> * Add new features or options to existing classes

> * Test alternative implementations in an isolated way

only the last sounds close to something you might actually want to do, and then only as a throwaway thing

If you want to change a library, fork it. If you want to change the behavior of existing functions, don't or at least fork first. If you want to add new features to a class, write a new class, or again, at least fork first

nbadg•5h ago
For context: one of the several projects I'm working on right now is an automated extraction system for literate-code-style documentation in python. This isn't the place nor time to talk about the why of it (especially compared to other existing similar solutions). The important thing is the how: it uses a temporary import hook to stub out all module imports, allowing the docs generator to process each module independently at runtime, track imports between them, etc. At the end of the process, it also cleans itself up nicely.

Point being, it's a lot of really complicated fiddling with the python import system. And a lesson I have learned is that messing around with import internals in python is extremely tricky to get right. Furthermore, trying to coordinate correctly between modules that do and don't get modified my the hook is very finicky. Not to mention that supply side attacks on the import system itself could be a terrifying attack vector that would be absurdly difficult to detect.

All this to say, I'm not a big fan of monkeypatching, but I know exactly how it behaves, its edge cases, and what to expect if I do it. It is, after all, pretty standard practice to patch things during python unit tests. And even with all its warts, I would prefer patching to import fiddling any day of the week and twice on Sunday.

Feedback for the author: you need to explain the "why" of your project more thoroughly. I'm sure you had a good reason to strike out in this direction, and maybe this is a super elegant solution. But you've failed to explain to me under what circumstances I might also encounter the same problems with patching that you've encountered, in order to explain to me why the risk of an import hook is justified.

Uptrenda•4h ago
Sounds super interesting. Is it ready to demo?
nbadg•4h ago
No, but I'll definitely post it to HN when it is!
pbronez•58m ago
Please do - I’m very interested in ways to keep code and documentation tightly in sync.
OJFord•4h ago
I didn't really get why I'd want to actually use it (vs. just a cool demo) either, until:

> means if you want to make changes to a third-party package, you don't have to take on the maintenance burden of forking, you can package and distribute just your changes.

That's a big win. I've seen and done my share of `# this file from github.com/blah with minor change X to L123` etc.

nbadg•3h ago
If the goal is to actually package and distribute the changes via import hook, that makes the supply chain attack question particularly relevant. And it still doesn't explain why you couldn't just package and distribute the monkeypatch itself, instead of creating a whole new import ecosystem surrounding hooks.

I've done my fair share of that too, but I'm still not seeing the benefit vs patching.

pmarreck•2h ago
This is the wrong direction. I can say this having written a monkeypatching management library in Ruby a long time ago.
throwaway894345•50m ago
Can you elaborate? I’m just curious. I’m still not sold on monkey patching at all (it largely seems like a way to get around writing modular code).
afarviral•1h ago
This is interesting, and I'll try to remember to give this a go next time I'm tempted to patch something from the standard library, but...

The README mentions 3 scenarios that this might be preferred over, but not the fourth which I regularly do: Create my own functions/classes that are composed from the unchanged modules. E.g. a request_with_retries function which adds retry logic to requests without the need to monkey patch. I regularly use decorators as well to add things like retries.

For more complex scenarios Modshim might win out, as mentioned in the understated section of the README "Benefits of this Approach":

> Internal Reference Rewriting: This example demonstrates modshim's most powerful feature. By replacing requests.sessions.Session, we automatically upgraded top-level functions like requests.get() because their internal references to Session are redirected to our new class.

> Preservation of the Original Module: The original requests package is not altered. Code in other parts of an application that imports requests directly will continue to use the original Session object without any retry logic, preventing unintended side-effects.

What I think this means is Modshim lets you really get in to the guts of a module (monkey-patch style, giving you god-like powers), while limiting the damage.

yincong0822•46m ago
That’s a really cool idea — kind of like OverlayFS but for Python modules. I like how it lets you layer changes on top of existing packages without having to fork or monkey-patch them directly.

The big win here is that it keeps things clean and maintainable — you only ship your changes instead of managing a full fork, and you don’t mess up the global namespace. It also makes experimenting with tweaks a lot easier.

The tricky parts might be keeping import behavior consistent and making sure debugging still works nicely since AST rewriting can sometimes make stack traces a bit messy.

Overall, it’s a clever middle ground between monkey-patching and forking — really nice concept.