-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjustfile
153 lines (115 loc) · 3.35 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Just is a crossplatform task-runner, similar to make.
# And justfiles are equivalent to makefiles.
#
# Official docs:
# - https://just.systems/man/en
#
# Usage:
# > just --help
# > just <taskname>
#
# Notes:
# - Comments immediately preceding a recipe will appear in just --list:
# load environment variables from .env file
set dotenv-filename := ".env"
set dotenv-load := true
# Help target
help:
@ just --list --unsorted
# remove generated files & dirs
clean-venv:
@ rm -fr bin lib lib64 pyvenv.cfg
@ rm -fr .venv
alias clear-venv := clean-venv
# create directories
ensure-dirs:
@ mkdir -p var/cache
@ mkdir -p var/log
@ mkdir -p var/run
@ mkdir -p var/static
@ mkdir -p var/tmp
# full initial pythondev-installation
install: ensure-dirs create-venv symlink-venv-dirs upgrade-pip poetry-install
# create python39 virtual-environment
create-venv:
PYENV_VERSION=3.9 python -m venv .venv
# symlink venv-dirs to make bin/python work
symlink-venv-dirs:
@ ln -sf .venv/bin
@ ln -sf .venv/lib
@ ln -sf .venv/pyvenv.cfg
# symlink ipython to ip
symlink-ipython:
@ cd .venv/bin && ln -sf ipython ip
# upgrade pip itself
upgrade-pip:
.venv/bin/pip install -U pip
# open an ipython-shell
ipython:
bin/ipython
alias ip := ipython
# run poetry install
poetry-install:
poetry install
# update poetry.lock
poetry-lock:
poetry lock
# show packages
poetry-show:
poetry show
# show outdated packages
poetry-show-outdated:
poetry show --outdated
# export poetry-defined requirements to a pip-installable requirements-file
[linux]
poetry-export-requirements: poetry-lock
@ poetry export -f requirements.txt --output etc/requirements.txt
@ cat etc/requirements-header.txt <(echo "") etc/requirements.txt > etc/temp.txt && mv etc/temp.txt etc/requirements.txt
@ cp etc/requirements.txt requirements.txt
@ echo -e "Updated etc/requirements.txt"
# run pytest
pytest:
bin/pytest tests
# run pytest with coverage
pytest-coverage:
bin/pytest tests --color=yes --cov=apps --cov=scouts_wwdb_api --cov-report term-missing --cov-report html --cov-report xml --junit-xml='var/cache/coverage/pytest.xml'
alias pytest-cov := pytest-coverage
# run django-admin to create a superuser
django-createsuperuser:
bin/django-admin createsuperuser
# run django-admin to create migrations
django-makemigrations:
bin/django-admin makemigrations
# run django-admin to apply migrations
django-migrate:
bin/django-admin migrate
# run django-admin to collect static files
django-collectstatic:
bin/django-admin collectstatic
# run django-admin to collect static files with no input
django-collectstatic-noinput:
bin/django-admin collectstatic --noinput
# run django-admin to run the development server
django-runserver address="127.0.0.1:8000":
bin/django-admin runserver {{address}}
# open the django-admin in browser
url-admin:
@ xdg-open "http://127.0.0.1:8000/admin/"
# open the swagger-api in browser
url-swagger:
@ xdg-open "http://127.0.0.1:8000/swagger/"
# open the redoc-api in browser
url-redoc:
@ xdg-open "http://127.0.0.1:8000/redoc/"
# switch to staging-branch and git pull to update
update-staging:
git co staging
git pull
# lint python-code with isort + black
lint: isort black
# run black
black:
bin/black src/**/*.py
# run isort
isort:
bin/isort src/**/*.py