Mondernise maintenance#93
Conversation
[CHANGED] as uv.lock is a source of security risks, deleting
Reviewer's GuideModernizes the packaging, linting, and CI setup by migrating from flit to hatch/uv, restructuring dependency groups, externalizing Ruff config, and simplifying GitHub workflows and nox sessions around uv and Python 3.14. Flow diagram for updated nox sessions and dependency groupsflowchart TD
Dev["Developer_or_CI"] --> NoxTestCall["Call_nox_session_test"]
Dev --> NoxTestcovCall["Call_nox_session_testcov"]
Dev --> NoxFmtCall["Call_nox_session_fmt"]
subgraph Nox_Config
Noxfile["noxfile_py"]
PyProject["pyproject_toml"]
DepGroups["dependency_group_test"]
DepGroupsDev["dependency_group_dev"]
end
NoxTestCall --> Noxfile
NoxTestcovCall --> Noxfile
NoxFmtCall --> Noxfile
subgraph Session_test
ST_Install["session_install_editable_with_test_group"]
ST_Chdir["session_chdir_tests"]
ST_Pytest["session_run_pytest_with_markers"]
end
subgraph Session_testcov
SC_Install["session_install_editable_with_test_group"]
SC_Chdir["session_chdir_tests"]
SC_Pytest["session_run_pytest_with_coverage"]
end
subgraph Session_fmt
SF_InstallRuff["session_install_ruff"]
SF_RuffCheck["session_run_ruff_check_fix_only"]
SF_RuffFormat["session_run_ruff_format"]
end
Noxfile --> ST_Install
ST_Install --> DepGroups
ST_Install --> PyProject
ST_Install --> ST_Chdir
ST_Chdir --> ST_Pytest
Noxfile --> SC_Install
SC_Install --> DepGroups
SC_Install --> PyProject
SC_Install --> SC_Chdir
SC_Chdir --> SC_Pytest
Noxfile --> SF_InstallRuff
SF_InstallRuff --> SF_RuffCheck
SF_RuffCheck --> SF_RuffFormat
subgraph UV_Integration
UV_Run_Test["uv_run_with_group_test"]
UV_Run_Dev["uv_run_with_group_dev"]
end
UV_Run_Test --> NoxTestCall
UV_Run_Test --> NoxTestcovCall
UV_Run_Dev --> NoxFmtCall
PyProject --> DepGroups
PyProject --> DepGroupsDev
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- The updated
noxfile.pyusessession.install("-e", ".", "--group", "test"), butsession.installdelegates to pip which doesn’t understand--group, so this will likely break local nox runs; consider keeping.[test]for nox and relying ondependency-groupsonly where tools explicitly support them (e.g. uv). - Replacing
[project.optional-dependencies]with[dependency-groups]removes support for standard extras likepip install .[test]; if that’s not intentional, you might want to mirror the groups intooptional-dependenciesfor compatibility with non-uv tooling.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The updated `noxfile.py` uses `session.install("-e", ".", "--group", "test")`, but `session.install` delegates to pip which doesn’t understand `--group`, so this will likely break local nox runs; consider keeping `.[test]` for nox and relying on `dependency-groups` only where tools explicitly support them (e.g. uv).
- Replacing `[project.optional-dependencies]` with `[dependency-groups]` removes support for standard extras like `pip install .[test]`; if that’s not intentional, you might want to mirror the groups into `optional-dependencies` for compatibility with non-uv tooling.
## Individual Comments
### Comment 1
<location path="noxfile.py" line_range="8" />
<code_context>
@nox.session(python=[f"3.{v}" for v in _py_versions])
def test(session):
- session.install("-e.[test]")
+ session.install("-e", ".", "--group", "test")
session.chdir("tests")
session.run(
</code_context>
<issue_to_address>
**issue (bug_risk):** Using `--group` in `session.install` is likely incompatible with the underlying installer.
`session.install` delegates directly to pip (or `uv pip install`), which don’t understand `--group` in this context, so this call is very likely to fail when the session runs.
To keep group-based CI usage while avoiding breakage in `nox`, consider either retaining the extras install (`session.install("-e.[test]")`) or calling `uv` explicitly via `session.run("uv", "run", "--group", "test", "pytest", ...)` instead of using `session.install` for this.
As written, local `nox` runs are very likely to error when `session.install` is executed.
</issue_to_address>
### Comment 2
<location path="ruff.toml" line_range="34" />
<code_context>
-line-length = 88
-indent-width = 4
-
-target-version = "py310"
-
-[tool.ruff.lint]
</code_context>
<issue_to_address>
**suggestion:** Ruff `target-version` is lower than the declared supported Python versions.
Ruff is set to `target-version = "py310"` while the project targets `>=3.11`. This mismatch can cause Ruff to flag valid 3.11+ syntax or miss issues specific to those versions. Please update `target-version` to at least `"py311"` so linting matches the supported runtime.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| @nox.session(python=[f"3.{v}" for v in _py_versions]) | ||
| def test(session): | ||
| session.install("-e.[test]") | ||
| session.install("-e", ".", "--group", "test") |
There was a problem hiding this comment.
issue (bug_risk): Using --group in session.install is likely incompatible with the underlying installer.
session.install delegates directly to pip (or uv pip install), which don’t understand --group in this context, so this call is very likely to fail when the session runs.
To keep group-based CI usage while avoiding breakage in nox, consider either retaining the extras install (session.install("-e.[test]")) or calling uv explicitly via session.run("uv", "run", "--group", "test", "pytest", ...) instead of using session.install for this.
As written, local nox runs are very likely to error when session.install is executed.
| line-length = 88 | ||
| indent-width = 4 | ||
|
|
||
| target-version = "py310" |
There was a problem hiding this comment.
suggestion: Ruff target-version is lower than the declared supported Python versions.
Ruff is set to target-version = "py310" while the project targets >=3.11. This mismatch can cause Ruff to flag valid 3.11+ syntax or miss issues specific to those versions. Please update target-version to at least "py311" so linting matches the supported runtime.
Summary by Sourcery
Modernize the project's packaging and CI workflows around uv and hatch, and align linting and testing tooling with dependency groups.
New Features:
Enhancements:
Build:
CI:
Chores: