Live data from Hacker News

Python Is Eating the World

zdnet.com

21–30 of 993 posts

Re: Python Is Eating the World

#22
post #5

Earlier quoted context omitted.

Use Conda envs!

I feel uncomfortable with the fact that people feel a third-party solution is the best way to solve this mess. It can also get messy when packages installed with pip, pip3, conda and apt are all entangled with one another in various ways.

... the same thing happens if you mix stuff in your usr/bin directory that isn't managed by your system package manager.

The solution is: don't mix your package environments. Use a conda environment. Just like in Linux, you'd use a container. If you wait for the Python steering committee to fix pip you'll be waiting a long time.

Re: Python Is Eating the World

#24
post #14
post #4

If only its package management were as easy as its syntax... I wish pip worked the same way as npm: -g flag installs it globally, otherwise it creates a local "python_modules" folder I can delete at any time. And optionally I can save the dependency versioning info to some package.json... Instead, pip is a nightmarish experience where it fails half the time and I have no idea where anything is being installed to and…

Here's a simple but less-than-completely-documented way to keep Python package management under control: 1. Don't install anything globally. Don't pip install --user, definitely don't sudo pip install. 2. For each project you want to work on, create a venv. Yes, there are tools for this, but the base venv tool is totally fine. (venv should be included in your Python, but a few distributors like Debian put it in a sep…

Herein lies my problem. If I want to start a Node project I run `npm init` and then `npm install --save` to my heart's content. If I somehow manage to mess it up I just delete node_modules/ and install again.

If I want to start a Python project I have to set up venv and remember to put relative paths in front of every command or else it'll run the system version. Sounds simple, but it's still something to always remember.

Re: Python Is Eating the World

#25
post #14
post #4

If only its package management were as easy as its syntax... I wish pip worked the same way as npm: -g flag installs it globally, otherwise it creates a local "python_modules" folder I can delete at any time. And optionally I can save the dependency versioning info to some package.json... Instead, pip is a nightmarish experience where it fails half the time and I have no idea where anything is being installed to and…

Here's a simple but less-than-completely-documented way to keep Python package management under control: 1. Don't install anything globally. Don't pip install --user, definitely don't sudo pip install. 2. For each project you want to work on, create a venv. Yes, there are tools for this, but the base venv tool is totally fine. (venv should be included in your Python, but a few distributors like Debian put it in a sep…

$ source some/directory/bin/activate

And you don't need to keep typing out the full directory name. When done with the environment

$ deactivate

Re: Python Is Eating the World

#26
post #12

Considering Python can power the largest web sites (Netflix, Instagram), I don’t understand why there’s so much use of much more complicated platform/languages (eg java, .net)? Note: I am an amateur which is likely the reason for my ignorance.

You can do anything in anything. Everything boils down to trade offs for the problem or company at hand.

I can say with Java and .NET shops, it's usually because the company has heavily invested in Java and .NET infrastructure, process, automation, tooling, monitoring, etc. If there are certifications involved, I also know for a fact that Microsoft feeds big discounts on expensive products (SQL Server) depending on how many employees you have with Microsoft Certifications.

It becomes a self feeding system. You're already invested so much in the stack that the choice of using something else is far more complicated than language comparisons. It's one of the reasons that there are so many language options available that run on the JVM that can take advantage of all of that investment without forcing the devs to write raw Java (Groovy, Scala, Clojure, Kotlin, etc).

Re: Python Is Eating the World

#27
post #12

Considering Python can power the largest web sites (Netflix, Instagram), I don’t understand why there’s so much use of much more complicated platform/languages (eg java, .net)? Note: I am an amateur which is likely the reason for my ignorance.

Difficult problems remain difficult no matter what language you use.

Also, there's a real cost to everything being dynamically typed in large systems. Humans can't keep all the program types in their brain, and having the compiler help you out is kind of a big deal.

Re: Python Is Eating the World

#28
post #14
post #4

If only its package management were as easy as its syntax... I wish pip worked the same way as npm: -g flag installs it globally, otherwise it creates a local "python_modules" folder I can delete at any time. And optionally I can save the dependency versioning info to some package.json... Instead, pip is a nightmarish experience where it fails half the time and I have no idea where anything is being installed to and…

Here's a simple but less-than-completely-documented way to keep Python package management under control: 1. Don't install anything globally. Don't pip install --user, definitely don't sudo pip install. 2. For each project you want to work on, create a venv. Yes, there are tools for this, but the base venv tool is totally fine. (venv should be included in your Python, but a few distributors like Debian put it in a sep…

Also: set PIP_REQUIRE_VIRTUALENV=true

You won't be able to install with pip unless you are in a virtualenv.

Re: Python Is Eating the World

#29

Definitely EVE Online's MMO secret weapon is Python: https://www.eveonline.com/article/stackless-python-2.7 - as well as its numerous ecosystem utilities like Pyfa, Evernus, used by tens of thousands per day.

I would not use Eve-Online as an example of performance.

Once it gets to a few thousand concurrent users they have to drastically slow down the server tick rate. It's like playing a turn-based strategy game at that point.

*Disclaimer: I quit Eve awhile ago.

Re: Python Is Eating the World

#30
post #4

If only its package management were as easy as its syntax... I wish pip worked the same way as npm: -g flag installs it globally, otherwise it creates a local "python_modules" folder I can delete at any time. And optionally I can save the dependency versioning info to some package.json... Instead, pip is a nightmarish experience where it fails half the time and I have no idea where anything is being installed to and…

Exactly. NPM gets a lot of hate but lockfiles and local install by default is great. The default mode should not be global installation. Also imo virtual environments aren't amazing. Having some mode you have to remember to flip on that changes essentially the semantics of your pip commands seems a little brittle. Tools that work on top of pip and venv like Pipenv or Poetry seem a lot better.
Post reply on HN