Skip to content

Commit

Permalink
Added make targets for virtual environment (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
de-code authored Dec 16, 2024
1 parent 6becd14 commit eddb245
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/venv
/.*_cache

*.pyc
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/venv
/.*_cache

*.pyc
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8.17
50 changes: 49 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,54 @@ DOCKER_COMPOSE_DEV = docker compose
DOCKER_COMPOSE_CI = docker compose -f docker-compose.yml
DOCKER_COMPOSE = $(DOCKER_COMPOSE_DEV)

VENV = venv
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python


venv-clean:
@if [ -d "$(VENV)" ]; then \
rm -rf "$(VENV)"; \
fi

venv-create:
python3 -m venv $(VENV)

dev-install:
$(PIP) install --disable-pip-version-check -r requirements.build.txt
$(PIP) install --disable-pip-version-check \
-r requirements.txt \
-r requirements.dev.txt


dev-venv: venv-create dev-install


dev-flake8:
$(PYTHON) -m flake8 spacy_keyword_extraction_api tests

dev-pylint:
$(PYTHON) -m pylint spacy_keyword_extraction_api tests

dev-mypy:
$(PYTHON) -m mypy --check-untyped-defs spacy_keyword_extraction_api tests

dev-lint: dev-flake8 dev-pylint dev-mypy

dev-unittest:
$(PYTHON) -m pytest -p no:cacheprovider $(ARGS) tests/unit_test

dev-test: dev-lint dev-unittest


dev-start:
$(PYTHON) -m uvicorn \
spacy_keyword_extraction_api.main:create_app \
--reload \
--factory \
--host 127.0.0.1 \
--port 8000


build:
$(DOCKER_COMPOSE) build spacy-keyword-extraction-api
Expand All @@ -21,7 +69,7 @@ pylint:

mypy:
$(DOCKER_COMPOSE) run --rm spacy-keyword-extraction-api-dev \
python -m mypy spacy_keyword_extraction_api tests
python -m mypy --check-untyped-defs spacy_keyword_extraction_api tests

lint: flake8 pylint mypy

Expand Down

0 comments on commit eddb245

Please sign in to comment.