• Stars
    star
    223
  • Rank 175,004 (Top 4 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created about 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Framework files for use with popular python macadmin toolsets

python

A Python 3 framework that currently installs to /Library/ManagedFrameworks/Python/Python3.framework.

Please see Apple's documentation on file system basics for more information on the thought process here.

This is an intended replacement for when Apple removes /usr/bin/python (which is happening with the macOS 12.3 release Spring 2022)

Build Issues

At this time, it is required to build this version of python on an Intel macOS device.

Why should I use this instead of a package from python.org?

  • It comes with PyObjC and other modules useful for Mac admins pre-installed; making it more like the Apple Python it's intended to replace
  • It installs to a location less likely to be overwritten, removed, or modified by developers or power users who are also working with Python

Using interactively

After installing any of the packages, a symbolic link can be used within terminal for interactive Python sessions. At the time of this writing /usr/local/bin/managed_python3 points to /Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3

Using with scripts

It is currently recommended to point directly to symbolic link provided by the Python framework.

At the time of this writing /Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3 points to /Library/ManagedFrameworks/Python/Python3.framework/Versions/3.8/bin/python3.8

An example script would look like the following:

#!/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3

print('This is an example script.')

Other options to consider

zshenv global alias

If you are calling python within zsh scripts, adding a global alias to /etc/zshenv may be appropriate.

alias -g python3.framework='/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3'

For more information on this method, please see Armin Briegel's "Moving to Zsh" Part II and IV

Notes

To decrease complexity, only a single package may be installed at any given time on a machine.

Upgrades

While Python itself has its own update cadence and dot release schedule, it is likely that this package will have many updates as 3rd party libraries release their own updates, bug fixes and security enhancements. These packages should not break your workflow, but you should test your scripts prior to wide deployment to your devices.

Downgrades

Downgrades will not be supported by this repository.

pip

While pip is bundled in this framework, it is not recommended to install any external libraries into your frameworks folder outside of what comes with the package. If you need to use or test external libraries not present in the package, it is recommended to use a virtual environment or a tool like pyenv.

Pull requests can and are encouraged to be issued to the recommended packages requirements file.

Flavors of Python

We currently offer three versions of Python. You can chose which version suits your needs, however only the recommended package is built/signed/notarized.

No Customization

This is a Python.framework that contains everything from the official Python package and nothing more.

Many open source tools will not work with this, but it may be helpful for development purposes.

Minimal

This is a Python.framework that includes xattr and PyObjc - the original intent of Relocatable Python.

Tools that should work when using the "Minimal Flavor":

Recommended

This is a Python.framework that contains everything from "Minimal", and a few libraries that various well-known open source projects require.

Tools that should work when using the "Recommended Flavor":

Updating packages

This should be done in a clean virtual environment. After every Python package install, you can run pip freeze | xargs pip uninstall -y to cleanup the environment.

CI Job

To update the certificate, run base64 -i /path/to/certificate.p12 -o base64string and import that into the github secrets store and update the password secret as well.

Credits

These packages are created with two other open source tools:

Both are written by Greg Neagle. Thank you for your continued dedication to the macOS platform.

More Repositories

1

nudge

A tool for encouraging the installation of macOS security updates.
Swift
976
star
2

SplashBuddy

Onboarding splash screen for MDM and Automated Device Enrollment.
Swift
404
star
3

installapplications

A tool for dynamically using installapplication
Python
283
star
4

umad

A tool to help users with pre-existing devices enroll into MDM
Python
275
star
5

nudge-python

A tool to help users with pre-existing devices upgrade their OS version.
Python
215
star
6

escrow-buddy

A macOS authorization plugin that helps MDM administrators ensure valid FileVault keys are escrowed for all their Macs.
Objective-C
178
star
7

outset

Automatically process packages and scripts during boot, login, or on demand.
Swift
131
star
8

sofa

SOFA | A MacAdmin's Simple Organized Feed for Apple Software Updates
HTML
87
star
9

osquery-extension

An osquery extension for endpoint engineers
Go
87
star
10

nibbler

python pyobjc utility for macOS for displaying dialogs using .nib files
Python
82
star
11

SupportCompanion

macOS helper application designed to empower end-users
C#
41
star
12

jamf-pro-sdk-python

A client library for the Jamf Pro APIs and webhooks.
Python
40
star
13

sashay

DEPRECATED - Scrape caching server logs and send periodic reports
Python
37
star
14

munki-builds

22
star
15

docker-mwa2

Python
22
star
16

apple-status-api

Publish Apple service status notifications as a simple REST API
Python
20
star
17

dockset

It's like outset, but for your Dock
Python
17
star
18

macadmins.io

14
star
19

puppet-apple_package

Ruby
12
star
20

chef-cookbooks

Metarepo for all known macOS related Chef Cookbook repos
11
star
21

unfs3

Docker image for running unfs3, a user space NFS server
Shell
10
star
22

munkireport-php

Docker autobuild repo for Munkireport-PHP
PHP
10
star
23

puppet-macauthdb

Manage the OS X authorization database with puppet.
Ruby
9
star
24

postgres

Docker container for postgres that accepts remote connections from Docker IPs
Shell
9
star
25

ddm_examples

Examples of DDM on macOS for use with kmfddm
Makefile
8
star
26

puppet-xcode_tools

Puppet module to install the Xcode CLI Tools
Ruby
7
star
27

netboot-httpd

Docker container for serving netboot image over http. Use in combination with BSDPy
Nginx
7
star
28

puppet-launchd

Puppet
5
star
29

puppet-client_stdlib

Ruby
4
star
30

puppet-remotemanagement

Ruby
4
star
31

puppet-authpluginmech

A method of managing mechanisms for authorization plugins
Ruby
3
star
32

crypt-server-ldap

Python
3
star
33

puppet-sal_client

Configuration of a Sal client using Puppet
Puppet
2
star
34

docker-makecatalogs

Docker image that will run makecatalogs
Shell
2
star
35

whd

Docker container for WebHelpDesk
Shell
2
star
36

ddm_testing

Repo for working with MAOS-hosted test servers
2
star
37

ddm_infra

Example Repo for setting up a nanoMDM + kmfddm server.
Shell
1
star
38

macnamer

Docker image for Macnamer
Python
1
star
39

salWHD

Docker container for sal + Sal-WHDImport + JSSImport
Shell
1
star
40

puppet-gatekeeper

enables gatekeeper.
Ruby
1
star