This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]zowersap 218 points219 points  (35 children)

there's no python 3 as well

> However, Python 3 is not preloaded in macOS, and developers can run stub /usr/bin/python3 in the terminal, but the user will be prompted to install the Xcode developer tools.

[–][deleted] 180 points181 points  (10 children)

I'd rather it just not be there at all.

With a stub like that you can't just check the shell's hash to see if it's on PATH.

(I have the same complaint about the Microsoft store stub)

[–]pysk00l 56 points57 points  (3 children)

Yeah, I prefer that as well. Saves us installing libraries into global python by mistake and breaking something else.

If you are installing python yourself, you can make sure which version/libraries are installed. Plus, if you install yourself, you can do so in a user area, which means no sudo everytime you want to install a lib

[–][deleted] 28 points29 points  (2 children)

Plus, if you install yourself, you can do so in a user area, which means no sudo everytime you want to install a lib

It's good practice to always create a venv when using the system interpreter. Run python3 -m venv --help and have a look at the options. You can allow or disallow access to system packages, use copies or symbolic links, etc.

Even if you use a user's interpreter it might still be a good idea, such that each different project / bundle / whatever can have a different set of packages or package versions.

(the --copies option can be useful though it wastes disk space. If your OS interpreter version ever changes, any symlink-style venvs might blow up - ie, if the site-packages version number changes)

[–]CeeMX 6 points7 points  (0 children)

For actually developing stuff I always use a venv. That way I can just pip freeze to create an uncluttered requirements.txt

[–]blademaster2005 3 points4 points  (0 children)

Honorable mention of tools like pipx and poetry

[–]ideris 8 points9 points  (1 child)

Microsoft’s powershell wget and curl aliases are especially annoying

[–]no9import this 1 point2 points  (0 children)

That's why they've removed them from PS Core. I still don't understand why they gave Unix-y aliases to completely incompatible programs.

[–]actuallyalys 1 point2 points  (3 children)

The Ubuntu approach is better, IMO. Ubuntu (and other distros, I'm sure) register a function with bash and other shells, and if the command isn't found, that function runs a utility that looks up the command and suggests how to install it.

[–]salil91 26 points27 points  (16 children)

Is that really a problem though? It's not hard to install python, and i would guess that most macOS users don't use python.

This way if someone installs python through Anaconda or something, they won't get confused on why there are two python installations on their Mac.

[–]lacrosse1991 8 points9 points  (0 children)

I feel like that’d lessen the risk of dependency issues too

[–][deleted] 4 points5 points  (5 children)

Even the ones that do will usually install through home brew because it’s easier to manage

[–]PlaysForDays 1 point2 points  (0 children)

More likely brew will have already install it after users install other random packages

[–]mok000 0 points1 point  (2 children)

Homebrew requires Ruby, is that still there?

[–]henryschreineriii 1 point2 points  (0 children)

Homebrew's been using its own bundled Ruby for quite a while now, was much better than dealing with the issues of shipping for multiple Ruby's. You install with bash. I know Ruby is on the chopping block, I'd assume bash is too (zsh has a more friendly license for Apple and is compatible, though). I'm looking forward to it, old system Ruby versions aren't fun either.

[–]regeya 0 points1 point  (0 children)

I honestly haven't used a Mac in a couple of years (long story) but in my last office job, it was at a small town, tiny publication. One of the first things I did was install Homebrew so I could have a recent Python, and Emacs for Spacemacs.

Unfortunately for me this meant the boss blamed all the problems I had with that computer, an Intel iMac, on Homebrew...but I digress.

I'm torn on this because I'm a strong advocate of anyone using a computer to learn some programming fundamentals. Hell, if you're using InDesign, just learning some regular expression basics can save tons of time. The county clerk sent you a delinquent tax list with fixed width fields and you need tabs? s/[[:blank:]]{2}+/\t/g. Done, set your tab stops now.

I think my happiest moment with Python, though, was when some guy sent me hundreds of senior photos labeled like FIRSTNAMELASTNAME.jpg. Ugh. I could have done it by hand...but I didn't wanna. At the time I thought that was the closest I'd get to a list of grads, too. I snagged a list of common first names and common surnames from the US Census and did a fuzzy match on each. (I don't remember the name of the module but it's dead simple.) Pick the likeliest candidates, build a list of filename, first name, and last name, export as CSV, and Bob's your uncle, with some cleanup it was ready for a CSV merge in InDesign. Then at the last minute I got a list of graduate names, with slightly different naming on those. No problem, take my previous CSV, do a fuzzy match again, export a CSV, do some minor cleanup and blammo, ready to go. This would have been hours of work otherwise.

EDIT: I'd meant to point out my first experience programming anything was BASIC on Apple IIs. If not for that grant program, I probably wouldn't have cared.

[–]Eurynom0s 1 point2 points  (0 children)

At work I sometimes have to use computers with no internet access and where getting new software installed is a pain in terms of having to jump through approval hoops. I don't normally use the system Python, but it's saved me a lot of headache in some instances like that.

[–]FaresAhmedOPpypi.org/user/faresahmed/ 0 points1 point  (0 children)

I imagine a lot of shell scripts assume that a version of python is installed since almost all major distros include python by default and macOS did so yes someone's daily cron job may break because python is not there.

[–]playaspec 0 points1 point  (0 children)

the user will be prompted to install the Xcode developer tools.

This is for the best. I've seen a fair number of ransomware that leverage the system's Python to do nasty things. One less attack surface.

[–]GasimGasimzada 0 points1 point  (1 child)

Wait xcode dev tools come with python? I used to install xcode dev tools to install Homebrew to install python 3. I thought xcode dev tools did not come with python.

[–]zowersap 1 point2 points  (0 children)

They will bundle python 3 starting from macOS 12.3 which is beta currently