GitHub - joouha/modshim: Override and customize Python packages without touching their code

Override and customize Python packages without touching their code - joouha/modshim

GitHub

#Admintrivia:

Gestern Abend habe ich einen kleinen Bug in GlitchSoc auf fedifreu.de per #Monkeypatching (Bearbeiten von Quellcode auf dem Server) behoben. Der Bug hatte dafür gesorgt, dass ich Trends moderieren musste, obwohl ich eingestellt hatte, dass Trends sofort angezeigt werden sollen.

Jetzt könnt ihr wieder ohne Verzögerung sehen, was in unserer Bubble gerade Thema ist: https://fedifreu.de/explore

Ich will nicht klagen – wer #GlitchSoc einsetzt, will experimentelle Mastodon-Features nutzen und weiß, dass man bei der Behebung mithelfen soll, statt zu jammern. Was ich versuche durch Mitarbeit im Issue-Tracker. Aber es ist nicht einfach. Mir fehlt der Erfahrungsaustausch mit anderen GlitchSoc-Instanz-Admins. Gibt es dazu schon eine Matrixgruppe oder so? Die #Fedimins-Gruppe hat damit leider noch keine Erfahrungen. Wahrscheinlich muss ich es auf Englisch versuchen.

#GlitchSocAdmin #GlitchAdmin #TrendModeration

Trending Without Review doesn't work for links/statuses · Issue #2534 · glitch-soc/mastodon

Steps to reproduce the problem docker-compose build the glitch-soc/mastodon repo without modification Deploy container (in docker) In Admin discovery settings select "Allow Trends without prior rev...

GitHub

That said, as the workingwithruby site advises, you probably don't want to use Thread directly an instead use a higher level abstraction like @bascule's Celluloid gem.

#Ruby #monkeypatching #composition #actors

I *LOVE* this resource (https://workingwithruby.com/wwrt/) on threading in Ruby.

However, I find the suggestion to monkey patch Enumerable here (https://workingwithruby.com/wwrt/low_level_api/) evokes anxiety.

It suggests something like this:

module Enumerable
def concurrent_each
# impl
end
end

We Rubyists *LOVE* implicit over explicit relationships. We tend to think of this as convention over configuration. Thanks, DHH.

Yet this doesn't scale well.

For apps/gems of any significant complication, the accumulation of implicitness results in cognitive overload.

What if someone *else* gets the idea to add a concurrent_each to Enumerable. That is, Enumerable, as a built-in, is akin to a global namespace.

Instead, I recommend something more like a vaguely Java-esque approach (bear with me!) of:

class ConcurrentEach
def self.using(enumerable, &block)
# use the impl supplied in the example linked above
end
end

Using this would look like:

ConcurrentEach.using(files).each { ... }

This way, we're composing instead of monkey patching or mixing in.

Try to avoid modifying code you don't own.

Or, as I've heard, second-hand, of Matz saying to a friend of mine, "Don't hurt Ruby!" 😂

#Ruby #monkeypatching #composition

Wwrts - Working With...

System programming for Ruby programmers.

…but in case any of you want to do something similar, here’s me mocking a WritableStream using a Proxy to provide mock stdout and stderr streams to Console instances to capture the output and save them in my database:

https://codeberg.org/kitten/app/src/branch/logs/src/Logs.js#L47

And here’s the actual monkeypatching code:

https://codeberg.org/kitten/app/src/branch/logs/src/Logs.js#L140

#monkeyPatching #JavaScript #console #NodeJS #web #dev #Proxy #Streams #mocking

app/src/Logs.js at logs

app - A web development kit that’s small, purrs, and loves you.

Codeberg.org
Will this get reverted on Monday? #LateCommitFriday #Ruby #MonkeyPatching 👿

Monkey patching в Go, или грабли от Apple

Все началось с того, что я в очередной раз немного поменял структуры БД, и в некоторых SQL-запросах добавилась новая колонка. Нормальная ситуация - взять и легким движением руки сломать половину unit test’ов, потому что БДшные моки ожидают определенный текст запроса.

https://habr.com/ru/articles/801177/

#monkeypatching #unittesting #go #грабли_повсюду

Monkey patching в Go, или грабли от Apple

Модель - Stable Diffusion v1-5 Все началось с того, что я в очередной раз немного поменял структуры БД, и в некоторых SQL-запросах добавилась новая колонка. Нормальная ситуация - взять и легким...

Хабр

@orsinium monkey patching! Yes, familiar thing from unit tests. What's your opinion on APIs which use monkey patching? Or do you write code with monkey patching outside of testing purposes?

#python #monkeypatching

I’m not sure which I dislike more: the premise of a Python decorator that redirects functions to an LLM, or the fact that they are co-opting the term “monkey patch”, which already has a well-defined meaning in Python.

https://mastodon.social/@python_discussions/111417590351768628

#Python #monkeyPatching

Sometimes #monkeyPatching gets a bad reputation, but I feel like adding draw methods for #pymunk shape-objects is such an elegant solution, it simplifies so many things... you don't need extra data structures to keep track of them, you don't need to check object types at the draw loop... #Python