Skip to content

build: Minor improvements to PyInstaller. #895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2025
Merged

Conversation

Leonard2
Copy link
Contributor

Summary

Minor changes to pathex and datas

Tasks Completed

  • Platforms Tested:
    • Windows x86
    • Windows ARM
    • macOS x86
    • macOS ARM
    • Linux x86
    • Linux ARM
  • Tested For:
    • Basic functionality
    • PyInstaller executable

Léonard added 2 commits March 30, 2025 10:17
Instead of having to pre-install tagstudio, this will have PyInstaller directly build it from source.
Since PyInstaller builds from source now there is no need to manually add it.
@CyanVoxel CyanVoxel added Type: Refactor Code that needs to be restructured or cleaned up Type: Installation Installing, building, and/or launching the program labels Mar 30, 2025
@CyanVoxel
Copy link
Member

Could you explain why you made these changes and what they improve upon?

@Leonard2
Copy link
Contributor Author

As far as I could gather, when PyInstaller processes an import within a script passed to it, it will look directly into your sys.paths for the dependency (including TagStudio itself).
This means that if you didn't "pip install .", PyInstaller will just throw a bunch of errors about being unable to find the "TagStudio" module.
As such the correct way to handle this is to add the source itself to the sys.path while compiling (that being the pathext field's purpose).
This can even be seen in the documentation example:
vivaldi_re1uD0KfvQ

Following this logic, we also do not need to add the raw source py files to the "datas" field as the TagStudio module is simply processed like the rest of the dependencies and compiled to bytecode into the executable.

@CyanVoxel CyanVoxel added this to the Alpha v9.5.2 milestone Mar 31, 2025
@CyanVoxel CyanVoxel moved this to 👀 In review in TagStudio Development Mar 31, 2025
Copy link
Member

@CyanVoxel CyanVoxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, the changes seem to be follow the PyInstaller docs nicely. Thank you for this!

(Tested in builds on macOS 15 and Windows 10)

@CyanVoxel CyanVoxel merged commit 27fb54e into TagStudioDev:main Mar 31, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in TagStudio Development Mar 31, 2025
@Leonard2 Leonard2 deleted the 2 branch March 31, 2025 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Installation Installing, building, and/or launching the program Type: Refactor Code that needs to be restructured or cleaned up
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants