-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (49 loc) · 1.99 KB
/
Makefile
File metadata and controls
59 lines (49 loc) · 1.99 KB
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
# Export the environment to a yml file
export_env:
@conda env export > environment.yml;
# Build conda environment from the yml file
build_env:
@conda env create -f environment.yml;
# Install the package to pip
install_package:
@pip install -e .;
# Run the unit test suite (no network calls, runs in seconds)
test:
@python -m pytest tests/ -v;
# Lint source code, exploratory scripts, and tests
# Uses the openpois conda env's binaries regardless of whether it is activated
CONDA_PYTHON := $(shell conda run -n openpois which python 2>/dev/null || echo python)
CONDA_BIN := $(dir $(CONDA_PYTHON))
lint:
@$(CONDA_BIN)flake8 src/ scripts/ tests/
@$(CONDA_BIN)pylint src/openpois/
# Build the site for production
site_build:
@cd site && npm run build;
# Serve the site locally with hot reload
# Note: does not build Sphinx docs; use site_preview for a full build
site_dev:
@cd site && npm run dev;
# Generate site/public/taxonomy.html from the conflation data CSVs
# Requires the openpois conda env to be active (for pandas)
build_taxonomy:
@python scripts/build_taxonomy.py;
# Full build + local preview: Sphinx docs, Vite production build, then serve
# Mirrors the GitHub Actions workflow; serves at http://localhost:4173
# Requires the openpois conda env to be active (for sphinx-build)
# Uses Python's HTTP server instead of vite preview so /docs/ is served
# correctly (vite preview uses SPA fallback which swallows directory requests)
site_preview:
@python scripts/build_taxonomy.py
@sphinx-build -b html docs docs/_build/html -q
@cd site && npm run build
@cp -r docs/_build/html site/dist/docs
@python -m http.server 4173 --directory site/dist;
# Convenience target to print all of the available targets in this file
# From https://stackoverflow.com/questions/4219255
.PHONY: list
list:
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | \
awk -v RS= -F: '/^# File/,/^# Finished Make data base/ \
{if ($$1 !~ "^[#.]") {print $$1}}' | \
sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'