-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Upgrade to Python3.8 as the minimal supported - Upgrade actions to test Python 3.8+ - Copy Makefile from other projects - Upgrade to use pip-compile workflow - Use django-zakka for celery compatiblity
- Loading branch information
Showing
8 changed files
with
267 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,108 @@ | ||
APP_BIN := .venv/bin/quickstats | ||
PIP_BIN := .venv/bin/pip | ||
PKG_NAME = quickstats | ||
CLI_NAME = quickstats | ||
PKG_OPTS = .[standalone,dev] | ||
|
||
SYSTEM_PYTHON ?= python3.9 | ||
VENV_PATH := .venv | ||
APP_BIN := $(VENV_PATH)/bin/$(CLI_NAME) | ||
PIP_BIN := $(VENV_PATH)/bin/pip | ||
|
||
# Help 'function' taken from | ||
# https://gist.github.com/prwhite/8168133#gistcomment-2278355 | ||
lessopts="--tabs=4 --quit-if-one-screen --RAW-CONTROL-CHARS --no-init" | ||
|
||
# COLORS | ||
GREEN := $(shell tput -Txterm setaf 2) | ||
YELLOW := $(shell tput -Txterm setaf 3) | ||
WHITE := $(shell tput -Txterm setaf 7) | ||
RESET := $(shell tput -Txterm sgr0) | ||
|
||
TARGET_MAX_CHAR_NUM=20 | ||
.PHONY: help | ||
## Show help | ||
help: | ||
@echo '' | ||
@echo 'Usage:' | ||
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}' | ||
@echo '' | ||
@echo 'Targets:' | ||
@awk '/^[\%a-zA-Z\-\_0-9]+:/ { \ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = substr($$1, 0, index($$1, ":")-1); \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | ||
|
||
.PHONY: test | ||
test: ${APP_BIN} | ||
${APP_BIN} test -v 2 | ||
|
||
############################################################################### | ||
### Pip Tasks | ||
############################################################################### | ||
PIPDEPTREE := $(VENV_PATH)/bin/pipdeptree | ||
PIP_COMPILE := $(VENV_PATH)/bin/pip-compile | ||
|
||
$(PIP_BIN): | ||
python3 -m venv .venv | ||
$(SYSTEM_PYTHON) -m venv $(VENV_PATH) | ||
|
||
${APP_BIN}: $(PIP_BIN) | ||
$(PIP_BIN) install pip -U | ||
${PIP_BIN} install -r docker/requirements.txt | ||
${PIP_BIN} install -e .[dev,standalone] | ||
$(APP_BIN): $(PIP_BIN) | ||
$(PIP_BIN) install -r docker/requirements.txt -e $(PKG_OPTS) | ||
|
||
.PHONY: pip | ||
.PHONY: pip | ||
## Pip: Reinstall into our virtual env | ||
pip: $(PIP_BIN) | ||
$(PIP_BIN) install pip -U | ||
${PIP_BIN} install -r docker/requirements.txt | ||
${PIP_BIN} install -e .[dev,standalone] | ||
|
||
# Django and Python Commands | ||
|
||
.PHONY: migrate | ||
migrate: ${APP_BIN} | ||
${APP_BIN} migrate | ||
.PHONY: run | ||
run: migrate | ||
${APP_BIN} runserver | ||
.PHONY: shell | ||
shell: migrate | ||
${APP_BIN} shell | ||
.PHONY: clean | ||
clean: | ||
rm -rf .venv | ||
|
||
# Docker and Release | ||
.PHONY: build | ||
build: | ||
docker-compose build | ||
|
||
.PHONY: release | ||
release: ${PIP_BIN} | ||
${PYTHON_BIN} setup.py sdist | ||
twine check dist/* | ||
$(PIP_BIN) install --upgrade pip setuptools wheel | ||
$(PIP_BIN) install -r docker/requirements.txt -e $(PKG_OPTS) | ||
|
||
.PHONY: outdated | ||
## Pip: Show outdated dependencies | ||
outdated: $(PIP_BIN) | ||
$(PIP_BIN) list --outdated | ||
|
||
$(PIPDEPTREE): $(PIP_BIN) | ||
$(PIP_BIN) install pipdeptree | ||
|
||
.PHONY: deps | ||
## Pip: Show dependencies for our package | ||
deps: $(PIPDEPTREE) | ||
$(PIPDEPTREE) -p $(PKG_NAME) | ||
|
||
$(PIP_COMPILE): $(PIP_BIN) | ||
$(PIP_BIN) install pip-tools | ||
|
||
docker/requirements.txt: $(PIP_COMPILE) setup.py setup.cfg docker/requirements.in | ||
$(PIP_COMPILE) --extra=standalone --output-file docker/requirements.txt setup.py docker/requirements.in --no-emit-index-url | ||
|
||
.PHONY: compile | ||
## Pip: Compile requirements | ||
compile: docker/requirements.txt | ||
|
||
|
||
############################################################################### | ||
### Docker Tasks | ||
############################################################################### | ||
|
||
.PHONY: build | ||
## Docker: Build docker container | ||
build: docker/requirements.txt | ||
docker build . --tag test | ||
|
||
############################################################################### | ||
### Django Tasks | ||
############################################################################### | ||
|
||
.PHONY: web | ||
## Django: Launch runserver for testing | ||
web: $(APP_BIN) | ||
$(APP_BIN) runserver 9000 | ||
|
||
.PHONY: shell | ||
## Django: Open Python shell | ||
shell: $(APP_BIN) | ||
$(APP_BIN) shell | ||
|
||
.PHONY: test | ||
## Django: Run tests | ||
test: $(APP_BIN) | ||
$(APP_BIN) test -v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
django~=3.2 | ||
gunicorn | ||
sentry-sdk | ||
whitenoise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,119 @@ | ||
-i https://pypi.org/simple | ||
-e .[standalone] | ||
celery[redis]==4.3.0 | ||
certifi==2019.3.9 | ||
chardet==3.0.4 | ||
django-environ==0.4.5 | ||
django==2.2.24 | ||
djangorestframework-csv==2.1.0 | ||
djangorestframework==3.11.2 | ||
gunicorn | ||
idna==2.8 | ||
Pillow==8.2.0 | ||
prometheus-client==0.7.0 | ||
python-dateutil==2.8.0 | ||
pytz==2021.1 | ||
redis | ||
requests==2.26.0 | ||
six==1.12.0 | ||
sqlparse==0.3.0 | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.9 | ||
# by the following command: | ||
# | ||
# pip-compile --extra=standalone --no-emit-index-url --output-file=docker/requirements.txt docker/requirements.in setup.py | ||
# | ||
amqp==5.1.1 | ||
# via kombu | ||
asgiref==3.6.0 | ||
# via django | ||
async-timeout==4.0.2 | ||
# via redis | ||
billiard==3.6.4.0 | ||
# via celery | ||
celery[redis]==5.2.7 | ||
# via quickstats-django (setup.py) | ||
certifi==2022.12.7 | ||
# via | ||
# requests | ||
# sentry-sdk | ||
charset-normalizer==3.1.0 | ||
# via requests | ||
click==8.1.3 | ||
# via | ||
# celery | ||
# click-didyoumean | ||
# click-plugins | ||
# click-repl | ||
click-didyoumean==0.3.0 | ||
# via celery | ||
click-plugins==1.1.1 | ||
# via celery | ||
click-repl==0.2.0 | ||
# via celery | ||
django==3.2.19 | ||
# via | ||
# -r docker/requirements.in | ||
# django-filter | ||
# django-zakka | ||
# djangorestframework | ||
# drf-nested-routers | ||
# quickstats-django (setup.py) | ||
django-environ==0.10.0 | ||
# via quickstats-django (setup.py) | ||
django-filter==23.2 | ||
# via quickstats-django (setup.py) | ||
django-zakka==0.5.2 | ||
# via quickstats-django (setup.py) | ||
djangorestframework==3.14.0 | ||
# via | ||
# djangorestframework-csv | ||
# drf-nested-routers | ||
# quickstats-django (setup.py) | ||
djangorestframework-csv==2.1.1 | ||
# via quickstats-django (setup.py) | ||
drf-nested-routers==0.93.4 | ||
# via quickstats-django (setup.py) | ||
gunicorn==20.1.0 | ||
# via -r docker/requirements.in | ||
icalendar==5.0.5 | ||
# via quickstats-django (setup.py) | ||
idna==3.4 | ||
# via requests | ||
importlib-metadata==6.6.0 ; python_version < "3.10" | ||
# via quickstats-django (setup.py) | ||
kombu==5.2.4 | ||
# via celery | ||
pillow==9.5.0 | ||
# via quickstats-django (setup.py) | ||
prometheus-client==0.16.0 | ||
# via quickstats-django (setup.py) | ||
prompt-toolkit==3.0.38 | ||
# via click-repl | ||
python-dateutil==2.8.2 | ||
# via | ||
# icalendar | ||
# quickstats-django (setup.py) | ||
pytz==2023.3 | ||
# via | ||
# celery | ||
# django | ||
# djangorestframework | ||
# icalendar | ||
# quickstats-django (setup.py) | ||
redis==4.5.4 | ||
# via celery | ||
requests==2.29.0 | ||
# via quickstats-django (setup.py) | ||
sentry-sdk==1.21.1 | ||
# via | ||
# -r docker/requirements.in | ||
# quickstats-django (setup.py) | ||
six==1.16.0 | ||
# via | ||
# click-repl | ||
# djangorestframework-csv | ||
# python-dateutil | ||
sqlparse==0.4.4 | ||
# via django | ||
unicodecsv==0.14.1 | ||
urllib3==1.26.6 | ||
vine==1.3.0 | ||
whitenoise | ||
# via djangorestframework-csv | ||
urllib3==1.26.15 | ||
# via | ||
# requests | ||
# sentry-sdk | ||
vine==5.0.0 | ||
# via | ||
# amqp | ||
# celery | ||
# kombu | ||
wcwidth==0.2.6 | ||
# via prompt-toolkit | ||
whitenoise==6.4.0 | ||
# via -r docker/requirements.in | ||
zipp==3.15.0 | ||
# via importlib-metadata | ||
|
||
# The following packages are considered to be unsafe in a requirements file: | ||
# setuptools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.