Better HN
topnewbestaskshowjobs
Log inSign up

BiteCode_dev

24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions

I write to save you time and effort when dealing with Python:

https://www.bitecode.dev/

Email: contact at bitecode.dev

Submissions

comment 4y ago · link · parent

Yes. Like make, it lets you define tasks with dependencies and targets, and rebuild only if one of them have changed.

But I prefer it because:

- it runs anywhere you have python.

- it uses a clean syntax, and the parser is great at telling you about errors since it's python.

- you get access to python's stdlib: string formatting, maths, etc.

- you get access to python's ecosystem. Want to deal with timezone, hashing, crypto ? Sure you can.

- you get access to python's tooling (debugger, formatter, linter).

- you can still just use bash if you want. Easy things stay easy.

comment 4y ago · link · parent

Diskcache has the amazing benefit of transparent sharding, so you can use it in multithreading and multiprocessing programs.

comment 4y ago · link · parent

I've used tqdm 30 years ago!

Although the first release on pypi was in 2013: https://pypi.org/project/tqdm/#history

comment 4y ago · link · parent

A new wave "of tools gaining traction"

comment 4y ago · link · parent

Here is a task that groups all static files from a web project into a directory.

It has to make sure a bunch of directories exist, run a node js command to build some files from the proper dir, then run a python command to regroup them + all static files from all django apps into one dir. Simple.

But then I had a problem I had to hack around. This required me to change an entry to a generated TOML file on the fly at every build.

doit just lets me add a 5 lines python function that does whatever I want, and insert it between my bash tasks, and I'm done.

    def task_bundle_static_files():

        def update_manifest():
            conf = Path("var/static/manifest.toml")
            data = toml.loads(conf.read_text())
            data["./src/main.js"] = data["index.html"]
            conf.write_text(toml.dumps(data))

        return {
            "actions": [
                "mkdir -p ./var/static/",
                "rm -fr ./var/static/* ",
                "cd frontend/; npm run build",
                "python manage.py collectstatic --noinput",
                update_manifest,
                "cp -r ./var/static/* ",
            ]
        }

comment 4y ago · link · parent

tqdm is indeed 8 years old, but it's been popping up everywhere for only a couple of years now. Hence the "gaining traction".

comment 4y ago · link · parent

Right?

Doing advent of code in Python is almost cheating. It feels like playing a video game.

comment 4y ago · link · parent

And surprisingly underrated.

I mean, it's declarative, works on Windows, easy things are (very) easy, and because you can mix and match bash and python actions, hard things are suspiciously easy too.

Given how complicated the alternatives are (maeven, ninja, make, gulp...), you'd think it would have taken the world for years.

Yet I've only started to see people in the Python core dev team use it this year. It's only getting traction now.

comment 4y ago · link · parent

tqdm is indeed 8 years old, but it's been popping up everywhere for only a couple of years now. Hence the "gaining traction".

comment 4y ago · link · parent

I really love the wave of new tools that are gaining traction in the Python world: tqdm, rich (and soon textual), fastpi, typer, pydantic, shiv, toga, doit, diskcache...

With the better error messages in 3.10 and 11, plus the focus on speed, it's a fantastic era for the language and it's a ton of fun.

I didn't expect to find back the feeling of "too-good-to-be-true" I had when starting with 2.4, and yet.

In fact, being a dev is kinda awesome right now, no matter where you look. JS and PHP are getting more ergonomics, you get a load of new low level languages to sharpen your hardware, Java is modern now, C# runs on Unix, the Rust and Go communities are busy with shipping fantastic tools (ripgrep, fdfind, docker, cue, etc), windows has a decent terminal and WSL, my mother is actually using Linux and Apple came up with the M1. IDEs and browsers are incredible, and they do eat a lot of space, but I have a 32 Go RAM + 1TO SSD laptop that's as slim as a sheet of paper.

Not to mention there is a lot of money to be made.

I know it's trendy right now to say everything is bad in IT, but I disagree, overall, we have it SO good.

comment 4y ago · link · parent

They remember they still made banks after that and their accountant laughed it out.

comment 4y ago · link · parent

Intent.

I don't have my phone expecting it to listen to all the room, all the time.

It could, but if it is, it's not a deliberate choice.

The microphone is not made of this, I regularly put it in plane mode, I don't have an account linked to the phone nor smart assistant actives.

Listening to my phone all the time would require targetting, since it's not, unlike alexa, doing so by design: https://eu.usatoday.com/story/tech/conferences/2020/02/25/go...

comment 4y ago · link · parent

An expensive, hard, long and unreliable thing.

comment 4y ago · link · parent

It's removed from marketing material, but is it removed from the code?

Since the OS is proprietary, how do we know they didn't go for it anyway?

comment 4y ago · link · parent

Well you installed an always on microphone in your house, attached to a processing unit connected to internet all the time.

