-
Notifications
You must be signed in to change notification settings - Fork 65
/
Makefile
67 lines (54 loc) · 2.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.DEFAULT_GOAL := all
.PHONY: .uv # Check that uv is installed
.uv:
@uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
.PHONY: .pre-commit # Check that pre-commit is installed
.pre-commit:
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/'
.PHONY: install # Install the package, dependencies, and pre-commit for local development
install: .uv .pre-commit
uv sync --frozen
uv pip install -e logfire-api
pre-commit install --install-hooks
.PHONY: format # Format the code
format:
uv run ruff format
uv run ruff check --fix
.PHONY: lint # Lint the code
lint:
uv run ruff check
uv run ruff format --check --diff
.PHONY: typecheck # Typecheck the code
typecheck:
uv run pyright
.PHONY: test # Run the tests
test:
uv run --no-sync coverage run -m pytest
.PHONY: generate-stubs # Generate stubs for logfire-api
generate-stubs:
uv run stubgen -p logfire --include-docstrings --no-analysis
rsync -a out/logfire/ logfire-api/logfire_api/
rm -rf out
# || true so that we ignore the test failure on the first pass, it should report as skipped on the second
uv run pytest ./tests/test_logfire_api.py::test_override_init_pyi || true
uv run pytest ./tests/test_logfire_api.py::test_override_init_pyi
.PHONY: testcov # Run tests and generate a coverage report
testcov: test
@echo "building coverage html"
uv run coverage html --show-contexts
.PHONY: docs # Build the documentation
docs:
uv run mkdocs build
# no strict so you can build the docs without insiders packages
.PHONY: docs-serve # Build and serve the documentation
docs-serve:
uv run mkdocs serve --no-strict
.PHONY: all
all: format lint test
.PHONY: cf-pages-build # Build the docs for GitHub Pages
cf-pages-build:
curl -LsSf https://astral.sh/uv/0.4.30/install.sh | sh
${HOME}/.cargo/bin/uv python install 3.12
${HOME}/.cargo/bin/uv sync --python 3.12 --frozen --group docs
${HOME}/.cargo/bin/uv pip install --upgrade --extra-index-url $(PPPR_URL) mkdocs-material mkdocstrings-python griffe==0.48.0
${HOME}/.cargo/bin/uv run --no-sync mkdocs build