Use src-layout#4864
Conversation
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
There was a problem hiding this comment.
Code Review
This pull request migrates the project to a src layout, moving the tmt package into a src/ directory and updating configuration files and import statements accordingly. The changes include updating .pre-commit-config.yaml, pyproject.toml, and switching numerous absolute imports to relative imports within the tmt package. Feedback was provided regarding the Ruff configuration, where the src root should be set to src rather than src/tmt to correctly identify first-party imports. Additionally, the decision to disable TID252 and adopt relative imports was questioned for consistency, as absolute imports are generally preferred and still possible with the new layout.
I am having trouble creating individual review comments. Click here to see my feedback.
pyproject.toml (306)
The src configuration for Ruff should point to the directory containing the package(s), not the package directory itself. For a src layout where the package tmt is located in src/tmt/, the source root should be src. This ensures that imports starting with tmt. are correctly identified as first-party.
src = ["src", "tests"]
pyproject.toml (383)
Disabling TID252 and switching to relative imports introduces inconsistency, as many imports (e.g., import tmt.utils) remain absolute throughout the codebase. Absolute imports are generally preferred for clarity and to avoid such inconsistencies. Since moving to a src layout does not require relative imports, consider sticking to absolute imports and removing this ignore rule.
Signed-off-by: Cristian Le <git@lecris.dev>
b3e7ea2 to
4597698
Compare
Trying to see what impact this has for now.
Seems like it is blocked by a few other refactors at the very least