Skip to content

Commit db9c31d

Browse files
committed
initial commit
0 parents  commit db9c31d

File tree

10 files changed

+420
-0
lines changed

10 files changed

+420
-0
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- uses: webfactory/ssh-agent@v0.9.0
12+
with:
13+
ssh-private-key: ${{ secrets.DEPS_SSH_KEY }}
14+
15+
- uses: astral-sh/setup-uv@v6
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version-file: .python-version
19+
20+
- run: uv sync --locked --all-groups
21+
22+
- name: Ruff formatting
23+
run: uv run ruff format --check .
24+
25+
- name: Ruff linting
26+
run: uv run ruff check .
27+
28+
- name: Pyright
29+
run: uv run pyright
30+
31+
- name: Tests
32+
run: uv run pytest -q
33+

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
.idea

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14

Makefile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.PHONY: help install format lint lint-fix typecheck docstring style fix \
2+
check sync clean test stats watch live-stream run-client reclaim \
3+
monitor monitor-charts
4+
.DEFAULT_GOAL := help
5+
6+
TEST_FLAGS := -xvv -s -p no:anchorpy
7+
8+
install: ## Create / update virtual‑env with all dependency groups
9+
uv sync --all-groups
10+
11+
format: ## Format code using ruff
12+
uv run ruff format .
13+
14+
lint: ## Run linting using ruff
15+
uv run ruff check .
16+
17+
lint-fix: ## Run linting with automatic fixes
18+
uv run ruff check --fix .
19+
20+
typecheck: ## Run static type checking
21+
uv run pyright
22+
23+
docstring: ## Check docstring style and completeness
24+
uv run ruff check . --select D,PD
25+
26+
style: ## Check code style (without docstrings)
27+
uv run ruff check . --select E,W,F,I,N,UP,B,C4,SIM,TCH
28+
29+
fix: format lint-fix ## Run all formatters and fixers
30+
31+
check: fix typecheck ## Run all checks (format, lint‑fix, typecheck)
32+
33+
sync: ## Re‑lock and install latest versions
34+
uv lock --upgrade # rebuild uv.lock with newer pins
35+
uv sync --all-groups # install everything into .venv
36+
37+
clean: ## Remove build artefacts and caches
38+
rm -rf .ruff_cache/ .mypy_cache/ .pytest_cache/ dist/ build/
39+
find . -type d -name __pycache__ -exec rm -rf {} +
40+
41+
test: ## Run tests
42+
uv run pytest $(TEST_FLAGS)
43+
44+
stats: ## Show code quality statistics
45+
@echo "=== Docstring Coverage ==="
46+
@uv run ruff check . --select D --statistics
47+
@echo "\n=== Missing Type Hints ==="
48+
@uv run ruff check . --select ANN --statistics
49+
@echo "\n=== Style Issues ==="
50+
@uv run ruff check . --select E,W,F,I,N --statistics
51+
52+
53+
# Watch tests, optionally limited to a path:
54+
# make watch → watch entire suite
55+
# make watch path/to/file → watch single test file
56+
watch:
57+
@if [ -z "$(filter-out $@,$(MAKECMDGOALS))" ]; then \
58+
uv run pytest-watcher . --runner "pytest tests $(TEST_FLAGS) -W ignore::DeprecationWarning"; \
59+
else \
60+
path_arg="$(filter-out $@,$(MAKECMDGOALS))"; \
61+
uv run pytest-watcher . --runner "pytest src/tests/$$path_arg $(TEST_FLAGS) -W ignore::DeprecationWarning"; \
62+
fi
63+
64+
# Pattern rule so additional args do not trigger "No rule to make target"
65+
%:
66+
@:
67+
68+
# Project‑specific entry points (replace poetry run → uv run)
69+
70+
help: ## Display this help message
71+
@echo 'Usage:'
72+
@echo ' make <target>'
73+
@echo ''
74+
@echo 'Targets:'
75+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'

