From de2ac2fa5c38cb75d7c7492bae37201c7f22f9aa Mon Sep 17 00:00:00 2001 From: david-hummingbot <85695272+david-hummingbot@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:01:59 +0800 Subject: [PATCH 1/2] update Makefile --- Makefile | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 830c46c7..0eaf1464 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,26 @@ .ONESHELL: +.SHELLFLAGS := -c + .PHONY: run .PHONY: uninstall .PHONY: install +.PHONY: install-pre-commit +.PHONY: docker_build +.PHONY: docker_run + + +detect_conda_bin := $(shell bash -c 'if [ "${CONDA_EXE} " == " " ]; then \ + CONDA_EXE=$$((find /opt/conda/bin/conda || find ~/anaconda3/bin/conda || \ + find /usr/local/anaconda3/bin/conda || find ~/miniconda3/bin/conda || \ + find /root/miniconda/bin/conda || find ~/Anaconda3/Scripts/conda || \ + find $$CONDA/bin/conda) 2>/dev/null); fi; \ + if [ "${CONDA_EXE}_" == "_" ]; then \ + echo "Please install Anaconda w/ Python 3.10+ first"; \ + echo "See: https://www.anaconda.com/distribution/"; \ + exit 1; fi; \ + echo $$(dirname $${CONDA_EXE})') + +CONDA_BIN := $(detect_conda_bin) run: streamlit run main.py @@ -10,10 +29,21 @@ uninstall: conda env remove -n dashboard install: - conda env create -f environment_conda.yml + if conda env list | grep -q '^dashboard '; then \ + echo "Environment already exists."; \ + else \ + conda env create -f environment_conda.yml; \ + fi + $(MAKE) install-pre-commit + +install-pre-commit: + /bin/bash -c 'source "${CONDA_BIN}/activate" dashboard && \ + if ! conda list pre-commit | grep pre-commit &> /dev/null; then \ + pip install pre-commit; \ + fi && pre-commit install' docker_build: docker build -t hummingbot/dashboard:latest . docker_run: - docker run -p 8501:8501 dashboard:latest \ No newline at end of file + docker run -p 8501:8501 hummingbot/dashboard:latest From 2814b08f5a0105e4b33f10bbaf3c6fe74219c63d Mon Sep 17 00:00:00 2001 From: david-hummingbot <85695272+david-hummingbot@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:13:13 +0800 Subject: [PATCH 2/2] add headless flag --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0eaf1464..902588c3 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ detect_conda_bin := $(shell bash -c 'if [ "${CONDA_EXE} " == " " ]; then \ CONDA_BIN := $(detect_conda_bin) run: - streamlit run main.py + streamlit run main.py --server.headless true uninstall: conda env remove -n dashboard