Earlier quoted context omitted.
Python's package management is OK. The main culprit is .so libraries Think JNI or cgo management.
It is not okay (maybe uv fixes this?)
I'm switching to Python and actually liking it
531–540 of 718 posts
Re: I'm switching to Python and actually liking it
#532Earlier quoted context omitted.
> making it harder for yourself Looking at just the first link, looks way more complicated than venv. And I'm a C++ developer, imagine someone who less experienced, or even who just isn't familiar with C toolchains.
The first link is a sudo apt install command that you copy paste into terminal. in what world is that more complicated than venv? Here it is for clarity sudo apt-get install build-essential gdb lcov pkg-config \ libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \ libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \ lzma lzma-dev tk-dev uuid-dev zlib1g-dev libmpdec-dev libzstd-dev
venvs also aren't complicated.
I have built Python from source before, many times. I do it to test Python version compatibility for my code, investigate performance characteristics etc.
Re-building the same version of Python, simply in order to support a separate project using the same version with different dependencies, is a huge waste of time and disk space (hundreds of MB per installation, plus the mostly-shared dev dependencies). Just make the virtual environment. They are not hard to understand. People who want a tool to do that understanding for them are welcome to waste a smaller amount of disk space (~35MB) for uv. A full installation of pip weighs 10-15MB and may take a few seconds; you normally only need one copy of it, but it does take some work to avoid making extra copies.
Re: I'm switching to Python and actually liking it
#533Earlier quoted context omitted.
This is nitpicking, but this is a good usecase for the := operator: if not (API_KEY := os.getenv("API_KEY")): ... For internal tools I just let os.environ["API_KEY"] raise a KeyError. It's descriptive enough.
no one uses walrus
Re: I'm switching to Python and actually liking it
#534> the Python interpreter is natively integrated in all Unix distros It's included in the default install of most desktop/server Linux distros (with plenty of exceptions), but I don't believe any of the BSDs ship it in their base system. IIRC macOS used to have python 2 in its default install, but I vaguely recall that being deprecated and removed at some point. My only Mac is on the other side of the country at the m…
Python 2 was removed in Monterey 12.3, which was incredibly stupid and disruptive as it caught everyone by surprise. We all knew Apple said they would remove it, but everyone was expecting them to be sensible and do it on a new major OS release, like they did with PHP, not mid-cycle. https://developer.apple.com/documentation/macos-release-note... I wonder if that kerfuffle is why they ended up not removing Ruby and P…
Re: I'm switching to Python and actually liking it
#535More seriously: it's fascinating and interesting to see how closely this article mirrors my own Python project layout. The tools and practices have come a long way over the last decade and good developer standards have a way of becoming the defacto in organic fashion.
IMO uv has won the race to be the new standard for Python environment management (Poetry gave it a solid try, but lost on speed).
Re: I'm switching to Python and actually liking it
#536Earlier quoted context omitted.
Technically macOS doesn’t come with Python pre-installed, but it does provide you with a simple path to do it. https://news.ycombinator.com/item?id=44580198 The removal was in Monterey. Catalina and its successor Big Sur very much still had it. Catalina was the one that removed 32-bit support.
I think they realised the security implications, you could just take a random person macbook, open the terminal and launch python3 -m http.server 3000 --directory ~ then on the local network you could download all his files
Re: I'm switching to Python and actually liking it
#537Earlier quoted context omitted.
This is nitpicking, but this is a good usecase for the := operator: if not (API_KEY := os.getenv("API_KEY")): ... For internal tools I just let os.environ["API_KEY"] raise a KeyError. It's descriptive enough.
no one uses walrus
Re: I'm switching to Python and actually liking it
#538> I would like to have a tool that generates the project structure for me, but I haven’t found one that fits me yet. I recommend cookiecutter for this. I have a few templates I've built with that which I use frequently: python-lib: https://github.com/simonw/python-lib click-app: https://github.com/simonw/click-app datasette-plugin: https://github.com/simonw/datasette-plugin llm-plugin: https://github.com/simonw/llm-p…
I'm not a huge fan of cookiecutter on aesthetic principles, though. I think it's chosen some needlessly heavyweight dependencies for such a simple task. PyYAML comes with a big chunk of compiled C, while performance is really not going to matter and I'd rather use TOML anyway. I've yet to see a project depending on Rich that uses more than a tiny portion of it; this is no exception. More to the point, Rich brings in the much larger Pygments (for syntax highlighting; most of the bulk is actual syntax definition rules for a variety of programming languages) and you can't disable that. And honestly I'm not a fan of the whole "download other people's templates using an integrated client" model anyway; Requests and its dependencies are pretty bulky, too.
Re: I'm switching to Python and actually liking it
#539Earlier quoted context omitted.
One of my colleagues, a retired programmer who spent 20 years at Microsoft, told my students that it used to be Java vs Visual Basic, until Microsoft brought in the big guns, like Anders Hejlsberg. That's when it turned into Java vs .NET, and things really started to heat up :)
Java unequivocally won the war, though.
Re: I'm switching to Python and actually liking it
#540Earlier quoted context omitted.
I write a decent amount of Python, but find the walrus operator unintuitive. It's a little funky that API_KEY is available outside of the `if`, perhaps because I had first seen the walrus operator in golang, which restricts the scope to the block.
Wow. I had been writing Python for 15 years and I didn't even know that operator exists
The last time I wrote Python in a job interview, one of the interviewers said "wait, I don't know Python very well but isn't this kinda an old style?" Yes, guilty. My Python dates me.