3,226 karma · joined Jun 14, 2019 (7y ago) · 4,043 submissions
comment 5y ago · link · parent
{
pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/cd63096.tar.gz") { }
} :
with pkgs;
let
mypackage = callPackage ./mypackage.nix { stdenv = stdenv; python = python3; };
in
dockerTools.buildImage {
contents = [ mypackage ];
}
You then write a package definition in mypackage.nix, following the template of packaging things in nixpkgs.(Dev environments work in a similar fashion except with mkShell instead of dockerTools.buildImage.)
I haven't used Nix flakes but I think it develops this simple idea further.
comment 5y ago · link · parent
You could theoretically use Nix for managing user apps too, but that's a niche use case and (as you found out) not in a working state.
comment 5y ago · link · parent
E.g., pattern matching of this sort
for ["get", obj] | ["pick", "up", obj] | ["pick", obj, "up"] in list_of_get_commads:
...
IMO should have "just worked".But now we have two different and incompatible versions of pattern matching in Python.
comment 5y ago · link · parent
No, that's exactly what it's designed for and exactly how we use it. And it's not a build tool (it just calls your existing build tools under the hood), it's a system for keeping different versions of dependencies installed at the same time without errors.
> because there is no force in the world that would get all projects in all languages to use it.
You can write your own wrappers for the projects that are missing. It's a simple and idiomatic process.
comment 5y ago · link · parent
for foo, (bar, baz) in nested_tuple_list:
...
This works as expected. The current 3.10 implementation is just half-baked. They should have expanded the existing pattern matching facilities (added support for data structure destructuring).Presumably then you could just have used the existing walrus operator inside the already existing if-else constructs.
That would have been the obvious path of least surprise. What we got instead seems inadequate.
comment 5y ago · link · parent
That ship has sailed more than a decade ago.
(And if we're on a crusade to make Python pythonic again, let's start with the bigger fish - like the sync/async function distinction. Somehow Python managed to fall into the red/blue function trap the hardest.)
comment 5y ago · link · parent
I guess there are lots of demented and broken codebases out there, but starting students with the broken dysfunctional case as the default seems wrong. They can learn bad habits on their own later.
comment 5y ago · link · parent
Back then the main draw of Python was supposed to be the "one way of doing things" - Python originally started as a teaching language.
And look at Python today - there's what, five different "standard" ways of packaging libraries? (And why is "packaging libraries" even a thing?) Instead of "batteries included" we get at least four different ways of doing every common task: the stdlib Python 2 way, the stdlib Python 3 way, the "standard" community third-party synchronous library and the "standard" community async one.
This is just how it always is. Every language starts with the goal of being small, easy to understand and beautifully composeable.
The cruft builds over time because people eventually want it and because none of it ever really goes away due to backwards compatibility.
I think it's best to make peace with this fact, learn to live with the cruft and accept existing languages rather than switching your entire stack every three years trying to chase an unobtainable dragon.
comment 5y ago · link · parent
This thing it looks like uses normal C++ structures under the hood, and if so that's a huge plus.
comment 5y ago · link · parent
In my experience in places where Slack was settled on as a corporate messaging solution the three questions asked (in order of importance) were
* "Does it support custom animated emoji"?
* "Does it have website and document previews"?
* "Can I send my notifications to it"?
(It's silly but that's how it is.)