Python vs Swift for macOS CLI tool?

We have an in-house CLI tool built entirely in Python to help us with OS-level workflows. It’s been excellent, but we’re encountering some growing pains.

We’ve encountered a case where we’d like to use Apple’s Authorization Plugin, which we can’t directly utilize in Python.

Since I doubt this’ll be the last time we encounter Swift or Obj-C specific tools, I’m starting to wonder if a total rewrite into Swift might be in order.

Alternatives include writing a wrapper in Swift just for the Auth Plugin, exposing an API that we’ll consume in Python.

Since this will only ever be a macOS, tool, I’m starting to feel like going with Python was a dumb idea in the first place.

Would love to know what you guys think.

p.s.

I was advised to post my question on these forums in hopes of being graced by the Apple god Quinn, “The Eskimo”.

Sounds wise to rewrite this in Swift.

And I guess an LLM can probably help you translate the Python code to Swift 6 fairly easily?

We’ve encountered a case where we’d like to use Apple’s Authorization Plugin

Something doesn’t quite line up here. In general, you don’t use an authorisation plug-in from standard user-context code, like a script. Rather, an authorisation plug-in is something that you install into the system. The system then invokes it when some code — possibly code that you write but most commonly a system component, like the login UI — invokes an Authorization Services call like AuthorizationCopyRight.

So, can you explain more about how you intend to put these parts together? Because if you plan to create an authorisation plug-in then, yeah, you’ll have to use Swift. OTOH, if you just want to invoke the plug-in, it should be feasible to call Authorisation Services from Python.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Python vs Swift for macOS CLI tool?
 
 
Q