People said again and again it's going to be abused, and you had the technical knowledge to evaluate the risk.

Yet you went with it.

If it was not your scenario, it would have been another one. There will be other ones. Hell, with things like PRISM, that's inviting 3 letters agencies in your bedrooms.

Since the pandora box is opened and people are going to do it anyway, we should at least militate for having hardware switches on any sensors for any device.

comment 4y ago · link · parent

It would be funny if you could only smell it if it was your biological child.

Although getting serious statistics on the matter is not easy, the estimated numbers can be surprisingly high (e.g: "One in 25 fathers is not biological parent": https://www.theguardian.com/society/2005/aug/11/childrensser...)

If suddenly we discovered an easy way to give a hint you should do a DNA test, it could do some serious noise.

comment 4y ago · link · parent

Thank you, that's an awesome answer in so many ways.

comment 4y ago · link · parent

How does the y-websocket handles network failure ?

Does it autoreconnet? On reconnection, does it sync back changes that happened on or since failure ? Can you notify the user when it's happening ?

comment 4y ago · link · parent

But why would the signal to switch on the light ever leave the building?

comment 4y ago · link · parent

I wager it's more to avoid the "what, a 3rd dose?" reaction.

"Booster" is more positive than "we told you it would be immunization, but actually it's partial and limited, and you have to do it again. Woops, now again".

Especially since people have been talking about a 4th dose.

In the context of distrust of the pharma industry, it would be easy to have the social networks to claim pfizer is trying to become the netflix of vaccine and sell shots as a service.

So they are very careful with the wording.

comment 4y ago · link · parent

> That is a revelation! I never had that training or even knew it existed, and roundabouts are occasionally deployed where I live without implementing any training. The training seems an essential component?

Like for any part of driving a car, training is important for 2 reasons:

- you don't have to think when you are approaching a roundabount. You know where to look, you know what speed (and gear if applicable) you need, you know where lane to go and what signal to use. Since it's a situation with a lot of information, it makes your decision process relaxed and accurate.

- socially, if most drivers are trained, they will behaved consistently, and hence, produce a stress and surprise free experience, but also letting you identify easy the drivers you need to watch out for.

> Any suggestions on where this training might be found (in English)?

I have no idea, it's part of all french drivers training automatically, anywhere you go.

comment 4y ago · link · parent

We are train to do it when passing the driving licence, so it's second nature. In fact, I can do it without thinking, which I can't do with a crossing: too many variables.

The hard part is the signaling (it has very specific rules), and you can see that the older drivers don't use their blinkers properly because they have never been taught to do so.

However, it can becomes dangerous if it's overused.

E.G: Nantes is a city famous for chaining roundabouts, to the point they sometimes have double-roundabouts, which are awkward even after years driving around them. I hate those with a passion.

comment 4y ago · link · parent

Yes, we do.

Even if paris is probably the city with the least roundabout because it's the oldest, you can use google map and zoom to see the little circles:

https://0bin.net/paste/xL8ni-vJ#Sv-WUYiKnM2WuRDTCBX0iHfLCWDm...

We even have to giants ones on Nation, Arc de Triomphe, etc. The later is actually dangerous, since priority is reversed, and the cars entering the roundabout should be given way.

comment 4y ago · link · parent

You may want to check out 1936 Summer Olympics.

comment 4y ago · link · parent

I understand the benefit of randomize output, but that's very costly.

comment 4y ago · link · parent

We have roundabouts everywhere in France, but in the US, they seem not very popular.

They do removes the need for traffic lights, make priority checking a non issue and avoid left turns among other benefits. Although they prevent you from going to fast locally, they tend to make traffic more fluid on average.

Why are they not used that much in the US ?

comment 4y ago · link · parent

If you are caught one time out of 10, this is still profitable and those people, being professional risk manager, will take the chance. Not to mention they can then invest the benefits in a difference venue, and make money from that, which will not be part of the fine.

Jail time however, is not something everyone will want to gamble on.

So, it should be what you said + jail.

comment 4y ago · link · parent

As a Linux user for now 20 years, I think the author is under some kind of delusion that windows doesn't provide enough value to exist on its own.

I thus assume the autor must be very young, and has little experience with the reality of the corporate world, which loves:

- compatibility

- inertia

- deployment automation

- technical support

- strong legal support (compliance, contracts, DOD approval...)

- social proof (reputation, certification, etc)

- have a big player that can be held responsible

- predictability

Apple is not interested in it, Red Hat is not big enough, Google has desmontrated its incapability to do it, and so on. But MS provides all that, and better than any Unix shop in town.

It would be economically ridiculous to turn Windows into Linux and lose all that stuff.

Merging the two could happen if they manage to keep all their pieces of the pie, and I assume WSL is a first step in that direction.

Or maybe it's the embrace stage, I don't know.

comment 4y ago · link · parent

I swear my lord, this Python oil will do miracles with your data ailments.
1
109110111
184