-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·145 lines (115 loc) · 3.24 KB
/
run
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
#!/usr/bin/env bash
set -o errexit
set -o pipefail
DC="${DC:-exec}"
# If we're running in CI we need to disable TTY allocation for docker compose
# commands that enable it by default, such as exec and run.
TTY=""
if [[ ! -t 1 ]]; then
TTY="-T"
fi
# -----------------------------------------------------------------------------
# Helper functions start with _ and aren't listed in this script's help menu.
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
function cov:test {
# Run pytest
coverage run -m pytest "${@}"
}
function cov:test-slow {
# Run pytest & show 10 slowest tests
coverage run -m pytest "${@}" --durations 10
}
function cov:report {
# Generate coverage report to terminal
coverage report "${@}"
}
function cov:html {
# Output coverage report to ./htmlcov
coverage html "${@}"
}
function nox:cov {
# Check code for formatting violations
nox -s coverage-3.13 "${@}"
}
function nox:docs {
# Create Sphinx documentation in ./docs/_build directory
nox -s docs-3.13 "${@}"
}
function nox:lint {
# Run a number of flake8 linting tests
nox -s lint-3.13 "${@}"
}
function nox:pyright {
# Run pyright typing checks
# cmd nox -s pyright-3.13 "${@}"
nox -s pyright-3.13 "${@}"
}
function nox:test {
# Run several pytest and coverage checks
# cmd nox -s tests-3.13 "${@}"
nox -s tests-3.13 "${@}"
}
function nox:tests {
# Run tests for all currently supported Python versions
nox -s tests-3.10 tests-3.11 tests-3.12 tests-3.13 "${@}"
}
function nox:re-tests {
# Run tests for all currently supported Python versions
nox -rs tests-3.10 tests-3.11 tests-3.12 tests-3.13 "${@}"
}
function nox:current {
# Run code quality tests only for latest supported Python version
nox -s lint-3.13 coverage-3.13 safety-3.13 tests-3.13 "${@}"
}
function nox:re-current {
# Run tests only for latest supported Python version
# DO NOT REBUILD VENVS
nox -s lint-3.13 coverage-3.13 safety-3.13 tests-3.13 "${@}"
}
function nox:all {
# Perform all nox code quality tests together
nox
}
function nox:re-all {
# Perform all nox code quality tests together
# DO NOT REBUILD VENVS
nox -rs
}
function poe:old {
# List any installed packages that are outdated
poetry show -ol
}
function poe:up {
# Update any outdated packages
poetry update
}
function reqs:dev {
# Export all package requirements
poetry export --with=dev --output requirements-dev.txt
}
function reqs:prod {
# Export production package requirements
poetry export --output requirements.txt
}
function reqs:all {
# Export production package requirements
poetry export --output requirements.txt
poetry export --with=dev --output requirements-dev.txt
}
function ruff:check {
# check for linting errors. Do not fix.
ruff check .
}
function ruff:fix {
# check for linting errors and apply fixes.
ruff check --fix .
}
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
# This idea is heavily inspired by: https://github.com/adriancooney/Taskfile
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"