-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathjustfile
More file actions
67 lines (52 loc) · 1.79 KB
/
justfile
File metadata and controls
67 lines (52 loc) · 1.79 KB
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
PYTHON_BINARY := "python3"
VIRTUAL_ENV := "venv"
VIRTUAL_BIN := VIRTUAL_ENV / "bin"
PROJECT_NAME := "easypost"
TEST_DIR := "tests"
# Build the project for release
build:
{{VIRTUAL_BIN}}/python -m build
# Clean the project
clean:
rm -rf {{VIRTUAL_ENV}} dist/ *.egg-info/ .*cache htmlcov *.lcov .coverage
find . -name '*.pyc' -delete
# Test with coverage and generate HTML report
coverage:
{{VIRTUAL_BIN}}/pytest --cov={{PROJECT_NAME}} --cov-branch --cov-report=html --cov-report=lcov --cov-report=term-missing --cov-fail-under=87
# Generate docs
docs:
{{VIRTUAL_BIN}}/pdoc {{PROJECT_NAME}} -o docs
# Initialize the examples submodule
init-examples-submodule:
git submodule init
git submodule update
# Install the project locally (dev mode)
install: init-examples-submodule
{{PYTHON_BINARY}} -m venv {{VIRTUAL_ENV}}
{{VIRTUAL_BIN}}/pip install -e ."[dev]"
# Update the examples submodule
update-examples-submodule:
git submodule init
git submodule update --remote
# Lint the project
lint:
{{VIRTUAL_BIN}}/ruff check {{PROJECT_NAME}}/ {{TEST_DIR}}/
{{VIRTUAL_BIN}}/ruff format --check {{PROJECT_NAME}}/ {{TEST_DIR}}/
# Fix lint issues
lint-fix:
{{VIRTUAL_BIN}}/ruff check --fix {{PROJECT_NAME}}/ {{TEST_DIR}}/
{{VIRTUAL_BIN}}/ruff format {{PROJECT_NAME}}/ {{TEST_DIR}}/
# Run mypy type checking
mypy:
{{VIRTUAL_BIN}}/mypy {{PROJECT_NAME}}/ {{TEST_DIR}}/ --install-types --non-interactive
# Cuts a release for the project on GitHub (requires GitHub CLI)
# tag = The associated tag title of the release
# target = Target branch or full commit SHA
release tag target:
gh release create {{tag}} dist/* --target {{target}}
# Scan for security issues with Bandit
scan:
{{VIRTUAL_BIN}}/bandit -r {{PROJECT_NAME}}
# Run tests
test:
{{VIRTUAL_BIN}}/pytest