News for hackers. Stuff that matters.
Re:Python Is Eating the World by hyperpallium on Monday August 12, 2019 @12:01AM (#20672314)
Is there a model dependency management system for some other language that addresses all these issues?

Dependency hell is everywhere.

Re:Python Is Eating the World by atoav on Monday August 12, 2019 @12:34AM (#20672439)
> Dependency hell is everywhere.

Excuse me, but as a long time Python user I have to disagree. I started using Rust two years ago and Rust’s dependency managment is easily the best thing I ever saw (keep in mind that I didn’t see everything, so there is a chance there are better things out there).

The project-/dependency-manager Cargo¹ is more “pythonic” than anything Python ever came up with and where others mumbled ”dependency hell is everywhere” the Rust people seem to have thought something like: ”there must be a way to do this properly”.

The whole thing gives me hope for Python, but angers me everytime I start a new python project. Poetry is good, but there should be an official way to do this.

It saddens me to see, that some people seem to just have given up on dependency managment alltogether and declared it unsolvable (which it is not, and probably never has been).

¹: https://doc.rust-lang.org/cargo/index.html

Re:Python Is Eating the World by jnwatson on Monday August 12, 2019 @12:46AM (#20672496)
There's a pattern to this. The later the dependency manager was created, the better it is. This is a hard problem space where each new language got to use the lessons learned on the earlier ones.

Cargo, though, has a silver bullet. If it can't find a solution to determine a single version for a package, it simply includes more than one version in the object code. That would take a lot of work to duplicate in Python.

Re:Python Is Eating the World by icebraining on Monday August 12, 2019 @04:14AM (#20673503)
Python has had multi-version installation of libraries for a long time: https://packaging.python.org/guides/multi-version-installs/

Unfortunately, pip came along and took over, despite lacking support for that. It would have been nice if a better packaging tool had replaced easy_install, but alas.

Re:Python Is Eating the World by irishsultan on Monday August 12, 2019 @06:19AM (#20674077)
That only helps when installing multiple versions at the same time, it doesn't help with using multiple versions in the same application.
Re:Python Is Eating the World by heavenlyblue on Tuesday August 13, 2019 @06:38AM (#20684356)
Yeah, and the compiler will also report errors if different modules use different versions of the same package.

  - module A uses v1 and uses trait v1.A 
  - module B uses v2 and uses trait v2.A
  - will be reported as "A does not implement trait A"
It's actually quite discomforting for newcomers.
Re:Python Is Eating the World by atoav on Monday August 12, 2019 @02:18AM (#20672896)
They definitly gave this a thought while designing the library system (”crates”) for the language. I am not sure if it is feasible to retrofit such a solution to something like python.. Python 4 maybe?
Re:Python Is Eating the World by ajmurmann on Monday August 12, 2019 @12:30AM (#20672424)
Rust's cargo, JS's yarn and the grand daddy of them all Ruby's bundler address all these issues. Even newer versions of Gradle support a workflow where you specify the versions you know you want and just on everything else, including transitive dependencies, down.
Re:Python Is Eating the World by blaisio on Monday August 12, 2019 @01:47AM (#20672767)
Go's new system addresses them all too.

This is the other frustrating thing: there is this stockholm syndrome effect, because people are so used to dependency management being horrible, they think there are just no good dependency management systems, and they give up.

Re:Python Is Eating the World by scandinavian on Monday August 12, 2019 @06:29AM (#20674124)
What system is this? Isn't the built in package system still just pulling from github URL's?
Re:Python Is Eating the World by foldr on Monday August 12, 2019 @06:48AM (#20674224)
No, there's a module system now: https://blog.golang.org/using-go-modules
Re:Python Is Eating the World by AsyncAwait on Monday August 12, 2019 @08:48AM (#20674911)
GitHub is still the host for many of them, but there are Modules, so you get proper versioning and all that even when the place you end up getting them from is GitHub.
Re:Python Is Eating the World by oehtXRwMkIs on Tuesday August 13, 2019 @04:24PM (#20689849)
Huh, nice to hear, I was waiting for this to happen but apparently missed it.
Re:Python Is Eating the World by jbverschoor on Monday August 12, 2019 @12:41AM (#20672474)
Yeah.. not sure why the love for Ruby faded in startup-world
Re:Python Is Eating the World by mooreds on Monday August 12, 2019 @05:50AM (#20673944)
I think ruby is alive and well for a lot of startups. I do think it is being squeezed on three sides though.

* From javascript. If you have a app like front end, you are going to use js. Why not have the whole stack be js and have your developers use only one language.

* From python for anything web + data science. Again, why not have your whole stack be in one language?

* From lack of hype. Rails is still evolving, but a lot of packages are not seeing releases (I have used packages 3-4 years old). This indicates to me that the energy isn't there in the community the way it used to be. I have seen the consultants who are always on the bleeding edge move on to elixir.

That said I have seen plenty of startups using ruby (really rails) and staffing when I hired for ruby wasn't an issue.

I do help run a local ruby meetup and attendance is good but not exceptional (15-40 people every month). So that may skew my viewpoint.

Re:Python Is Eating the World by majewsky on Monday August 12, 2019 @06:05AM (#20674014)
"From JavaScript" also includes another side: When your frontend is in JS, your backend can be a simple REST API. And building a REST API requires much less framework than building a server-side-rendering webapp does, so it's tempting to use Go or Rust or whatever you like.
Re:Python Is Eating the World by jbverschoor on Monday August 12, 2019 @12:28PM (#20676957)
You’ll need (probably) at least: -Database connection -An ORM -Middleware against attacks / rate limiting -Caching -Jobs / workers -A rendering engine for email and maybe pdf -Some sort of admin/backend -Logging -Validation

I’ve written an API once from scratch. Actually twice. First time in Modena, because it was all the hype, but it was arcane. Then Sinatra, where I ended up creating all of the above. Rails is excellent for APIs.

Rust is nice, but I’m not sure if I’d like it for all of an API. I don’t like go. Crystal seems great, because it’s typed and it’s also super fast.

Re:Python Is Eating the World by mooreds on Monday August 12, 2019 @02:46PM (#20678534)
Have you looked at Graphiti? Haven't had a chance to use it but it looks great for creating APIs in rails:

https://www.graphiti.dev/guides/

Re:Python Is Eating the World by mooreds on Monday August 12, 2019 @08:05AM (#20674604)
Agreed. I still think that ruby is great for jamming out an API (far better in terms of development speed than go or rust) but a lot of the great gems that can speed up development assume server side rendering. That plus the fact that go/rust/whatever are probably more "interesting" and faster (at runtime) than ruby is an additional obstacle (for ruby!).
Re:Python Is Eating the World by ericd on Monday August 12, 2019 @01:53AM (#20672794)
Probably JS taking over web dev and invading the server.
Re:Python Is Eating the World by crusso on Monday August 12, 2019 @11:43AM (#20676457)
I loved Ruby, but unfortunately it didn't hold on to any kind of "killer app" role after Rails clones showed up in other language. I've switched to Elixir/Phoenix in that space and not looked back.

With the rise in ML and data science over the past years, Python finally has a killer app that no other scripting languages come close to touching. I migrated completely from Ruby when I started dabbling in ML, Pandas, etc.

Re:Python Is Eating the World by x3n0ph3n3 on Monday August 12, 2019 @01:58AM (#20672814)
From personal experience, hiring for Ruby development seemed to get a lot harder and of the few candidates that applied, many couldn't do FizzBuzz.
Re:Python Is Eating the World by pmontra on Monday August 12, 2019 @04:02AM (#20673437)
I've been working since the 90s and I never attempted to do FizzBuzz. Is it really relevant? Maybe to screen junior developers out of college?
Re:Python Is Eating the World by estsauver on Monday August 12, 2019 @04:55AM (#20673684)
So, as someone who spends maybe 20% of their time hiring, it's still a very effective screen. You wouldn't believe how many people can't do it. People at big companies, respected places. It's surprising.
Re:Python Is Eating the World by mooreds on Monday August 12, 2019 @05:42AM (#20673901)
Wow, that's depressing.

I used a different screen (having people make change based on an arbitrary amount, so if the input was 81, you'd return [25, 25, 25, 5, 1], as we were in the USA) and it was also helpful. I didn't track the number of people that it stymied though.

Re:Python Is Eating the World by t0mbstone on Friday August 23, 2019 @12:30PM (#20779240)
That sounds like a really fun one, and isn't dependent on people knowing about the modulus operator (which is rarely used)
Re:Python Is Eating the World by estsauver on Monday August 12, 2019 @09:54AM (#20675392)
Yah, that's also a good one. I like the variant that asks how many different ways you can make change for a given amount and a given array of currencies.

(I always feel weird talking about interview questions publicly, but honestly anyone who prepares that diligently deserves to go to the next stage. If anyone's reading this because they're preparing for an interview with me and I ask this question, just mention this comment and I'll be impressed.)

Re:Python Is Eating the World by singletoon on Friday August 23, 2019 @06:03PM (#20783136)
Correct me if i 'm wrong, isn't this one 'for' loop with 3 nested 'if' conditions ?
Re:Python Is Eating the World by x3n0ph3n3 on Monday August 12, 2019 @01:50PM (#20677973)
If someone can't do FizzBuzz, I'm not going to waste an hour interviewing. I get a surprising number of non new-college grads failing to do it.
Re:Python Is Eating the World by TomK32 on Monday August 12, 2019 @02:42AM (#20673008)
OTOH I couldn't find a Ruby job in my town. Learning Scala these days.
Re:Python Is Eating the World by pmontra on Monday August 12, 2019 @04:00AM (#20673428)
I love Ruby but my customers are with Python and Elixir now. I do Ruby 5 to 10% of the time. Nearly all my personal project except some Node.
Re:Python Is Eating the World by PikachuEXE on Monday August 12, 2019 @01:40AM (#20672736)
I think many people still "love" ruby I never liked Python from day 1 of my work (I am Ruby on Rails Dev for my job)

Wish there are more useful projects written in ruby :)

Re:Python Is Eating the World by fellellor on Monday August 12, 2019 @07:46AM (#20674493)
I am trying to find a place in the industry - again, starting from RoR. I absolutely love Ruby. And all this talk of "Ruby dying" makes me feel sad. The rational thing to do is to move on, and learn something popular, like node.js but the more I see Ruby in action, I just can't pull myself away from it.

I had managed to get a job as a Java developer a long time ago, but at that time all I could do was barely write toy apps in Java and I had no exposure to stuff like design patterns. The whole experience left me in a bad place. Now after all these years, Ruby feels like a breath of fresh air, and the texts that I have come across on the subject - Design Patterns in Ruby, Practical OOD in Ruby, Ruby under a Microscope etc. have increased my interest in the language.

But more and more frequent articles on Ruby's decline are pretty disheartening.

Re:Python Is Eating the World by jhbadger on Monday August 12, 2019 @09:59AM (#20675451)
Ruby's future may actually not be Ruby itself. Probably the major problem with Ruby is its performance, which is slow even compared to other interpreted languages. While I'm not sure it is really production ready yet, Crystal is very interesting -- it's a native compiled statically typed language that nevertheless feels very much like Ruby. Check it out if you haven't.
Re:Python Is Eating the World by fellellor on Tuesday August 13, 2019 @10:39AM (#20686262)
I saw Tenderlove's interview on SE Radio, about Ruby internals. He seemed optimistic, but also because he's been working on a performance related project for the past few years now. Anyway, I'm hopeful.
Re:Python Is Eating the World by jbverschoor on Monday August 12, 2019 @12:30PM (#20676978)
It’s faster than python. And crystal is often faster than go.
Re:Python Is Eating the World by StavrosK on Monday August 12, 2019 @05:24AM (#20673783)
Python's Poetry also addresses these issues.
Re:Python Is Eating the World by marmada on Monday August 12, 2019 @12:55AM (#20672533)
Python is uniquely ill-suited for dependency management compared to many other languages. For some reason dependencies are installed into the interpreter itself (I know what I just said is very imprecise/inaccurate but I think it gets the point across).

In JS, which also has a single interpreter installed across the system (or multiple if you use nvm), the packages aren't installed "directly" into the interpreter, which removes the need for things like virtual-envs, thus making life a lot easier. I wish Python did something like this.

That being said, pipenv is making things easier. However, I think pipenv is a workaround more fundamental problems.

Re:Python Is Eating the World by icebraining on Monday August 12, 2019 @04:07AM (#20673460)
Not trying to defend Python, but it's not hard to make it work like JS without virtualenv:

    pip install -r requirements.txt --target=python_modules
Then to run:

    PYTHONPATH=python_modules python myscript.py
This will keep all the dependencies in the local "python_modules" directory. I've used this on a custom SaaS platform, and it worked quite well.
Re:Python Is Eating the World by StavrosK on Monday August 12, 2019 @05:25AM (#20673792)
Also, that's more or less what virtualenv does. It would be nice if this was default, but IIRC it's coming.
Re:Python Is Eating the World by mark_l_watson on Monday August 12, 2019 @08:35AM (#20674801)
Thanks for that! I am tired of messing with conda, virtualenv, etc. and since I use simple Makefiles to build and run most of my code, I can easily stick with the standard latest stable version Python installation when using your trick.

EDIT: a question: when I have to use Python, I like to break up my code into small libraries and make wheel files for my own use. How do you handle your own libraries? Do you have one special local directory that you build wheel files to and then reference that library in your requirements.txt files?

Re:Python Is Eating the World by icebraining on Monday August 12, 2019 @10:33AM (#20675750)
> How do you handle your own libraries? Do you have one special local directory that you build wheel files to and then reference that library in your requirements.txt files?

We didn't build wheels. We had a centralized git host (Gitlab, but any of them works) with all our libraries, and just added the git url (git+https://...) to the requirements.txt

Re:Python Is Eating the World by mark_l_watson on Monday August 12, 2019 @03:43PM (#20679163)
Even better, thanks.
Re:Python Is Eating the World by dehrmann on Monday August 12, 2019 @12:15AM (#20672374)
It's not a "model," but if you're able to 1) use fewer dependencies 2) use stable dependencies 3) use dependencies with fewer dependencies, it helps with dependency hell. I've even made commits to projects to reduce their dependency count.
Re:Python Is Eating the World by adrianN on Monday August 12, 2019 @12:24AM (#20672410)
I find rust with cargo and go with go-modules to be pretty nice to work with.
Re:Python Is Eating the World by RobertRoberts on Monday August 12, 2019 @12:26AM (#20672414)
Does it have to be?

I have found that I would rather code my own versions of some libraries so I have control over it. Even if there is some extra long term maintenance and some up front dev costs, it's paid off already a number of times.

Re:Python Is Eating the World by mark_l_watson on Monday August 12, 2019 @08:40AM (#20674841)
A little off topic, but this is why I really like a Common Lisp with Quicklisp: library dependencies are stored in a convenient location locally and the libraries I write can be treated the same way (with a trivial config change to add Quicklisp load paths to my own library project directories).
Re:Python Is Eating the World by itronitron on Monday August 12, 2019 @12:29AM (#20672421)
maven for java