TagStudio icon indicating copy to clipboard operation
TagStudio copied to clipboard

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

Open un-pogaz opened this issue 8 months ago • 3 comments

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:
    • [x] Windows x86
    • [ ] Windows ARM
    • [ ] macOS x86
    • [ ] macOS ARM
    • [ ] Linux x86
    • [ ] Linux ARM
  • Tested For:
    • [x] Basic functionality
    • [ ] PyInstaller executable

un-pogaz avatar Apr 11 '25 10:04 un-pogaz

Good addition overall imo

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

Computerdores avatar Apr 24 '25 16:04 Computerdores

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

un-pogaz avatar Apr 24 '25 17:04 un-pogaz

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.

Computerdores avatar Apr 24 '25 17:04 Computerdores