Skip to content

Commit

Permalink
Add local dev environment venv
Browse files Browse the repository at this point in the history
Don't forget to export the correct PYTHONPATH env variable.
  • Loading branch information
fauust committed Oct 10, 2023
1 parent 2476cab commit 6e79bee
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ workers
autogen
master-config.yaml
.venv
.vendor
33 changes: 30 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,44 @@ SHELL := /usr/bin/env bash
.DEFAULT_GOAL := help
.SHELLFLAGS := -eu -o pipefail -c
PATH := $(VENV_DIR)/bin:$(PATH)
WWW_PKGS := www/base www/console_view www/grid_view www/waterfall_view www/wsgi_dashboards www/badges
WWW_DEP_PKGS := www/guanlecoja-ui www/data_module
export PATH

help:
@grep -E '^[a-zA-Z1-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN { FS = ":.*?## " }; { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }'

install: ## Install all necessary tools
$(MAKE) venv
$(MAKE) install-pip-packages
$(MAKE) install-vlad-bb-fork
@echo -e "\n--> You should now activate the python3 venv with:"
@echo -e "source $(VENV_DIR)/bin/activate\n"

venv: ## Create python3 venv if it does not exists
$(info --> Create python virtual env ($(VENV_DIR)))
[[ -d $(VENV_DIR) ]] || $(shell command -v python3) -m venv $(VENV_DIR)
@echo -e "\n--> You should now activate the python3 venv with:"
@echo -e "source $(VENV_DIR)/bin/activate"
@echo -e "source $(VENV_DIR)/bin/activate\n"

install-pip-packages: ## Install python3 requirements
$(info --> Install requirements via `pip`)
pip install pip -U
pip install wheel
pip install -r requirements.txt

install-vlad-bb-fork: ## Install vlad bb fork
$(info --> Install vlad's bb fork)
if [[ ! -d $(VENDOR_DIR) ]]; then \
git clone --branch grid https://github.com/vladbogo/buildbot $(VENDOR_DIR); \
cd $(VENDOR_DIR)/master && python setup.py bdist_wheel; \
pip install ./dist/*.whl; \
fi

install-pre-commit: ## Install pre-commit tool
$(info --> Install pre-commit tool via `pip3`)
pip3 install pre-commit
$(info --> Install pre-commit tool via `pip`)
pip install pre-commit

pre-commit-run: ## Run pre-commit hooks with $PRE_COMMIT_ARGS default to (diff master...[current_branch])
$(info --> run pre-commit on changed files (pre-commit run))
Expand All @@ -31,3 +54,7 @@ pre-commit-run-all: ## Run pre-commit on the whole repository
checkconfig: ## Validate master.cfg files
$(info --> validate master.cfg files with docker)
./validate_master_cfg.sh

clean: ## Clean venv
[[ ! -d $(VENV_DIR) ]] || rm -rf $(VENV_DIR)
[[ ! -d $(VENDOR_DIR) ]] || rm -rf $(VENDOR_DIR)
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
buildbot-prometheus
buildbot-worker
docker==4.3.1
flask
libvirt-python
#mysqlclient
python-dotenv
pyzabbix
sqlalchemy==1.3.23
treq

0 comments on commit 6e79bee

Please sign in to comment.