This is an automated email from the ASF dual-hosted git repository.

gjm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bloodhound-core.git

commit 8ba4dfd7ecc55ce80cbe93039fa7a0df6ecff8d2
Author: Gary Martin <gary.mar...@physics.org>
AuthorDate: Sat Nov 5 01:14:44 2022 +0000

    Introduce Makefile for common operations
    
     * Add targets for various django commands to reduce need for running
       through `poetry run`
     * Adds targets to help with running selenium for testing via docker;
       expected to be particularly useful for someone running their
       development environment from a podman based "toolbox"
---
 Makefile       | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 pyproject.toml | 12 ++++----
 2 files changed, 94 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1d80d0e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,88 @@
+DOCKER_BIN := $(shell command -v docker || command -v podman)
+SELENIUM_CONTAINER ?= selenium-server
+
+ifneq (,$(wildcard /run/.containerenv))
+       DOCKER_HOST := unix:///run/user/$(UID)/podman/podman.sock
+       DOCKER_CMD := flatpak-spawn --host podman
+else
+       DOCKER_CMD := $(DOCKER_BIN)
+endif
+
+PYTHON = poetry run python
+MANAGE = $(PYTHON) manage.py
+
+install:
+       poetry install
+.PHONY: install
+
+manage-%:
+       $(MANAGE) $*
+.PHONY: manage-%
+
+makemigrations: manage-makemigrations
+       $(MANAGE) makemigrations trackers
+.PHONY: makemigrations
+
+migrate: makemigrations manage-migrate
+createsuperuser: manage-createsuperuser
+shell: manage-shell
+runserver: manage-runserver
+test: manage-test
+
+CONTAINER_FILTER = -f name=$(SELENIUM_CONTAINER)
+EXITED_CONTAINER_FILTER = -f status=exited $(CONTAINER_FILTER)
+
+selenium-start:
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(EXITED_CONTAINER_FILTER)))
+       $(DOCKER_CMD) start $(SELENIUM_CONTAINER)
+else ifneq (,$(shell $(DOCKER_CMD) ps -q $(CONTAINER_FILTER)))
+else
+       $(DOCKER_CMD) run -d --network host --privileged --name 
$(SELENIUM_CONTAINER) \
+               docker.io/selenium/standalone-firefox
+endif
+       $(DOCKER_CMD) ps $(CONTAINER_FILTER)
+       sleep 10
+.PHONY: selenium-start
+
+selenium-stop:
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(CONTAINER_FILTER)))
+       $(DOCKER_CMD) stop $(SELENIUM_CONTAINER)
+       $(DOCKER_CMD) ps $(EXITED_CONTAINER_FILTER)
+endif
+.PHONY: selenium-stop
+
+selenium-clean:
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(CONTAINER_FILTER)))
+       $(DOCKER_CMD) stop $(SELENIUM_CONTAINER)
+       sleep 1
+endif
+ifneq (,$(shell $(DOCKER_CMD) ps -q $(EXITED_CONTAINER_FILTER)))
+       $(DOCKER_CMD) container rm $(SELENIUM_CONTAINER)
+       @echo $(SELENIUM_CONTAINER) Removed
+endif
+.PHONY: selenium-clean
+
+functional-test: selenium-start
+       poetry run python functional_tests.py
+.PHONY: functional-test
+
+clean-deplock:
+ifeq (haslock,$(shell [ -f poetry.lock ] && echo haslock ))
+       rm poetry.lock
+endif
+.PHONY: clean-deplock
+
+clean-venv:
+ifeq (hasvenv,$(shell [ -d .venv ] && echo hasvenv ))
+       rm -r .venv
+endif
+.PHONY: clean-venv
+
+clean-db:
+ifeq (hasdb,$(shell [ -f db.sqlite3 ] && echo hasdb ))
+       rm db.sqlite3
+endif
+.PHONY: clean-db
+
+full-clean: clean-deplock clean-venv clean-db selenium-clean
+.PHONY: full-clean
diff --git a/pyproject.toml b/pyproject.toml
index 94367d4..83135ca 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,10 +7,10 @@ license = "Apache-2.0"
 
 [tool.poetry.dependencies]
 python = "^3.8"
-Django = "^4.0.3"
-djangorestframework = "^3.13.1"
-Markdown = "^3.3.6"
-drf-yasg = "^1.20.0"
+Django = "^4.1.2"
+djangorestframework = "^3.14.0"
+Markdown = "^3.4.1"
+drf-yasg = "^1.21.4"
 drf-nested-routers = "^0.93.4"
 PyYAML = "^6.0"
 psycopg2 = { version = "^2.9", optional = true }
@@ -18,8 +18,8 @@ psycopg2-binary = { version = "^2.9", optional = true }
 
 [tool.poetry.dev-dependencies]
 selenium = "^3.141.0"
-django-extensions = "^3.1.3"
-hypothesis = "^6.21.0"
+django-extensions = "^3.2.1"
+hypothesis = "^6.56.4"
 
 [tool.poetry.extras]
 postgres = ["psycopg2"]

Reply via email to