Skip to content
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

refactor!: restructure project to use proper src-layout #844

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

CyanVoxel
Copy link
Member

@CyanVoxel CyanVoxel commented Mar 7, 2025

Summary

This PR introduces a large refactor that moves files in order to properly align with what should be a proper "src-layout". A standard Python project layout is what was intended from the start of this project, but after a deeper level of research combined with a number of ongoing issues has made it clear that the current project structure is not only incorrect, but actively causes issues in a number of areas.

Changes

This PR introduces the following changes:

  • Restructured the project files to a standard (or close enough) src-layout
  • Removed old and unused build and start scripts
  • Moved requirements from requirements.txt and requirements-dev.txt to pyproject.toml and deleted the former files
  • Updated workflows to use to rely more on pyproject.toml along with other code de-duplication and improvments
  • Updated various code to comply with the new formatting and linting checks that arose as a result of correcting the project structure
  • Refactored the module import structure to begin with tagstudio in place of src
  • Replaced any relative module imports with absolute ones

Why?

This refactor fixes a number of longstanding issues while opening up the door for new development QoL features and Python-specific packaging.

  • IDEs should no longer be confused as whether or not to import local modules as tagstudio.src. or src.
  • Workflows can now read requirements and versions directly from the pyproject.toml instead of duplicating them in the workflow files and letting the versions get out of sync
  • MyPy is now able to detect additional issues due to the corrected project structure
  • Manual path overrides for MyPy are no longer required in configs
  • Dependency managers such as uv and Poetry 2.0 can be used by developers with no further requirements or maintenance overhead on our side
  • TagStudio can now be installed via pip, both for users and developers
  • TagStudio can now be packaged for NixOS

Tasks Completed

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

Closes #200, Closes #365, Closes #512, Closes #800

@CyanVoxel CyanVoxel added Type: Refactor Code that needs to be restructured or cleaned up Type: CI Continuous Integration / workflows Priority: High An important issue requiring attention labels Mar 7, 2025
@CyanVoxel CyanVoxel added this to the Alpha v9.5.2 milestone Mar 7, 2025
Copy link
Collaborator

@Computerdores Computerdores left a comment

Choose a reason for hiding this comment

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

Just a couple of nits.
What else are you planning to add before merging? Because this PR is quite big already (which is also why I went and reviewed this already despite still being a draft)

@xarvex
Copy link
Member

xarvex commented Mar 8, 2025

This became a big refactor almost accidentally. Initially the change was going to be regarding having one proper pip module, which showed the problem with the existing layout. Of course, in changing both of these things, that propagates throughout, essentially, the entire project.

All to say, any other changes done are to facilitate that adjustment. There is no other upheaval planned for this PR outside accomplishing that initial task.

Copy link
Collaborator

@Computerdores Computerdores left a comment

Choose a reason for hiding this comment

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

Can confirm that the pipewire error of the nix flake is gone for me too

CONTRIBUTING.md Outdated

### Contribution Checklist

- I've read the [Feature Roadmap](/docs/updates/roadmap.md) page
- I've read the [FAQ](/README.md/#faq), including the "[Features I Likely Won't Add/Pull](/README.md/#features-i-likely-wont-addpull)" section
- I've checked the open [Issues](https://github.com/TagStudioDev/TagStudio/issues) and [Pull Requests](https://github.com/TagStudioDev/TagStudio/pulls)
- I've checked the project [Issues](https://github.com/TagStudioDev/TagStudio/issues) and [Pull Requests](https://github.com/TagStudioDev/TagStudio/pulls)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: should be project's as above right?

@xarvex xarvex linked an issue Mar 9, 2025 that may be closed by this pull request
@xarvex xarvex removed a link to an issue Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High An important issue requiring attention Type: CI Continuous Integration / workflows Type: Refactor Code that needs to be restructured or cleaned up
Projects
Status: 🚧 In progress
3 participants