-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
executable file
·40 lines (31 loc) · 940 Bytes
/
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
#!/usr/bin/env -S just --working-directory . --justfile
env_name := "venv"
python_dir := if os_family() == "windows" { env_name + "/Scripts" } else { env_name + "/bin" }
python := python_dir + if os_family() == "windows" { "/python.exe" } else { "/python3" }
# List all the available commands
default:
@just --list
# Install packages in the virtual environment
[private]
package_venv: venv
{{python}} -m pip install --upgrade pip
{{python}} -m pip install -r requirements.txt
# Make a new virtual environment
[private]
make_venv:
python3 -m venv {{env_name}}
just package_venv
# Make the environment if it does not exit
[private]
@venv:
[ -d {{env_name}} ] || just make_venv
# Removes the virtual environment
clean:
rm -rf {{env_name}}
# Upgrades packages and pre-commit
upgrade: venv
just package_venv
just pre-commit
# Setup pre-commit hooks
pre_commit: venv
{{python_dir}}/pre-commit install --install-hooks