News for hackers. Stuff that matters.
Re:Learning Go as a Python Developer: The Good and the Bad by okasaki on Monday July 18, 2022 @05:00PM (#32143627)
Sometimes I feel people are using Python very differently than me. I just use pip freeze and virtualenv (these are Python basics, not some exotic tools) and I feel it works great.

Granted, you don't get a nice executable, but it's still miles ahead of C++ (people literally put their code into header files so you don't have to link to a library), and even modern languages like rust (stuff is always broken, or I have some incompatible version, even when it builds it doesn't work)

By the way if you're a Python user, Nim is worth checking out. It's compiled, fast and very low fuss kind of language that looks a lot like Python.

Re:Learning Go as a Python Developer: The Good and the Bad by pdimitar on Monday July 18, 2022 @05:08PM (#32143748)
> and even modern languages like rust (stuff is always broken, or I have some incompatible version, even when it builds it doesn't work)

Been working on and off with Rust for the last 3 years, never happened to me once -- with the exception of the Tokio async runtime that has breaking changes between versions. Everything else always worked on the first try (checked with tests, too).

Comparing Python with C++ doesn't make do argument any favours, and neither does stretching a single Rust accident to mean the ecosystem is bad.

Re:Learning Go as a Python Developer: The Good and the Bad by mcronce on Monday July 18, 2022 @06:04PM (#32144584)
This is consistent with my experience. Semantic versioning is very very widely used in the Rust ecosystem, so you're not looking at breaking changes unless you select a different major version (or different minor version, for 0.x crates) - which you have to do manually, cargo will only automatically update dependencies to versions which semver specifies should be compatible.

For crates that don't follow semver (which I'm fairly certain I've encountered zero times) you can pin a specific exact version.

Re:Learning Go as a Python Developer: The Good and the Bad by fiddlerwoaroof on Monday July 18, 2022 @06:18PM (#32144760)
When I was a Python dev, I never saw that happen in ten years or so of work. Pip freeze and virtualenv just worked for me.

I will say, though, that this only accounts for times where you’re not upgrading dependencies. Where I’ve always run into issues in Python was when I decided to upgrade a dependency and eventually trigger some impossible mess.

Re:Learning Go as a Python Developer: The Good and the Bad by sinsterizme on Tuesday July 19, 2022 @07:04AM (#32149900)
Piptools [1] resolves this by having a requirements.in file where you specify your top level dependencies, doing the lookup and merging of dependency versions and then generating a requirements.txt lock file. Honestly it’s the easiest and least complex of Python’s dependency tools that just gets out of your way instead of mandating a totally separate workflow a la Poetry.

[1] https://github.com/jazzband/pip-tools

Re:Learning Go as a Python Developer: The Good and the Bad by mypalmike on Monday July 18, 2022 @07:07PM (#32145277)
Upgrading dependencies is fraught in all languages.
Re:Learning Go as a Python Developer: The Good and the Bad by ramchip on Monday July 18, 2022 @08:11PM (#32145821)
It's really not. I've had a much, much worse experience with Python than Elixir / Go / Node for various reasons: lots of different tools rather than one blessed solution, people pinning specific versions in requirements (2.1.2) rather than ranges (~> 2.1), dependency resolution never finishing, pip-tools being broken 4 times by new pip releases throughout a project (I kept track)...

In Elixir I can do `mix hex.outdated` in any project, no matter who wrote it, and it'll tell me very quickly what's safe to update and link to a diff of all the code changes. It's night and day.

Thankfully, it's getting gradually better with poetry, but it's still quite clunky compared to what you get elsewhere. I noticed lately for instance that the silent flag is broken, and there's apparently no way to prevent it from spamming 10k lines of progress bars in the CI logs. There's an issue on Github, lost in a sea of 916 other open issues...

Re:Learning Go as a Python Developer: The Good and the Bad by oars on Monday July 18, 2022 @07:27PM (#32145481)
Haven't had any issues in Go so far.
Re:Learning Go as a Python Developer: The Good and the Bad by mypalmike on Monday July 18, 2022 @09:42PM (#32146500)
As soon as you take 2 dependencies in any language, there's a chance you will not be able to upgrade both of them to latest versions because somewhere in the two dependency subgraphs there is a conflict. There's no magic to avoid this, though tooling can help find potentially working versions (at least by declaration). It's often the case that you don't encounter conflicts in Python or other languages, but I don't imagine that Go is immune.
Re:Learning Go as a Python Developer: The Good and the Bad by jhardy54 on Monday July 18, 2022 @10:01PM (#32146660)
Are you familiar with npm? I haven’t used it deeply in years, but the last time I checked it still supported conflicting dependencies.

If A and B both depend on different versions of C, then both versions of C are installed and A/B see the version they want.

Re:Learning Go as a Python Developer: The Good and the Bad by mypalmike on Monday July 18, 2022 @10:20PM (#32146783)
I've used npm but an not familiar with these kinds of details of it. There would seem to be some potential putfalls, such as two libraries accessing a single system resource (a config file, a system socket, etc.). I will take a look into this though. Thanks.
Re:Learning Go as a Python Developer: The Good and the Bad by fiddlerwoaroof on Wednesday July 20, 2022 @07:38PM (#32173875)
npm works around some problems like this with a concept of "peer dependencies" which are dependencies that can only be depended on once. The typical dependency, though, is scoped to the package that requires it.
Re:Learning Go as a Python Developer: The Good and the Bad by pkolaczk on Monday July 18, 2022 @11:11PM (#32147106)
Rust can include different versions of the same library (crate) in a single project just fine. As long as those are private dependencies, no conflicts would happen. A conflict would happen only if two libraries pass around values of a shared type, but each wanted a different version of the crate that defines the type.

I can't see a reason why Go would be different.

Re:Learning Go as a Python Developer: The Good and the Bad by tempest_ on Monday July 18, 2022 @05:09PM (#32143764)
Comparing anything to C++ is a very low bar.

I have rarely encountered issues in rust. Most rust crates stick to semver so you know when there will be a breaking change. My rust experience with Cargo can only be described as problem free(though I only develop for x86 linux).

As for pip freeze and virtualenv things start to fall apart especially quickly when you require various C/C++ dependencies (which in various parts of the ecosystem is a lot) as well as different python versions (if you are supporting any kind of legacy software). This is also assuming other people working on the same project have the same python yadda yadda the list goes on, its not great.

Re:Learning Go as a Python Developer: The Good and the Bad by geysersam on Monday July 18, 2022 @07:41PM (#32145593)
> pip freeze and virtualenv things start to fall apart especially quickly when you require various C/C++ dependencies

Yes 100 times. That can be incredibly frustrating. During the last year I've used a large (and rapidly evolving) C++ project (with many foss C/C++ dependencies) with Python bindings. We've collectively wasted sooo many hours on dependency issues in the team.

Long compilation times contribute considerably to slow down the feedback loop when debugging the issues.

Re:Learning Go as a Python Developer: The Good and the Bad by fiddlerwoaroof on Monday July 18, 2022 @06:14PM (#32144716)
The issue I’ve encountered in rust is looking at a library and seeing that it requires a nightly build of the compiler.
Re:Learning Go as a Python Developer: The Good and the Bad by smeagull on Monday July 18, 2022 @07:13PM (#32145335)
If I did that I'd have no harddrive space left due to how large python dependencies are.
Re:Learning Go as a Python Developer: The Good and the Bad by Spivak on Monday July 18, 2022 @08:21PM (#32145883)
Wat? What dependencies? I have right now 100 separate Python projects which each have their own venv, their own isolated dependencies, and their own isolated copy of Python itself and my code dir doesn’t even crack top 10 hard drive space.
Re:Learning Go as a Python Developer: The Good and the Bad by Game_Ender on Monday July 18, 2022 @10:29PM (#32146846)
Machine learning packages like Tensorflow can result in GB size package directories.
Re:Learning Go as a Python Developer: The Good and the Bad by stavros on Tuesday July 19, 2022 @08:00AM (#32150314)
Yes, the biggest available library is big, that's hardly an argument though.
Re:Learning Go as a Python Developer: The Good and the Bad by smeagull on Thursday July 21, 2022 @08:46AM (#32178654)
A really common library that gets used in every project for common use-cases is big.

It's a very good argument.

Re:Learning Go as a Python Developer: The Good and the Bad by stavros on Thursday July 21, 2022 @08:48AM (#32178667)
No, saying "one common library is big" isn't a good way to show that "Python dependencies are big", which is what the initial claim was. Most libraries are tiny, and there's a very big one because it does many things. If Tensorflow were in JS it wouldn't be any smaller.
Re:Learning Go as a Python Developer: The Good and the Bad by rewgs on Monday July 18, 2022 @10:27PM (#32146830)
Yup. PyEnv for installing various versions. /path/to/pyenv/version/bin/python -m venv venv. Activate the venv (I made "av" and "dv" aliases in my .zshrc). Done, proceed as usual.