Skip to content

Various improvements to pyproject toml#23

Closed
caspervdw wants to merge 2 commits intomasterfrom
casper-pyproject-improvements
Closed

Various improvements to pyproject toml#23
caspervdw wants to merge 2 commits intomasterfrom
casper-pyproject-improvements

Conversation

@caspervdw
Copy link
Contributor

  • Change dependency groups to optional dependencies so that you can install them using install -e .[test]
  • Also changed the name of the dependency group from dev to test to match the GH action
  • Removed the --cov pytest options because it breaks VS Code Python extension
  • Allow the * and unused imports in __init__ files (F401/F403), because that is the way we define public API's (combined with an __all__ = [stuff you want to expose]` in the modules

@caspervdw caspervdw requested a review from reinout September 16, 2025 09:40
Copy link
Member

@reinout reinout left a comment

Choose a reason for hiding this comment

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

Ik ga zelf wat uitzoekwerk doen :-)

push:
branches:
- master
- main
Copy link
Member

Choose a reason for hiding this comment

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

I actually want to remove the whole test.yml, I accidentally left that one in. The basic nens-meta.yml covers a quick pytest call.

Copy link
Member

Choose a reason for hiding this comment

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

Done in #25

Comment on lines +42 to +43
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer not to have it in the basic template. It is fine for properly build and maintained APIs, but advisors will also use this template and they have the tendency to make an unholy mess with import * in init files.

Easy to enable/add for individual projects that need it.

Copy link
Member

Choose a reason for hiding this comment

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

Documented it in nens/nens-meta@3a9fa0c

Comment on lines -24 to -26
[tool.pytest.ini_options]
addopts = "--cov --cov-fail-under=80"

Copy link
Member

Choose a reason for hiding this comment

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

Good one. I had forgotten that it breaks vscode.
A bummer, as this setting is a nice way to customise the waypytest runs in the github action without having to make changes to the generated gh action file.

Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +21 to +23
[project.optional-dependencies]
test = ["pytest>=8.4.2", "pytest-cov>=6.3.0", "pytest-sugar>=1.1.1"]

Copy link
Member

Choose a reason for hiding this comment

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

I need to do a bit of googling on this. I've automatically been using uv's install --dev, but I might need to change that.

@reinout
Copy link
Member

reinout commented Sep 16, 2025

Fixed in an alternative way in #25

@reinout reinout closed this Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants