-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
69 lines (52 loc) · 2.16 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
68
69
.PHONY: setup compile-deps sync-deps clean test lint init-tools local-dev first-time-setup update-deps dev-setup sync-all first-time-local-setup
# Environment variable for local SDK path (optional)
SOCKET_SDK_PATH ?= ../socket-sdk-python
# Environment variable to control local development mode
USE_LOCAL_SDK ?= false
# === High-level workflow targets ===
# First-time repo setup after cloning (using PyPI packages)
first-time-setup: clean setup
# First-time setup for local development (using local SDK)
first-time-local-setup:
$(MAKE) clean
$(MAKE) USE_LOCAL_SDK=true dev-setup
# Update dependencies after changing pyproject.toml
update-deps: compile-deps sync-deps
# Setup for local development
dev-setup: clean local-dev setup
# Sync all dependencies after pulling changes
sync-all: sync-deps
# === Implementation targets ===
# Creates virtual environment and installs pip-tools
init-tools:
python -m venv .venv
. .venv/bin/activate && pip install pip-tools
# Installs dependencies needed for local development
# Currently: socket-sdk-python from test PyPI or local path
local-dev: init-tools
ifeq ($(USE_LOCAL_SDK),true)
. .venv/bin/activate && pip install -e $(SOCKET_SDK_PATH)
endif
# Creates/updates requirements.txt files with locked versions based on pyproject.toml
compile-deps: local-dev
. .venv/bin/activate && pip-compile --output-file=requirements.txt pyproject.toml
. .venv/bin/activate && pip-compile --extra=dev --output-file=requirements-dev.txt pyproject.toml
. .venv/bin/activate && pip-compile --extra=test --output-file=requirements-test.txt pyproject.toml
# Creates virtual environment and installs dependencies from pyproject.toml
setup: compile-deps
. .venv/bin/activate && pip install -e ".[dev,test]"
# Installs exact versions from requirements.txt into your virtual environment
sync-deps:
. .venv/bin/activate && pip-sync requirements.txt requirements-dev.txt requirements-test.txt
ifeq ($(USE_LOCAL_SDK),true)
. .venv/bin/activate && pip install -e $(SOCKET_SDK_PATH)
endif
# Removes virtual environment and cache files
clean:
rm -rf .venv
find . -type d -name "__pycache__" -exec rm -rf {} +
test:
pytest
lint:
ruff check .
ruff format --check .