-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
58 lines (52 loc) · 1.14 KB
/
Copy pathmakefile
File metadata and controls
58 lines (52 loc) · 1.14 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
# Define variables
VENV = venv
PYTHON = python3
PIP = $(VENV)/bin/pip
STREAMLIT = $(VENV)/bin/streamlit
# Windows specific variables
ifdef OS
ifeq ($(OS),Windows_NT)
PYTHON = python
PIP = $(VENV)/Scripts/pip
STREAMLIT = $(VENV)/Scripts/streamlit
endif
endif
# Default target
all: run
# Create virtual environment
$(VENV)/bin/activate: requirements.txt
ifeq ($(OS),Windows_NT)
if not exist $(VENV)\Scripts\activate (
$(PYTHON) -m venv $(VENV) && \
$(PIP) install -U pip && \
$(PIP) install -r requirements.txt
)
else
test -d $(VENV) || ( \
$(PYTHON) -m venv $(VENV) && \
$(PIP) install -U pip && \
$(PIP) install -r requirements.txt \
)
endif
# Run the application
run: $(VENV)/bin/activate
ifeq ($(OS),Windows_NT)
@echo "Running the application..."
$(STREAMLIT) run app.py
else
@echo "Running the application..."
$(STREAMLIT) run app.py
endif
# Stop the application
stop:
ifeq ($(OS),Windows_NT)
@echo "Stopping the application..."
taskkill /IM "streamlit.exe" /F
else
@echo "Stopping the application..."
pkill -f "streamlit run app.py"
endif
# Clean up the virtual environment
clean:
@echo "Cleaning up environment..."
rm -rf $(VENV)