Live data from Hacker News

Python Is Eating the World

zdnet.com

51–60 of 993 posts

Re: Python Is Eating the World

#51
post #44
post #42

Earlier quoted context omitted.

>Most people just cross their fingers and hope dependencies don't change Is there anything wrong with pip freeze > requirements.txt and then pip install -r requirements.txt ? This would install the exact versions

I think he is referring to indirect dependencies

>>> Why isn't there any builtin way to automatically define a lock file

pip isn't actually part of Python proper.

Re: Python Is Eating the World

#52
post #14

Earlier quoted context omitted.

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

I've grown to dislike activate, because it breaks the simple rule of "never run pip, python, etc., only run your-venv/bin/pip, python, etc.". Now the rule is "Don't run pip, python, etc., unless you've previously run activate and not deactivate" - and it has the complicated special case of "make sure the command exists in your virtualenv." (For instance, it's definitely possible to have a Python 2 virtualenv where pip exists but not pip3, and now if you run pip3 install from "inside" your virtualenv it's global pip! Or you might have a Python 3.6 virtualenv and type python3.7 and wonder where your packages went, or several other scenarios.)

If you have the shell prompt integration to remind you whether you're in a virtualenv or not, it's fine, but I don't always have it, and I find it helpful to manually type out the full directory name (generally with the help of up-arrow or tab...) so I know exactly what I'm running.

Re: Python Is Eating the World

#53
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.

A lot of stuff powered "by Python" is in practice powered by multi-language infrastructures, which can be pretty complex. For example, the Python ecosystem for data science is mostly implemented under the hood in a mix of C, C++, and Fortran, with high-level Python bindings, due to a mixture of legacy reasons and pure Python being too slow. Obviously lots of people still like the end result, but saying this kind of s…

Python is eating the world, just not digesting it.

Re: Python Is Eating the World

#54
post #44

Earlier quoted context omitted.

I think he is referring to indirect dependencies

Yes, those are caught when using pip freeze.

> Yes, those are caught when using pip freeze.

No they are not.

Pip freeze does not resolve transitive dependencies, nor does pip know what to do if your transitive dependencies conflict with each another.

Re: Python Is Eating the World

#55
post #33

Python has a lot of problems that really slow down development, but they are all fixable. The biggest issue, in my opinion, is in dependency management. Python has a horrible dependency management system, from top-to-bottom. Why do I need to make a "virtual environment" to have separate dependencies, and then source it my shell? Why do I need to manually add version numbers to a file? Why isn't there any builtin way…

One thing people overlook with interpreted languages is the environmental impact in terms of extra electricity used.

Re: Python Is Eating the World

#56
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.

> I don’t understand why there’s so much use of much more complicated platform/languages (eg java, .net)? What language is Python implemented in? Is it Python, or something else? This tells you that even the implementors of Python don't think Python is suited for everything.

You typically have to bootstrap your language in a different one. There are some languages that have since gone back and re-wrote the compiler or runtime engine in the same language (in those languages that need a runtime).

Re: Python Is Eating the World

#57
post #33

Python has a lot of problems that really slow down development, but they are all fixable. The biggest issue, in my opinion, is in dependency management. Python has a horrible dependency management system, from top-to-bottom. Why do I need to make a "virtual environment" to have separate dependencies, and then source it my shell? Why do I need to manually add version numbers to a file? Why isn't there any builtin way…

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

#58
post #33

Python has a lot of problems that really slow down development, but they are all fixable. The biggest issue, in my opinion, is in dependency management. Python has a horrible dependency management system, from top-to-bottom. Why do I need to make a "virtual environment" to have separate dependencies, and then source it my shell? Why do I need to manually add version numbers to a file? Why isn't there any builtin way…

I agree that builtin tools suck for dependency management.

However a lot of the issues that you mentioned (such as lock file and transitive dependencies) can be handled by pipenv, which should be the default package manager

Re: Python Is Eating the World

#59
post #43

Are there any good cloud solutions for developing in Python? I’ve been using Pythonista on the iPad but it doesn’t support numpy.

I use pythonanywhere. Seems to work well enough and isn’t expensive. Main problem I have with it is I cannot use Altair-viz in a Jupyter notebook because their notebook server is out of date.

Re: Python Is Eating the World

#60
post #23

Python and JavaScript Ease of use trumping advanced features every time

Ease of use and advanced features are not polar opposites.

I do a lot of geospatial work and Python bindings for GDAL [1] are godsend. In 10 lines of code, I can read shapes stored in different projections and file formats; load, reproject and merge them into an in-memory SQLite database; do all sorts of complex geospatial operations on them using spatial extensions, and save results to a file.

I'd spend half a day writing C++ code that Python abstracts away into very few commands. It's a joy to work with, and I struggle to see any downsides.

[1] https://en.wikipedia.org/wiki/GDAL

Post reply on HN