Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ updates:
interval: "daily"
commit-message:
prefix: "Chore"
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 The Linux Foundation

# Dynamic versioning file is auto-generated/recreated
src/lfreleng_test_python_project/_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -101,6 +104,7 @@ ipython_config.py
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# Since this is a test project, we track uv.lock for reproducibility.
#uv.lock

# poetry
Expand Down
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,29 @@ Contains a sample Python project implementing a CLI tool with [Typer](https://ty
# The section below renders the badges displayed at the top of the page
-->

##  Notes
## Notes

Steps required to initialise pyproject.toml and create initial lock file:
Steps required to build and work with the project using uv:

```console
pdm init
pdm add -dG test pytest
pdm add -dG test coverage
pdm add -dG tox tox-pdm tox
pdm add -dG lint pre-commit
pdm add -dG docs sphinx
pdm add -dG docs sphinx-copybutton
pdm build
pdm install --dev
# Install dependencies
uv sync --all-extras

# Build the project
uv build

# Run tests
uv run pytest

# Run tests with tox
uv run tox

# Install in development mode
uv pip install -e .
```

The project uses `hatchling` with dynamic versioning from VCS tags. Version
numbers are automatically generated from git tags.

[pre-commit.ci results page]: https://results.pre-commit.ci/latest/github/lfreleng-actions/test-python-project/main
[pre-commit.ci status badge]: https://results.pre-commit.ci/badge/github/lfreleng-actions/test-python-project/main.svg
2,357 changes: 0 additions & 2,357 deletions pdm.lock

This file was deleted.

142 changes: 120 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 The Linux Foundation

[build-system]
requires = ["hatchling>=1.24", "hatch-vcs>=0.4"]
build-backend = "hatchling.build"

[project]
name = "lfreleng-test-python-project"
version = "0.0.1"
dynamic = ["version"]
description = "Sample Python project used for testing actions"
authors = [
{name = "Matthew Watkins", email = "93649628+ModeSevenIndustrialSolutions@users.noreply.github.com"},
{ name = "Matthew Watkins", email = "93649628+ModeSevenIndustrialSolutions@users.noreply.github.com" },
]
dependencies = ["typer>=0.15.2", "jupyterlab>=4.3.6"]
requires-python = ">=3.11"
license = "Apache-2.0"
readme = "README.md"
license = {text = "Apache-2.0"}
requires-python = ">=3.11"
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
Expand All @@ -30,31 +33,126 @@ classifiers = [
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
]
dependencies = [
"typer>=0.15.2",
# Note: jupyterlab commented out due to CVE-2025-53000 in nbconvert dependency
# Uncomment if notebook testing is needed (check for security fixes first)
# "jupyterlab>=4.3.6",
]

[project.urls]
Homepage = "https://github.com/lfreleng-actions/test-python-project"
Repository = "https://github.com/lfreleng-actions/test-python-project"
Downloads = "https://github.com/lfreleng-actions/test-python-project/releases"
"Bug Tracker" = "https://github.com/lfreleng-actions/test-python-project/issues"
Documentation = "https://github.com/lfreleng-actions/test-python-project/tree/main/docs"
"Source Code" = "https://github.com/lfreleng-actions/test-python-project"

[project.optional-dependencies]
dev = [
"pytest>=8.3.5",
"pytest-cov>=7.0.0",
"coverage>=7.7.1",
"tox>=4.24.2",
"pre-commit>=4.2.0",
"sphinx>=8.2.3",
"sphinx-copybutton>=0.5.2",
]

[project.scripts]
lfreleng-test-python-project = "lfreleng_test_python_project.cli:run"
lfreleng-test-python-project = "lfreleng_test_python_project.cli:app"

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
# Hatch dynamic versioning from VCS (tags). Example: tag v0.2.3 -> version 0.2.3
[tool.hatch.version]
source = "vcs"

# Optional: control local version scheme (omit commit hash/local segment for reproducible builds)
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

# Generate a file at build time with the resolved version (importable as lfreleng_test_python_project._version.__version__)
[tool.hatch.build.hooks.vcs]
version-file = "src/lfreleng_test_python_project/_version.py"

# Wheel build configuration (src layout)
[tool.hatch.build.targets.wheel]
packages = ["src/lfreleng_test_python_project"]

[tool.pdm]
distribution = true
# sdists: include everything by default
[tool.hatch.build.targets.sdist]
include = ["src", "README.md", "LICENSE*", "pyproject.toml"]

# Dependency group for uv (mirrors dev extra)
[dependency-groups]
test = [
"pytest>=8.3.5",
"coverage>=7.7.1",
dev = [
"pytest>=8.3.5",
"pytest-cov>=7.0.0",
"coverage>=7.7.1",
"tox>=4.24.2",
"pre-commit>=4.2.0",
"sphinx>=8.2.3",
"sphinx-copybutton>=0.5.2",
]
tox = [
"tox>=4.24.2",
"tox-pdm>=0.7.2",

[tool.pytest.ini_options]
testpaths = [
"tests/",
]
lint = [
"pre-commit>=4.2.0",
python_files = "test_*.py"
python_classes = "Test*"
python_functions = "test_*"
addopts = [
"-v",
"--tb=short",
]
docs = [
"sphinx>=8.2.3",
"sphinx-copybutton>=0.5.2",

[tool.coverage.run]
source = ["lfreleng_test_python_project"]
omit = ["tests/*"]
data_file = ".coverage"

[tool.coverage.html]
directory = "coverage_html_report"

[tool.coverage.paths]
source = [
"src/",
"*/site-packages/",
]

[tool.coverage.report]
fail_under = 45
skip_empty = true
ignore_errors = true
show_missing = true

[tool.mypy]
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
ignore_missing_imports = true

[tool.ruff]
target-version = "py311"
line-length = 88

[tool.ruff.lint]
select = [
"E",
"W",
"F",
"I",
"B",
"C4",
"UP",
]
ignore = [
"E501",
"B008",
"C901",
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**/*" = ["S101", "D"]
13 changes: 4 additions & 9 deletions src/lfreleng_test_python_project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@

"""Sample/test module."""

from importlib.metadata import PackageNotFoundError, version # pragma: no cover

try:
# Change here if project is renamed and does not equal the package name
dist_name = "lfreleng-test-python-project"
__version__ = version(dist_name)

except PackageNotFoundError: # pragma: no cover
from lfreleng_test_python_project._version import __version__
except ImportError:
__version__ = "unknown"
finally:
del version, PackageNotFoundError

__all__ = ["__version__"]
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# SPDX-FileCopyrightText: 2025 The Linux Foundation

import pytest

from typer.testing import CliRunner


Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import subprocess
import sys

from lfreleng_test_python_project.cli import app


Expand Down
Loading
Loading