Skip to content

Commit 65f8a59

Browse files
committed
Update README for Apple Silicon, single-flavor build
1 parent 49212b4 commit 65f8a59

1 file changed

Lines changed: 26 additions & 54 deletions

File tree

README.md

Lines changed: 26 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,64 @@
11
# python
2-
A Python 3 framework that currently installs to `/Library/ManagedFrameworks/Python/Python3.framework`.
2+
A Python 3 framework that installs to `/Library/ManagedFrameworks/Python/Python3.framework`.
33

4-
Please see Apple's documentation on [file system basics](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html) for more information on the thought process here.
4+
Please see Apple's documentation on [file system basics](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html) for context.
55

6-
This is an intended replacement for when Apple removes `/usr/bin/python` (which is happening with the macOS 12.3 release Spring 2022)
6+
This is an intended replacement for `/usr/bin/python`, which Apple removed in macOS 12.3 (Spring 2022).
77

8-
## Build Issues
9-
At this time, it is required to build this version of python on an Intel macOS device.
8+
## Apple Silicon Only
9+
Builds and packages target Apple Silicon (arm64). Universal2 outputs are no longer produced. Build hosts and target machines must be Apple Silicon Macs.
1010

11-
## Why should I use this instead of a package from python.org?
12-
- 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
13-
- It installs to a location less likely to be overwritten, removed, or modified by developers or power users who are also working with Python
11+
## Why use this instead of a package from python.org?
12+
- Ships with PyObjC and other modules useful for Mac admins, similar in spirit to the Apple Python it replaces
13+
- Installs to a location less likely to be overwritten, removed, or modified by other Python installations
1414

1515
## Using interactively
16-
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`
16+
After installing the package, `/usr/local/bin/managed_python3` is a symlink to `/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/Resources/Python.app/Contents/MacOS/Python`.
1717

1818
## Using with scripts
19-
It is currently recommended to point directly to symbolic link provided by the Python framework.
20-
21-
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`
22-
23-
An example script would look like the following:
19+
Point your shebang directly at the symlink:
2420

2521
```
2622
#!/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3
2723
2824
print('This is an example script.')
2925
```
3026

31-
### Other options to consider
32-
#### zshenv global alias
33-
If you are calling `python` within `zsh` scripts, adding a global alias to `/etc/zshenv` may be appropriate.
27+
### zshenv global alias
28+
For zsh scripts you can add a global alias to `/etc/zshenv`:
3429

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

37-
For more information on this method, please see Armin Briegel's "Moving to Zsh" Part [II](https://scriptingosx.com/2019/06/moving-to-zsh-part-2-configuration-files/) and [IV](https://scriptingosx.com/2019/07/moving-to-zsh-part-4-aliases-and-functions/)
32+
See Armin Briegel's "Moving to Zsh" Part [II](https://scriptingosx.com/2019/06/moving-to-zsh-part-2-configuration-files/) and [IV](https://scriptingosx.com/2019/07/moving-to-zsh-part-4-aliases-and-functions/).
3833

3934
## Notes
40-
To decrease complexity, only a _single_ package may be installed at any given time on a machine.
35+
Only a single package may be installed at any given time. The preinstall script removes any previous framework.
4136

4237
### Upgrades
43-
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.
38+
Python itself has its own release cadence; this package will see additional updates as 3rd-party libraries release fixes and security updates. Always test your scripts before deploying broadly.
4439

4540
### Downgrades
46-
Downgrades will not be supported by this repository.
41+
Not supported.
4742

4843
### pip
49-
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](https://docs.python.org/3/library/venv.html) or a tool like [pyenv](https://github.com/pyenv/pyenv).
50-
51-
Pull requests can and are encouraged to be issued to the `recommended` packages requirements file.
52-
53-
# Flavors of Python
54-
We currently offer three versions of Python. You can chose which version suits your needs, however only the `recommended` package is built/signed/notarized.
55-
56-
## No Customization
57-
This is a Python.framework that contains everything from the official Python package and nothing more.
44+
`pip` is bundled but **not recommended** for installing external libraries into the framework. Use a [virtual environment](https://docs.python.org/3/library/venv.html) or a tool like [pyenv](https://github.com/pyenv/pyenv) instead. Pull requests to the `recommended` requirements file are welcome.
5845

59-
Many open source tools will not work with this, but it may be helpful for development purposes.
46+
# Building locally
47+
Build an unsigned framework on Apple Silicon with:
6048

61-
## Minimal
62-
This is a Python.framework that includes `xattr` and `PyObjc` - the original intent of [Relocatable Python](https://github.com/gregneagle/relocatable-python).
63-
64-
Tools that should work when using the "Minimal Flavor":
65-
- [vfuse](https://github.com/chilcote/vfuse)
66-
- [dockutil](https://github.com/kcrawford/dockutil) (Python 3 pull request [here](https://github.com/kcrawford/dockutil/pull/87))
67-
- [outset](https://github.com/chilcote/outset)
68-
69-
## Recommended
70-
This is a Python.framework that contains everything from "Minimal", and a few libraries that various well-known open source projects require.
49+
```
50+
./build_python_framework_pkgs.zsh --python-version 3.13.13
51+
```
7152

72-
Tools that should work when using the "Recommended Flavor":
73-
- [Autopkg](https://github.com/autopkg/autopkg)
74-
- [InstallApplications](https://github.com/macadmins/installapplications)
75-
- [Munki](https://github.com/munki/munki)
76-
- [munkipkg](https://github.com/munki/munki-pkg)
77-
- [munki-facts](https://github.com/munki/munki-facts) (python 3 pull request [here](https://github.com/munki/munki-facts/pull/17))
78-
- [Nudge](https://github.com/macadmins/nudge)
79-
- [UMAD](https://github.com/macadmins/umad)
53+
Pass `--installer-id`, `--application-id`, and `--notary-password` to produce a signed and notarized `.pkg`.
8054

8155
# Updating packages
82-
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.
56+
Do this in a clean virtual environment. After every Python package install, run `pip freeze | xargs pip uninstall -y` to reset the environment.
8357

8458
# CI Job
85-
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.
59+
To update the signing certificate, run `base64 -i /path/to/certificate.p12 -o base64string` and import it into the GitHub Actions secrets store along with the matching password.
8660

8761
# Credits
88-
These packages are created with two other open source tools:
62+
Built on two open-source tools by [Greg Neagle](https://www.linkedin.com/in/gregneagle/):
8963
- [relocatable-python](https://github.com/gregneagle/relocatable-python)
9064
- [munki-pkg](https://github.com/munki/munki-pkg)
91-
92-
Both are written by [Greg Neagle](https://www.linkedin.com/in/gregneagle/). Thank you for your continued dedication to the macOS platform.

0 commit comments

Comments
 (0)