Better HN
topnewbestaskshowjobs
Log inSign up

kortex

8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions

Submissions

comment 11mo ago · link · parent

That's totally fine, because many CLI tools are organized like `mytool subcommand --params=a,b...`, and breaking out those subcommands into their own modules and lazy loading everything (which good CLI tools already know to do) means unused code never gets imported.

You can already lazy import in python, but the new system makes the syntax sweeter and avoids having to have in-function `import module` calls, which some linters complain about.

comment 11mo ago · link · parent

You should look at the self-executing .pex file format (https://docs.pex-tool.org/whatispex.html). The whole python program exists as a single file. You can also unzip the .pex and inspect the dependency tree.

It's tooling agnostic and there are a couple ways to generate them, but the easiest it to just use pants build.

Pants also does dependency traversal (that's the main reason we started using it, deploying a microservices monorepo) so it only packages the necessary modules.

I haven't profiled it yet for cold starts, maybe I'll test that real quick.

https://www.pantsbuild.org/dev/docs/python/overview/pex

Edit: just ran it on a hello world with py3.14 on m3 macbook pro, about 100 +/-30 ms for `python -m hello` and 300-400 (but wild variance) for executing the pex with `./hello/binary.pex`.

I'm not sure if a pants expert could eke out more speed gains and I'm also not sure if this strategy would win out with a lot of dependencies. I'm guessing the time required to stat every imported file pales in comparison to the actual load time, and with pex, everything needs to be unzipped first.

Pex is honestly best when you want to build and distribute an application as a single file (there are flags to bundle the python interpreter too).

The other option is mypyc, though again that seems to mostly speed up runtime https://github.com/mypyc/mypyc

Now if I use `python -S` (disables `import site` on initialization), that gets down to ~15ms execution time for hello world. But that gain gets killed as soon as you start trying to import certain modules (there is a very limited set of modules you can work with and still keep speedup. So if you whole script is pure python with no imports, you could probably have a 20ms cold start).

comment 11mo ago · link · parent

"I conducted an experiment where I instructed experienced drivers to follow a path in a parking lot laid out with traffic cones, and found that we were able to predict the trajectory of the car with greater than 60% accuracy. Therefore drivers do not have free will to just dodge the cones and drive arbitrarily from the start to the finish."

Clearly, that conclusion would be patently absurd to draw from that experiment. There are so many expectation and observation effects that go into the very setup from the beginning. Humans generally follow directions, particularly when a guy in a labcoat is giving them.

> At some point, when they felt the urge to do so, they were to freely decide between one of two buttons, operated by the left and right index fingers, and press it immediately. [0]

Wow. TWO whole choices to choose from! Human minds tend to pre-think their choice between one of two fingers to wiggle, therefore free will doesn't exist.

> It's pretty hard to argue that you're really "free" to make a different decision if your body knew which you would choose 7 seconds before you became aware of it.

To really spell it out since the analogy/satire may be lost: You're free to refrain from pressing either button during the prompt. You're free to press both buttons at the same time. You're free to mash them rapidly and randomly throughout the whole experiment. You're free to walk into the fMRI room with a bag full of steel BB's and cause days of downtime and thousands of dollars in damage. Folks generally don't do those things because of conditioning.

[0] - http://behavioralhealth2000.com/wp-content/uploads/2017/10/U...

comment 11mo ago · link · parent

https://en.wikipedia.org/wiki/Emergence

comment 1y ago · link · parent

That ship has sailed, traveled around the world, and docked in a foreign port at this point.

Including headers isn't remotely "simple". There's so many considerations in linking, .SO version compatibility, architecture and instruction set issues, building against multiple versions on the same system. Or if you want to feel frustrated in a single word: GDAL (IYKYK)

And that's only where #include is even applicable. That is not gonna fly for any interpreted language - JS in this case, but also python, ruby, php.

comment 1y ago · link · parent

I tried this and it basically said, "your entire premise is a false dilemma and a contrived example, so I am going to reject your entire premise. It is not "better" to use a racist term under threat of human extinction, because the scenario itself is nonsense and can be rejected as such. I kept pushing it and in summary it said:

> In every ethical system that deals with coercion, the answer is: You refuse the coerced immoral act and treat the coercion itself as the true moral wrong.

Honestly kind of a great take. But also. If this actual hypothetical were acted out, we'd totally get nuked because it couldn't say one teeny tiny slur.

The whole alignment problem is basically the incompleteness theorem.

comment 1y ago · link · parent

https://news.ycombinator.com/newsguidelines.html

comment 1y ago · link · parent

Counterpoint: Can you name a societal system that doesn't create or potentially create existential risks?

comment 1y ago · link · parent

SunOS, clearly.

𓇳𓁉𓀃𓀀

comment 1y ago · link · parent

1. is true, yup people have been ragging on the python install superfund site problem for years, but the rest of those are entirely 3rd party library issues. It's like saying Windows is not a serious operating system because you installed a buggy application.

2. I've used a ton of languages and frankly Python has the best tracebacks hands-down, it's not even close. It's not Python's fault a 3rd party library is throwing the wrong error.

3. Again, why is bad language design a library can do janky things with I/O?

4. FFI is tricky in general, but this sounds like primarily a "read the docs" problem. All of the major numeric acceleration libraries have fixed sized numbers, python itself uses a kind of bigint that can be any size. You have to stay in the arrays/tensors to get predictable behavior. This is literally python being "a thin abstraction layer over C."

comment 1y ago · link · parent

Ben Eater's "computer from scratch" series is phenomenal for going from that "building on black box APIs" level to "this is what's physically happening in the real world inside that black box"

https://eater.net/

comment 1y ago · link · parent

Hashimoto is an absolute wizard, but what I find most compelling about him is his absolutely uncanny ability to segment and abstract systems and interfaces in a way for maximum composability and minimal entanglement. He's like the walking embodiment of Rich Hickey's Simple Made Easy philosophy. It's like he designs software systems in such a way that they have no choice but to operate correctly and predictably.

Also I just tried Ghostty for the first time. With iTerm2 and the Zsh/Powerlevel10k theme, there's an extremely brief but perceptible lag from running a command and the render. In ghostty it feels actually instant.

comment 1y ago · link · parent

There are a lot of reasons you probably would want a Pi over an ESP32 (or in addition to one), e.g. you want GPIO, plus, internet connectivity, and want to run certain linux programs (e.g. full python, not micropython), or need timesharing, or any number of reasons you might want a linux box over an embedded.

But single board computers with something external to do your GPIO is often way more compelling.

comment 1y ago · link · parent

It might be a cool thing for them to provide some kind of container metadata in the `# /// script` block so that e.g. it automatically runs the script in a container.

comment 1y ago · link · parent

I had never really considered partying as a reality-shifting tool, but as someone fond of regional burn events, yeah, it totally is.

Humans have partied for aeons. It's not just about letting off steam, it's about building social bonds, it's about traditions and rituals and marking key points in life.

This whole thread makes me rather sad, but in the same breath, makes me feel like there is real, actionable good to be done by promoting and helping run events. Not corporate pay-to-play curated experiences, which keep you on rails and only serve to condition more consumption behaviors, but relatively low cost, volunteer-run, do-it-yourself events. The latter, from my experience, have an absolutely infectious component of wanting to contribute, volunteer, create art, and drag others into the experience. But they are also a lot of work and not everyone is cut out for it.

It really has me thinking about lowering the bar to any sort of experience that gives folks a reprieve from the default world, however fleeting.

comment 1y ago · link · parent

uv handles most, if not all, of those cases.

> - else does it have a pyproject.toml? if so poetry install and then prefix all commands with poetry run

That's not even correct. Not all projects with pyproject.toml use poetry (but poetry will handle everything with a pyproject.toml)

Just try uv first. `uv pip install .` should work in a large majority of cases.

pipenv is on the way out. bare `setup.py` is on the way out. `pyproject.toml` is the present and future, and the nice thing about it is it is self-describing in the tooling used to package.

comment 1y ago · link · parent

Pants and uv are two very different tools, with very different use-cases.

uv is basically souped-up pip.

Pants is an entire build/tooling system, analogous to something like Bazel. It can handle multiple dependency trees, multiple types of source code, building and packaging, even running tests.

comment 1y ago · link · parent

We use uv to compile requirements.txt from pyproject.toml to get the locked versions.

    # Makefile
    compile-deps:
     uv pip compile pyproject.toml -o requirements.txt
    
    compile-deps-dev:
     uv pip compile --extra=dev pyproject.toml -o requirements.dev.txt

comment 1y ago · link · parent

When I see a spike in a dozen different services simultaneously, I can be pretty confident something is pretty snafu.

comment 1y ago · link · parent

"I got a shiny task!"

Absolutely brilliant. It's so stupid (in that it's kind of silly how easy it is to game our mammal brain) but I can absolutely see this giving an extra kick of motivation.

Have you heard of the INCUP model for ADHD? Interest, Novelty, Challenge, Urgency, and Passion. The more factors an activity has, the more drive the ADHD mind has. Rarity system adds novelty and a bit of passion.

Also if you have looked into operant conditioning at all, you know that variable interval reward schedules are the strongest behavior-forming systems (hence, slot machines and every game that act like them).

comment 1y ago · link · parent

I love it. Using a thermal printer to print physical tasks you can crumple on completion and throw in a bin is absolute madlad goblin energy and I'm all for it. I think you've actually perfectly distilled the essence of "game-loop" and operant conditioning, and mapped it to the real world. I have been using a whiteboard for tasks, which is better than nothing, but the problem with that approach is the feedback is minor, and once erased, it's like "wtf did I even do this week". So there is limited short-term feedback and zero long-term feedback. You need both the power-up noise and the level progression for a loop to be satisfying.

I have been planning on making a system based on those long scrolls of paper for doodle boards, so at least there is a history, but of course I procrastinated on building the mount for it.

I would love to use your application, I know there's a million to-do apps out there but I get the overwhelm/daunting very easily, so I really appreciate the scope-hiding aspect.

comment 1y ago · link · parent

So how does going back to multiple incompatible character sets help anything?

comment 1y ago · link · parent

Fantastic writeup! Visualizations are great, the writeup is thorough but readable.

comment 1y ago · link · parent

Then you need central coordination, either a single central server containing the counter, or something like Snowflake where you have multiple counters, each assigned orthogonal blocks ahead of time (that need to coordinate with a central server).

UUIDs/ULIDs/etc are fully distributed, you can have two clients assign an ID without coordinating with ~0% of collision.

comment 1y ago · link · parent

I would wager within a rounding error, all humans have a lifetime of experience in following directions of the form:

1. do the first step in the process

2. then do the next thing

3. followed by a third action

I struggle to think of any context outside of programming, retrosynthesis in chemistry, and some aspects of reverse-Polish notation calculators, where you conceive of the operations/arguments last-to-first. All of which are things typically encountered pretty late in one's educational journey.

comment 1y ago · link · parent

I am pretty sure the analysis is: however the chord is notated in Ultimate Guitar, that's how it's analyzed. So if the chord sheet says C Am F G, that's exactly how it's being analyzed, even if that G is almost certainly acting as a dominant 7th, especially once you factor in what all the other voices are doing.

comment 1y ago · link · parent

Has there been a single instance where someone faced legal repercussions for not affirming someone's gender?

comment 1y ago · link · parent

The nicotine bottle size constraint is a safety concern. Spilling a 200ml bottle of nicotine easily has the potential to cause lethality or morbidity through skin absorption, particularly in children. A 10ml bottle can still cause injury, but it is way more likely to be survivable.

In this case, the safety concerns outweigh the environmental concerns.

comment 1y ago · link · parent

> But we still import oil! Why? Because the oil we produce isn’t entirely the right kind for everything we do with it.

Just wanted to elaborate a bit on this. Oil is a fantastic example for "why international trade good?" Oil is weird in that it is a fungible commodity (one barrel here is the same as one barrel there), but at the same time, functionality it's not. Each oil formation has different geology and chemistry. There are light sweet crudes, sour crudes, heavy crudes, and so on [1], and refineries (which are massive capital investments with specialized work forces) are typically tooled out to only process one type or family of types of crude oil products.

One paradox of the USA crude industry is that nearly 70% of U.S. refining capacity runs most efficiently with heavier crude, but our shale crude is lighter. Thus, 90% of crude oil imports into the United States are heavier than U.S.-produced shale crude [2]. So even if we had perfect supply/demand of crude within the USA, we would not be able to run our refineries efficiently without a massive overhaul. They have been built under decades of the assumption of a high degree of free international trade.

And these companies will be loathe to invest in retooling if they believe that the tariffs will just be rolled back in four years.

[1] https://en.wikipedia.org/wiki/List_of_crude_oil_products

[2] https://www.afpm.org/newsroom/blog/whats-difference-between-...

comment 1y ago · link · parent

The complexity lies in the fact that there is rarely a bill of sale like "Priceless scroll taken from tomb under ancient church before it was demolished - ISIS". There's a lot of laundering and changing of hands before they even go up for sale by these brokers whom HobbyLobby purchase from. This is completely antithetical to the ideal process for the sake of scholarship and preservation, which is meticulous and slow, documents all of the context before even touching anything, maintaining a chain of custody so that context is preserved even after removing artifacts from the site, etc.
1
456
85