Skip to content

Commit 75de95c

Browse files
committed
add py.typed and add to pyproject.toml
1 parent 816458c commit 75de95c

File tree

4 files changed

+214
-41
lines changed

4 files changed

+214
-41
lines changed

Makefile

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,23 @@ PYTHON_DIRS := $(PACKAGE) $(TEST_DIR)
77
.DEFAULT_GOAL := .PHONY
88
help:
99
@echo "Available commands:"
10-
@echo " qa : Run analysis and tests"
1110
@echo " analyze : Run code analysis with ruff"
12-
@echo " format : Format code"
13-
@echo " test : Run tests"
11+
@echo " build : Run QA and prepare build"
12+
@echo " clean : Remove temporary files"
1413
@echo " coverage : Check test coverage"
14+
@echo " format : Format code"
1515
@echo " lock : Lock dependencies with uv"
16-
@echo " clean : Remove temporary files"
17-
@echo " build : Run QA and prepare build"
18-
19-
qa: analyze test
16+
@echo " qa : Run all quality assurance checks (analysis, type checking, security, tests)"
17+
@echo " security : Run security checks with bandit"
18+
@echo " test : Run tests"
19+
@echo " typecheck: Run mypy type checking"
2020

2121
analyze:
22-
@uv add ruff --dev
2322
@echo "Running code analysis..."
2423
@uv run ruff check $(PYTHON_DIRS)
2524

26-
format:
27-
@uv add ruff --dev
28-
@echo "Formatting code..."
29-
@uv run ruff format $(PYTHON_DIRS)
30-
31-
lock:
32-
@echo "Updating dependency lock..."
33-
@uv run uv lock
34-
35-
test:
36-
@uv add pytest --dev
37-
@echo "Running tests..."
38-
@uv run pytest --maxfail=1
39-
40-
coverage:
41-
@uv add pytest --dev
42-
@uv add pytest-cov --dev
43-
@echo "Checking test coverage..."
44-
@uv run pytest --cov=$(PACKAGE) --cov-report=term-missing $(TEST_DIR)
25+
build: qa clean
26+
@echo "Build prepared."
4527

4628
clean:
4729
@echo "Cleaning up..."
@@ -53,9 +35,34 @@ clean:
5335
@find . -type d -name "*.egg-info" -exec rm -rf {} +
5436
@find . -type d -name "*.egg" -exec rm -rf {} +
5537
@find . -type d -name ".pytest_cache" -exec rm -rf {} +
38+
@find . -type d -name ".mypy_cache" -exec rm -rf {} +
5639
@rm -rf build/ dist/ .coverage htmlcov/
5740

58-
build: qa clean
59-
@echo "Build prepared."
41+
coverage:
42+
@echo "Checking test coverage..."
43+
@uv run pytest --cov=$(PACKAGE) --cov-report=term-missing $(TEST_DIR)
44+
45+
format:
46+
@echo "Formatting code..."
47+
@uv run ruff format $(PYTHON_DIRS)
48+
49+
lock:
50+
@echo "Updating dependency lock..."
51+
@uv run uv lock
52+
53+
qa: analyze typecheck security test
54+
55+
security:
56+
@echo "Running security checks..."
57+
@uv run bandit -r $(PACKAGE) -c pyproject.toml
58+
59+
test:
60+
@echo "Running tests..."
61+
@uv run pytest --maxfail=1
62+
63+
typecheck:
64+
@uv add pyright --dev
65+
@echo "Running type checking..."
66+
@uv run pyright $(PACKAGE)
6067

61-
.PHONY: analyze build clean format lock qa test coverage help
68+
.PHONY: analyze build clean coverage format help lock qa security test typecheck

eventsourcingdb/py.typed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file intentionally left empty
2+
# It signals to type checkers that this package supports type hints

pyproject.toml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,38 @@ dev = [
1616
"pytest==8.3.5",
1717
"pytest-timeout==2.4.0",
1818
"pytest-asyncio==0.26.0",
19+
"pytest-cov==5.0.0",
1920
"ruff==0.11.13",
20-
"pytest-cov>=6.1.1",
21+
"bandit==1.7.7",
22+
"pyright==1.1.401",
2123
]
2224

2325
[build-system]
2426
requires = ["hatchling"]
2527
build-backend = "hatchling.build"
2628

29+
[tool.bandit]
30+
exclude_dirs = ["tests", ".venv"]
31+
skips = ["B101"]
32+
33+
[tool.editorconfig]
34+
generate = true
35+
36+
[tool.hatch.build.targets.wheel]
37+
packages = ["eventsourcingdb"]
38+
39+
[tool.hatch.build.targets.sdist]
40+
include = ["eventsourcingdb/**/*.py", "eventsourcingdb/py.typed"]
41+
2742
[tool.pytest.ini_options]
2843
timeout = 30
2944
asyncio_default_fixture_loop_scope = "function"
3045

3146
[tool.ruff]
32-
# Die lint.select-Option bestimmt, welche Linting-Regeln aktiviert werden
33-
lint.select = ["ALL"] # Alle Regeln aktivieren
47+
# The lint.select option determines which linting rules are enabled
48+
lint.select = ["ALL"] # Enable all rules
3449

35-
# Regeln ausschließen, die für das Projekt nicht relevant sind
50+
# Rules to exclude that are not relevant for this project
3651
lint.ignore = [
3752
# Documentation related
3853
"D100", # Missing docstring in public module/package
@@ -100,6 +115,3 @@ lint.ignore = [
100115
"ASYNC251", # Async functions should not call time.sleep
101116
]
102117
line-length = 100
103-
104-
[tool.editorconfig]
105-
generate = true

0 commit comments

Comments
 (0)