-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathjustfile
More file actions
140 lines (108 loc) · 2.57 KB
/
justfile
File metadata and controls
140 lines (108 loc) · 2.57 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
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
set dotenv-load := true
sphinx-sphinxbuild := "sphinx-build"
sphinx-sphinxopts := ""
sphinx-sourcedir := "docs"
sphinx-builddir := "_build"
# By default, run checks and tests, then format and lint
default:
@just format
@just check
@just test
@just lint
#
# Installing, updating and upgrading dependencies
#
install:
uv sync --dev
# Update all dependencies
update:
uv sync --dev --upgrade
@just compile
# Generate locked requirements files based on dependencies in pyproject.toml
compile:
uv pip compile -o requirements.txt pyproject.toml
uv pip compile --group dev -o requirements_dev.txt pyproject.toml
_clean-compile:
rm -f requirements.txt
rm -f requirements_dev.txt
#
# Development tooling - linting, formatting, etc
#
# Format with black and isort
format:
uv run black ./docs './pyee' ./tests
uv run isort --settings-file . ./docs './pyee' ./tests
# Lint with flake8
lint:
uv run flake8 ./docs './pyee' ./tests
uv run validate-pyproject ./pyproject.toml
# Check type annotations with pyright
check:
uv run npx pyright@latest
# Check type annotations with mypy
mypy:
uv run mypy .
# Run tests with pytest
test:
uv run pytest ./tests
@just _clean-test
_clean-test:
rm -f pytest_runner-*.egg
rm -rf tests/__pycache__
# Run tests using tox
tox:
uv run tox
@just _clean-tox
_clean-tox:
rm -rf .tox
#
# Shell and console
#
# Open a bash shell with the venv activated
shell:
uv run bash
# Open a Jupyter console
console:
uv run jupyter console
#
# Documentation
#
# Live generate docs and host on a development webserver
docs:
uv run mkdocs serve
# Generate man page and open for preview
man: (sphinx 'man')
uv run man -l _build/man/pyee.1
# Build the documentation
build-docs:
@just mkdocs
@just sphinx man
# Run mkdocs
mkdocs:
uv run mkdocs build
# Run sphinx
sphinx TARGET:
uv run {{ sphinx-sphinxbuild }} -M "{{ TARGET }}" "{{ sphinx-sourcedir }}" "{{ sphinx-builddir }}" {{ sphinx-sphinxopts }}
_clean-docs:
rm -rf site
rm -rf _build
#
# Package publishing
#
# Build the package
build:
uv build
_clean-build:
rm -rf dist
# Tag the release in git
tag:
uv run git tag -a "v$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" -m "Release $(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
# Build the package and publish it to PyPI
publish:
uv publish
# Clean up loose files
clean: _clean-compile _clean-test _clean-tox _clean-docs
rm -rf .venv
rm -rf pyee.egg-info
rm -f pyee/*.pyc
rm -rf pyee/__pycache__