-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
190 lines (173 loc) · 5.9 KB
/
Copy pathmise.toml
File metadata and controls
190 lines (173 loc) · 5.9 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#################################################################################
# GLOBALS #
#################################################################################
[tools]
gh = "2.74.2"
jq = "1.8.0"
pre-commit = "4.2.0"
rg = "latest"
usage = "latest"
uv = "0.7.17"
yq = "4.45.4"
[env]
ENV = "local"
LOG_LEVEL = "DEBUG"
TARGET_PLATFORM = "$(mise run detect-platform)"
[settings]
# Explicitly enable idiomatic version file detection
# See: https://github.com/jdx/mise/discussions/4345
# This enables mise to read versions from .python-version
idiomatic_version_file_enable_tools = ["python"]
#################################################################################
# SETUP #
#################################################################################
[tasks.env-setup]
description = "Add tool configurations to your shell config file"
run = """
#!/usr/bin/env zsh
autoload -Uz compinit
compinit
if [[ ! -z "${ZSH_NAME}" ]]; then
echo "Running on Zsh..."
echo '' | tee -a ~/.zshrc
echo '# Setup mise' | tee -a ~/.zshrc
echo 'eval "$($HOME/.local/bin/mise activate zsh)"' | tee -a ~/.zshrc
echo 'eval "$($HOME/.local/bin/mise completion zsh)"' | tee -a ~/.zshrc
echo "##################################################"
echo "# Now run 'source ~/.zshrc' to apply the changes #"
echo "##################################################"
elif [[ ! -z "${BASH}" ]]; then
echo "Running on Bash..."
echo '' | tee -a ~/.bashrc
echo '# Setup mise' | tee -a ~/.bashrc
echo 'eval "$($HOME/.local/bin/mise activate bash)"' | tee -a ~/.bashrc
echo 'eval "$($HOME/.local/bin/mise completion bash)"' | tee -a ~/.bashrc
echo "###################################################"
echo "# Now run 'source ~/.bashrc' to apply the changes #"
echo "###################################################"
elif [[ ! -z "${FISH_VERSION}" ]]; then
echo "Running on Fish..."
echo '' | tee -a ~/.config/fish/config.fish
echo '# Setup mise' | tee -a ~/.config/fish/config.fish
echo 'eval "$($HOME/.local/bin/mise activate fish)"' | tee -a ~/.config/fish/config.fish
echo 'eval "$($HOME/.local/bin/mise completion fish)"' | tee -a ~/.config/fish/config.fish
echo "####################################################################"
echo "# Now run 'source ~/.config/fish/config.fish' to apply the changes #"
echo "####################################################################"
else
echo "Unknown shell"
exit 1
fi
"""
[tasks.brew-install]
description = "Install Homebrew"
run = """
#!/usr/bin/env zsh
if [[ "${OS}" == "Darwin" ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo >> ~/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
else
echo "Unsupported OS $(OS)"
exit 1
fi
"""
#################################################################################
# DEPENDENCIES #
#################################################################################
[tasks.detect-platform]
description = "Detect and return the target platform"
run = """
#!/usr/bin/env zsh
export OS="$(uname -s)"
ARCH="$(uname -m)"
ARM_ARCHS=(arm64 aarch64)
if [[ "${OS}" == "Darwin" ]]; then
if [[ "${ARCH}" == "arm64" ]]; then
echo "darwin-arm64"
elif [[ "${ARCH}" == "x86_64" ]]; then
echo "darwin-amd64"
else
echo "Unsupported architecture ${ARCH} on macOS" >&2
exit 1
fi
elif [[ "${OS}" == "Linux" ]]; then
if [[ "${ARCH}" == "x86_64" ]]; then
echo "linux-amd64"
elif (($ARM_ARCHS[(Ie)${ARCH}])); then
echo "linux-arm64"
else
echo "Unsupported architecture ${ARCH} on Linux" >&2
exit 1
fi
else
echo "Unsupported OS ${OS}" >&2
exit 1
fi
"""
[tasks.uv-init]
description = "Initialise the uv environment and create virtual environment"
run = """
#!/usr/bin/env zsh
PYTHON_VERSION="$(mise ls python --current --json | jq -r '.[].version')"
uv venv --python "${PYTHON_VERSION}"
"""
[tasks.uv-install]
description = "Install dependencies using uv"
depends = ["uv-init"]
run = """
#!/usr/bin/env zsh
uv pip install -e ".[dev]"
"""
[tasks.uv-sync]
description = "Sync the uv dependencies and update the lock file"
run = """
#!/usr/bin/env zsh
uv lock
uv pip install -e ".[dev]"
uv sync
"""
[tasks.pre-commit-run]
description = "Install and run the pre-commit hooks"
run = """
#!/usr/bin/env zsh
uv run pre-commit install --install-hooks --overwrite
uv run pre-commit run --all-files
"""
[tasks.uv-cache-clean]
description = "Clear uv cache to ensure environment is clean"
run = """
#!/usr/bin/env zsh
uv cache clean
"""
#################################################################################
# CLEANUP #
#################################################################################
[tasks.clean]
description = "Delete all compiled Python files and cache dirs"
run = """
#!/usr/bin/env zsh
find . -type f -name "*.DS_Store" -ls -delete
find . -type f -name "*.py[co]" -delete
find . -type f -name "*.log" -delete
find . -type f -name "*.coverage*" -delete
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type d -name "*.pytest_cache" -exec rm -rf {} +
find . -type d -name "*.mypy_cache" -exec rm -rf {} +
find . -type d -name "*.ruff_cache" -exec rm -rf {} +
find . -type d -name ".ipynb_checkpoints" -exec rm -rf {} +
find . -type d -name "htmlcov" -exec rm -rf {} +
find . -type d -empty -delete
"""
[tasks.clean-all]
description = "Deep clean including virtual environment and MLflow artifacts"
depends = ["clean"]
run = """
#!/usr/bin/env zsh
rm -rf .venv
rm -rf mlruns
rm -rf .pytest_cache
rm -rf .coverage
echo "Deep clean completed. Run 'mise run uv-install' to reinstall dependencies."
"""