Debian Codegraph @

Makefile

raw symbols SCIP
1 FRONTEND_SOURCES := $(shell find frontend/src frontend/css -type f)
2
3 all: src/fava/static/app.js
4
5 # Compile the frontend.
6 src/fava/static/app.js: $(FRONTEND_SOURCES) frontend/build.ts frontend/node_modules
7 cd frontend; npm run build
8
9 # Install the frontend node_modules dependencies.
10 frontend/node_modules: frontend/package-lock.json
11 cd frontend; npm install --no-progress
12 touch -m frontend/node_modules
13
14 # Create and sync a dev environment.
15 .PHONY: dev
16 dev: .venv
17 .venv: constraints.txt requirements.txt pyproject.toml
18 uv venv --allow-existing
19 uv pip sync requirements.txt
20 touch -m .venv
21
22 # Remove the generated frontend and translations in addition to mostlyclean (see below).
23 .PHONY: clean
24 clean: mostlyclean
25 find src/fava/static ! -name 'favicon.ico' -type f -exec rm -f {} +
26 find src/fava/translations -name '*.mo' -delete
27
28 # Remove node_modules, caches, .tox, etc.
29 .PHONY: mostlyclean
30 mostlyclean:
31 rm -rf .*cache
32 rm -rf .eggs
33 rm -rf .tox
34 rm -rf .venv
35 rm -rf build
36 rm -rf dist
37 rm -rf htmlcov
38 rm -rf frontend/node_modules
39 find . -type f -name '*.py[c0]' -delete
40 find . -type d -name "__pycache__" -delete
41
42 # Run linters.
43 .PHONY: lint
44 lint: frontend/node_modules
45 pre-commit run -a
46 cd frontend; npm exec tsc
47 cd frontend; npm exec svelte-check
48 tox -e lint
49
50 # Run tests.
51 .PHONY: test
52 test: frontend/node_modules
53 cd frontend; npm run test
54 tox -e py
55
56 # Update the snapshot files generated by the snapshot tests.
57 .PHONY: update-snapshots
58 update-snapshots:
59 find . -name "__snapshots__" -type d -prune -exec rm -r "{}" +
60 -SNAPSHOT_UPDATE=1 tox -e py
61 tox -e py
62
63 # Update the constraints file for Python dependencies
64 .PHONY: update-constraints
65 update-constraints:
66 uv pip compile --quiet --extra excel --extra dev --python-version 3.9 --upgrade --output-file constraints.txt pyproject.toml
67 uv pip compile --quiet --extra excel --extra old_deps_pins --resolution=lowest --python-version 3.9 --upgrade --output-file constraints-old.txt pyproject.toml
68
69 # Update the frontend dependencies.
70 .PHONY: update-frontend-deps
71 update-frontend-deps:
72 -cd frontend; npm outdated
73 cd frontend; npm update
74 cd frontend; npm run sync-pre-commit
75 touch -m frontend/node_modules
76
77 # Update pre-commit hooks
78 .PHONY: update-precommit
79 update-precommit:
80 pre-commit autoupdate
81
82 # Update frontend deps, Python deps and pre-commit
83 .PHONY: update
84 update: update-constraints update-frontend-deps update-precommit
85
86 # Build the website
87 .PHONY: docs
88 docs:
89 tox -e docs
90
91 # Run fava for the example files.
92 .PHONY: run-example
93 run-example:
94 @xdg-open http://localhost:3333
95 BEANCOUNT_FILE= fava -p 3333 --debug tests/data/*.beancount
96
97 # Generate the bql-grammar json file used by the frontend.
98 .PHONY: bql-grammar
99 bql-grammar: .venv contrib/scripts.py constraints.txt
100 uv run --no-sync python contrib/scripts.py generate-bql-grammar-json
101 -pre-commit run prettier --files frontend/src/codemirror/bql-grammar.ts
102
103 # Build the distribution (sdist and wheel).
104 .PHONY: dist
105 dist:
106 rm -rf dist/*.tar.gz
107 rm -rf dist/*.whl
108 python -m build
109 twine check dist/*
110
111 # Build the bql-grammar and update translations with POEditor.com
112 .PHONY: before-release
113 before-release: bql-grammar translations-push translations-fetch
114
115 # Extract translation strings.
116 .PHONY: translations-extract
117 translations-extract: .venv
118 uv run --no-sync pybabel extract -F src/fava/translations/babel.conf -o src/fava/translations/messages.pot .
119
120 # Extract translation strings and upload them to POEditor.com.
121 # Requires the environment variable POEDITOR_TOKEN to be set to an API token
122 # for POEditor.
123 .PHONY: translations-push
124 translations-push: .venv translations-extract
125 uv run --no-sync python contrib/scripts.py upload-translations
126
127 # Download translations from POEditor.com. (also requires POEDITOR_TOKEN)
128 .PHONY: translations-fetch
129 translations-fetch: .venv
130 uv run --no-sync python contrib/scripts.py download-translations
131
132 # Create a binary using pyinstaller
133 dist/fava: src/fava/static/app.js
134 tox -e pyinstaller