README.md

Whitespace-only changes.

pyproject.toml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[project]
2+
name = "python-base-uv"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
authors = [
7+
{ name = "idatsy", email = "stefan@ranvier.co.uk" }
8+
]
9+
requires-python = ">=3.14"
10+
dependencies = []
11+
12+
[project.scripts]
13+
python-base-uv = "python_base_uv:main"
14+
15+
[build-system]
16+
requires = ["hatchling"]
17+
build-backend = "hatchling.build"
18+
19+
[dependency-groups]
20+
dev = [
21+
"pyrefly>=0.25.1",
22+
"pyright>=1.1.403",
23+
"pytest>=8.4.1",
24+
"pytest-asyncio>=1.1.0",
25+
"pytest-watcher>=0.4.3",
26+
"ruff>=0.12.5",
27+
]
28+
29+
[tool.ruff]
30+
line-length = 125
31+
target-version = "py313"
32+
33+
[tool.ruff.lint]
34+
extend-select = ["E","W","F","I","B","C4","N","D","UP","S","ANN","ARG","ERA","ICN","PD","NPY","PT","RET","SIM","TCH"]
35+
ignore = ["ANN204", "C901","S608","D401","E501","D107","W291","RET503","D100","D101","D102","D103","D104","D105","S104","PD901"]
36+
fixable = ["ALL"]
37+
pydocstyle = { convention = "google" }
38+
39+
[tool.ruff.lint.per-file-ignores]
40+
"**/wip*.py" = ["ALL"]
41+
"**/tests/*" = ["D","ANN","S","ERA"]
42+
"*_" = ["D","ANN","S"]
43+
"wip*" = ["D","ANN","S"]
44+
"__init__.py" = ["D"]
45+
"**/gen/*" = ["ALL"]
46+
"**/*.ipynb" = ["ALL"]
47+
48+
[tool.ruff.lint.isort]
49+
force-single-line = false
50+
lines-between-types = 1
51+
known-first-party = []
52+
53+
[tool.ruff.lint.flake8-annotations]
54+
allow-star-arg-any = false
55+
suppress-none-returning = true
56+
57+
[tool.ruff.format]
58+
quote-style = "double"
59+
indent-style = "space"
60+
skip-magic-trailing-comma = false
61+
line-ending = "auto"
62+
docstring-code-format = true
63+
docstring-code-line-length = 125
64+
65+
[tool.pyright]
66+
include = ["src"]
67+
exclude = ["**/node_modules", "**/__pycache__", ".venv", ".git", "dist", "build", "_*", "wip*", "**/tests", "**/gen", "**/program/*", "**/*.ipynb", "**/wip*.py"]
68+
defineConstant = { DEBUG = true }
69+
typeCheckingMode = "standard"
70+
pythonVersion = "3.13"
71+
pythonPlatform = "All"
72+
stubPath = "typings"
73+
reportMissingImports = "error"
74+
reportMissingTypeStubs = false
75+
reportMissingModuleSource = false
76+
reportUnknownParameterType = "warning"
77+
reportUnknownArgumentType = false
78+
reportUnknownMemberType = false
79+
reportMissingParameterType = "warning"
80+
reportUnnecessaryTypeIgnoreComment = "warning"
81+
reportUnnecessaryIsInstance = "warning"
82+
reportImportCycles = "warning"
83+
reportUnusedImport = "warning"
84+
reportUnusedVariable = "warning"
85+
reportDuplicateImport = "warning"
86+
87+
[[tool.pyright.overrides]]
88+
pattern = ".venv/**"
89+
reportUnknownParameterType = "none"
90+
reportUnknownArgumentType = "none"
91+
reportUnknownMemberType = "none"
92+
reportMissingParameterType = "none"

src/python_base_uv/__init__.py

Whitespace-only changes.

src/python_base_uv/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello")

tests/test_something.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_something() -> None:
2+
return True

0 commit comments

Comments
 (0)