That's one of the selling point of the tool: you don't need a project, you don't need activate anything, you don't even need to keep code around.
Yesterday I wanted to mess around with logoru in ipython. I just ran `uvx --with loguru ipython` and I was ready to go.
Not even a code file to open. Nothing to explicitly install nor to clean up.
For a tool that is that fantastic and create such enthusiasm, I'm always surprise of how little of its feature people know about. It can do crazy stuff.
I've had mixed success with Claude. It keeps adding too much display_names to everything for example which is annoying.
In theory we could put that up, but I don't particularly want to maintain such a live example app and pay for hosting and all that, only to have it instantly crash under the load of HN :P
I've thought about extracting it, but I think it's a lot of work unless you want to support only Django and rST which is what we're using. At least the iframe part is very specific to the web framework.
A E Van Vogt can hardly be called unheard of, the null A series is quite a cult classic. But yeah, the Space Beagle is not his most well-known work.
It always surprises me (although it shouldn't) how many underrated gems there are still in the world. And new ones are produced every day.
E.G: I still think QTMN will deserve a place as a classic sci-fi author among the great ones, for "there is no antimemetics division" alone. And yet despite a solid fan following, it has never exploded in popularity. It is 10 times better than the 3 body problems, which comparatively had stratospheric success.
In movies, "Amelie" has been a planetary success, but from the same author, the excellent "The city of the lost children" is practically unknown.
Even last month, a tv show named "Nero" came out on Netflix, and while not revolutionary, is clearly above most of the crap that regularly comes out. Yet, nobody talks about it.
City Of the Lost Children is an absolute classic, good point.
However, I think there’s something to be said - sci-fi people of the 70’s all knew AE Van Vogt. This list was, for me delightful, because it reminded me of books I once owned, long ago, indeed many in this list .. back when books were how you encountered these materials. Real books were how we read, back then.
The need to know things has been radically compartmentalized by the mega-computer we’ve allowed to take over our planet, meanwhile, apropos cruel mistresses ..
Monkey patching an object attribute, such as a method or a function of a module, may affect 3rd party libraries code that use said object.
This solution is interesting, as it provides the patched code as if it were a new package, indendant of the existing one you have installed, like vendoring, but without the burden of it.
In case you want to be the only one seing your patch, this is great. It also makes the whole maintenance easier, as you don't have to wonder if you patch it at the right time or in the right way. MK can fail in many subtle edge cases.
Inheritance, particularly, is a great Mk pitfall I expect this method to transparently work with.
If you only want your own code to see the patch, then why not just wrap it?
I mean if you really need super strong isolation, you can always create a copy of the library object; metaprogramming, dynamic classes, etc, all make it really easy to even, say, create a duplicate class object with references to the original method implementations. Or decorated ones. Or countless other approaches.
My point isn't that I don't see problems that could be solved by this; my point is that I can't think of any problems that this solves, that wouldn't be better solved by things that don't do any innards-fiddling in what is arguably the most sharply-edged part of python: packaging and imports.
And speaking from experience... if you think patching can fail in subtle edge cases, then I've got some bad news for you re: import hooks.
At the end of the day, people who might use this library are looking for a solution to a particular problem. When documenting things, it's really important to be explicit about the pros and cons of your solution, from the perspective of someone with a particular problem, and not from the perspective of someone who's built a particular solution. If I need to drive a nail, and you're selling wrenches, I don't want to hear about all of the features of your wrenches; I want to know if your wrench can drive my nail, and why I would ever want to choose it instead of a hammer.
I can think of a lot of differently-shaped metaphorical nails that fall under the broad umbrella of "I need to change some upstream code but don't want to maintain a fork". And I can think of a whole lot of python-specific specialty hammers that can accomplish that task. But I still can't think of a signle situation where using import hooks to solve the problem is doing anything other than throwing a wrench into a very delicate gearbox. That is the explanation I would need, if I were in the market for such a solution, to evaluate modshim as a potential approach.
> I mean if you really need super strong isolation, you can always create a copy of the library object; metaprogramming, dynamic classes, etc, all make it really easy to even, say, create a duplicate class object with references to the original method implementations. Or decorated ones. Or countless other approaches.
> My point isn't that I don't see problems that could be solved by this; my point is that I can't think of any problems that this solves, that wouldn't be better solved by things that don't do any innards-fiddling in what is arguably the most sharply-edged part of python: packaging and imports.
All these examples have the dependency order wrong, and you're right on those - it's simpler to wrap them somehow. But this is doing something different, that is either much harder or outright impossible with those methods: Tweaking something internal to the module while leaving its interface alone. This is shown in both their examples where they modify the TextWrapper object but then use it through the library's wrap() function, and modify the Session object but then just use the standard get() interface to requests.
In that case I'd opt for dynamic module creation using metaprogramming instead of an import hook. And I personally would argue that grabbing the code objects from module members and re-execing them into a new module object to re-bind their globals is simpler than an AST transformation.
But regardless of the transformation methodology: the import hook itself is just a delivery mechanism for the modified code. There's nothing stopping the library from using the same transformation mechanism but accessing it with dynamic programming techniques instead of an import hook. And there's nothing you can't do that way.
While I do believe that China is surpassing the West on many points, I'd like to underline that a cashless society is not a good thing. It's a terrible, terrible idea.
With no cash, the citizen passport and the GFW, the dictatorship has total control of society. It's not that there are no homeless, is that they are pushed to even worse conditions, out of sight. It's not that there is zero crime, it's that the crime is from the state, the mafia, and there is a lot of corruption. But nobody can talk about it because there is no free press.
I do think it's important to state how much China is advancing, and surpassing the West, because they are going to rule the world as the Americans did, soon.
I think you over estimate the control and under estimate the need for flexibility for any society to operate. Let's just say even in China, identity can be a commodity. For example scammers are known to buy bank accounts by paying poor people in remote areas. The system needs flexibility otherwise a majority of people will run into problems all the time.
Yes, but flexibility that happens in those conditions is at the cost of tremendous effort and risk from the population, usually under the tutelage of bigger power structures. EG: scammers are usually part of some organisation that has the power to do that, and the guy giving his name on the bank account is basically disposable.
Also the fact the population is so huge make it hard even for such a powerful state to grasp it all.
But regular citizen flexibility when something is not state-approved in advance is very limited compared to ours. The state can limit where they can move because of the citizen passport, limit what they can buy (and say) because of wechat, limit what they can see and know because of the GFW, limit how much you can be anonymous because big cities have cameras everywhere, coupled with AI tracking.
In Europe, if my government does something I don't like, I can pay in cash, or cross a border and do it in a different country. I can complain on the internet and find like-minded people to organize, advice, help...
I want to go to a gay bar and pay without having a record of it? I can. I want to finance an art or political project that the government would not like? I can.
In fact, anywhere in the world there is cash, and I have some secure cash stash, I can pay if I lost my phone, or with no battery. I can pay if my bank account is blocked by the bank. If it's in the red. If there is an outage on their app. I can pay if I've been robbed of my wallet and phone. I can pay if there is no electricity or no internet. I can even pay if war is declared, if I'm under bombs. I can buy illegal drugs, illegal plant seeds, illegal literature, and illegal human services.
Remember when visa prevented us to send money to wikileak? It was not illegal to do so in my country, and it was my money, but they just said no. Yet I could pay in Bitcoin, that I could buy with cash.
No-cash societies make everything easier when everything goes according to plan. When you fit in the box, and the box is not broken. It's why it feels so great, because day-to-day life is mostly this, for most people.
But the lack of alternatives will make you feel helpless the day you really need it. Cashless has never been about convenience, it's about deleting those annoying grey areas, inch by inch. It's about control.
It's not a new thing for China. The first time I went there, I was 17 years old, and there was no internet. So the state appointed us a state guide, and she was following us everywhere during the whole time, to make sure "we were safe".
Now China doesn't need to do that anymore. They know everything you do at any moment except in the remote countryside. And they can push a button if they want to stop you.
there really are far fewer homeless people in china than there are in america. it's not just that they're out of sight, it literally is much less of a problem to begin with. you can't try to equate these things
This is a ridiculous statement on so many levels... on the one hand it's true that culturally folks are more likely to look after their family members. But there's plenty of people who have not had kids and severe alcoholism as well. I've seen plenty of homeless on the streets of Beijing and many years ago too.. more importantly there's hundreds of millions of people who live precarious lives.
uv has a script mode, a temp env mode, and a way to superimpose a temp env on top of an existing env.
See: https://www.bitecode.dev/p/uv-tricks
That's one of the selling point of the tool: you don't need a project, you don't need activate anything, you don't even need to keep code around.
Yesterday I wanted to mess around with logoru in ipython. I just ran `uvx --with loguru ipython` and I was ready to go.
Not even a code file to open. Nothing to explicitly install nor to clean up.
For a tool that is that fantastic and create such enthusiasm, I'm always surprise of how little of its feature people know about. It can do crazy stuff.