Skip to content

feat: add minimalist "__main__.py" to 'tagstudio' module #912

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

un-pogaz
Copy link

Summary

Adding a minimalist __main__.py to tagstudio module to explicitly define the entry point, and so that TagStudio can be run directly from python -m tagstudio.

Tasks Completed

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

@Computerdores
Copy link
Collaborator

Computerdores commented Apr 24, 2025

Good addition overall imo

Nit: Wouldn't it be better to just rename main.py to __main__.py?

@un-pogaz
Copy link
Author

No, it will be a breaking change. This PR is just a bypass to be compliant with the python standard.

@Computerdores
Copy link
Collaborator

Computerdores commented Apr 24, 2025

No, it will be a breaking change.

Technically true, however, starting TS directly from this file is, to my knowledge, not intended anyways, see the wiki:

TagStudio can now be launched via the tagstudio command in your terminal.

As long as tagstudio.spec and pyproject.toml are adjusted accordingly (both 1 line changes) nothing should change for the vast majority users and even for those users (or devs) where something does change, the effort to fix it is miniscule.

And so because I see no value in having two "main" files around and because the impact on users would be miniscule, I would still advocate for renaming main.py all together.

@CyanVoxel CyanVoxel added the Type: Refactor Code that needs to be restructured or cleaned up label Apr 24, 2025
@CyanVoxel CyanVoxel moved this to 👀 In review in TagStudio Development Apr 24, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Type: Refactor Code that needs to be restructured or cleaned up
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

3 participants