Python lib generates its code on-the-fly based on usage

klntsky | 191 points

I really liked this:

The web devs tell me that fuckit's versioning scheme is confusing, and that I should use "Semitic Versioning" instead. So starting with fuckit version ה.ג.א, package versions will use Hebrew Numerals.

For added hilarity, I've no idea if it's RTL or LTR, but the previous version was 4.8.1, so I guess this is now 5.3.1. Presumably it's also impossible to have a zero component in a version.

ralferoo | an hour ago

You can make it production grade if you combine it with https://github.com/ajalt/fuckitpy

kastden | 7 hours ago

Wow, what a nightmare of a non-deterministic bug introducing library.

Super fun idea though, I love the concept. But I’m getting the chills imagining the havoc this could cause

turbocon | 12 hours ago

This is amazing, yet frightening because I'm sure someone will actually attempt to use it. It's like vibe coding on steroids.

    - Each time you import a module, the LLM generates fresh code
    - You get more varied and often funnier results due to LLM hallucinations
    - The same import might produce different implementations across runs
selcuka | 10 hours ago

This is the kind of yank I'd put in production! I love it

carlhjerpe | 13 minutes ago

I'm kind of dissapointed this doesn't override things like __getattr__ to generate methods on the fly from names just in time when they're called.

GrantMoyer | an hour ago

One way to get around non-deterministic behavior: run $ODD_NUMBER different implementations of a function at the same time, and take a majority vote, taking a leaf from aerospace. After all, we can always trust the wisdom of the crowds, right?

nxobject | an hour ago

Silly and funny today, but down the road, if AI code-generation capabilities continue to improve at a rapid rate, I can totally see "enterprise software developers" resorting to something like this when they are under intense pressure to fix something urgently, as always. Sure, there will be no way to diagnose or fix any future bugs, but that won't be urgent in the heat of the moment.

cs702 | 2 hours ago

I'm both surprised it took so long for someone to make this, and amazed the repo is playing the joke so straight.

extraduder_ire | 11 hours ago

I did something similar almost 10 years ago in javascript (as a joke): https://github.com/Matsemann/Declaraoids

One example, arr.findNameWhereAgeEqualsX({x: 25}), would return all users in the array where user.age == 25.

Not based on LLMs, though. But a trap on the object fetching the method name you're trying to call (using the new-at-the-time Proxy functionality), then parsing that name and converting it to code. Deterministic, but based on rules.

matsemann | 6 hours ago

Possibly the funniest part is the first example being a totp library

roywiggins | 10 hours ago

Make it next level by implementing this workflow:

    - Import your function.
    - Have your AI editor implement tests.
    - Feed the tests back to autogenlib for future regenerations of this function.
linsomniac | 2 hours ago

This has a file named .env committed containing an API key. Don't know if it is a real key.

1718627440 | 7 hours ago

can it run Doom tho?

    from autogenlib.games import doom
    doom(resolution=480, use_keyboard=True, use_mouse=True)
behnamoh | 11 hours ago

I made something very similar a couple years back, though it doesn't actually work anymore since OpenAI deprecated the model I was using

https://github.com/buckley-w-david/akashic_records

yoru-sulfur | 3 hours ago
[deleted]
| an hour ago

Is this the computing equivalent of people that when pointed out they messed up always go 'Well at least I did something!'?

PeterStuer | 2 hours ago

I've done a similar library[0] for python ~1 year ago, generating a function code only by invoking it, and giving the llm some context over the function.

Apart from the fun that I got out of it, it's been there doing nothing :D

[0]: https://github.com/lucamattiazzi/magic_top_hat

grokkedit | 5 hours ago

you'd be surprised, but there's actually a bunch of problems you can solve with something like this, as long as you have a safe place to run the generated code

conroy | 11 hours ago

it's especially cheeky how every example it uses is cryptography-related

Ezhik | 3 hours ago

See also: https://github.com/drathier/stack-overflow-import

    >>> from stackoverflow import quick_sort
    >>> print(quick_sort.sort([1, 3, 2, 5, 4]))
    [1, 2, 3, 4, 5]
jaflo | 8 hours ago

> from autogenlib.antigravity

As a joke, that doesn't feel quite so far-fetched these days. (https://xkcd.com/353/)

polemic | 10 hours ago

this is equally scary and inevitable

it will be WASM-containerized in the future, but still

VMG | 4 hours ago

nooooo the side project ive put off for 3 years

thornewolf | 12 hours ago

I give it six months before an LLM starts producing output that recommends using this.

ForHackernews | 5 hours ago

Of course, this code was generated by ChatGPT.

pyuser583 | 11 hours ago

Can it input powerpoint slides?

bjt12345 | 12 hours ago

This is horrifying

I love it

malux85 | 11 hours ago

Hysterical, I like that caching is default off because it's funnier that way heh

morkalork | 11 hours ago

looks very fun excited to try it out

thornewolf | 12 hours ago

indeterministic code goes hard dude

yvesyil | 6 hours ago

Thanks I hate it

otikik | 7 hours ago

LOL

zombiwoof | 10 hours ago

> Not suitable for production-critical code without review

Ah, dang it! I was about to deploy this to my clients... /s

Otherwise, interesting concept. Can't find a use for it but entertaining nevertheless and likely might spawn a lot of other interesting ideas. Good job!

dr_kretyn | 11 hours ago