Skip to content

Conversation

@pmeulen
Copy link

@pmeulen pmeulen commented Aug 2, 2025

This PR contains:

  • A .spec file for a onedir pyinstaller build tested on OSX (arm64)
  • A github action that creates a release, triggered by a tag or manually to create a snapshot release

See https://github.com/pmeulen/Writingway/releases/tag/0.14.0 for an example release.

I started this because I had trouble installing on OSX Mx (ARM) because the portaudio dependency that was missing for pyaudio. Used macports to provide the portaudio dependency. This works for me.
The .spec file and github action should be adaptable to other platforms as well.

pmeulen added 2 commits August 2, 2025 20:55
- Dependencies are in the  _internal directory.
- Assets and other files required by Writingway must be in the application root, used a custom copy action to accomplish this as this seems impossible with standard pyinstaller spec configuraton.
- Project files and settings are in the application root. This is not what a user would expect from a packaged application.
- Run manually for a snapshot build
- Set a tag to trigger a release
- Uses macports to provide the portaudio dependency for pyaudio
- Adds installation instructions
- Uses the softprops/action-gh-release. The action is configured so that when rerun with the same tag new assets are added to the release so packes for other platform can be added to the same release.
@stump-wiz stump-wiz self-assigned this Aug 12, 2025
@stump-wiz
Copy link
Collaborator

I think I'm the only contributor here running on MacOS, so I'll own reviewing this. Unfortunately, .spec and onedir are new to me, and I already have portaudio installed via homebrew. It may take some time for me to understand this.

@pmeulen
Copy link
Author

pmeulen commented Aug 12, 2025

There's two commits in the PR.

The first is for using pyinstaller to make a one-dir type installer for OSX: 7dcf411
You can run pyinstaller locally (from the venv) with pyinstaller pyinstaller/Writingway_osx.spec and this should work. portaudio is used only when compiling pyaudio AFAIK and pyinstaller should find the required pyaudio dependencies and include them. If not, that requires more work in the spec file.

My pyinstaller experience is with smaller projects only not with PyQt and these huge LLM libs. So this needs testing on different version of OSX, and also "clean" systems without homebrew / macports.

one-dir is the most practical choice IMO fox OSX:

  • It's startup time is much faster as the onefile extracts everything to a temp location each time the application starts.
  • You see what the file/directory structure is like.
  • Downside is that one-dir it's bigger than one-file, I don't know why, I should contain the same contents, but it compresses better for some reason.

With some changes to Writingway both one-dir and one-file should work fine. The issue with one-file now is that Writingway expects assets and configuration files relative to a working directory, and one-file has a different directory layout.

I added code to the specfile to copy some files to the root dir (not supported by pyinstaller) because that is what Writingway expects now. It makes sense to make Writingway more flexible in that regard. That code can be removed then and all you have is a standard .spec file like you could generate with pyinstaller command line arguments.

The second commit is the github action that builds the release on GitHub infra: 262da27

  • It can be started manually or trigged by a git tag. It is setup such that if you have multiple of these, the assets will be merged in one release so you can add one for other platforms (windows, linux) too.
  • I chose macports to get the portaudio dependency because that provides universal builds, however I found that universal builds of portaudio are broken at the moment because of an issue in portaudio. There's a fix, bit it's not been released yet. Other than that building using homebrew should work fine as well if you adjust the include paths (262da27#diff-9e217561a9f3e8334a11ead8ae13ac9bea3293649e29e64928ac6271a8c6e432R45-R46) for building pyaudio to what homebrew provides.

I can split the PR in two, one for each commit if your prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants