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
|
# turbo-python tools.
#
# Each [[tool]] becomes one line of the Python menu, in the order they appear
# here. name is what the menu shows; a letter between tildes is its hot key, and
# no two tools should claim the same one.
#
# command goes to "sh -c", so pipes, globs and && work: one entry can be a
# whole sequence.
#
# menu says which menu it appears in. Leave it out and the tool goes into the
# Python menu; name anything else and that menu is created for you, in the order
# the names first appear here. A tool that has nothing to do with Python belongs
# in one of your own:
#
# [[tool]]
# name = "~E~cho"
# command = "echo TADA"
# menu = "Tools"
#
# A {{label}} in a command is a value the editor asks for before running it, in
# a box titled after the tool. The text between the braces is what it asks for:
#
# [[tool]]
# name = "~A~dd a dependency"
# command = "uv add {{package}}"
#
# The value is quoted, so a path with a space in it stays one argument. Add ...
# inside the braces when you mean several arguments rather than one value:
#
# [[tool]]
# name = "Test ~o~ne"
# command = "uv run pytest {{extra flags...}}"
#
# Double braces, not single. Single ones appear in real commands — awk '{print
# $1}' and find . -exec rm {} + are both ordinary things to put here — and
# neither is asking you for anything.
#
# output says where what the command prints goes:
# popup a dialog that fills in as it runs, and says the exit code (default)
# terminal a terminal window, for anything that reads the keyboard or runs long
# editor an editing window once it has finished, to search with Ctrl-F
#
# Commands run in the directory the editor was started in, which is why they
# see the whole project when you start from its root.
#
# Everything below goes through uv, which creates the environment, resolves the
# dependencies, and runs the tools inside it — so no command here needs an
# environment to have been activated first. Replace `uv run x` with `x` if you
# would rather activate one yourself.
[[tool]]
name = "~E~nvironment"
# The one command that has to come first in a new project: it creates the
# virtual environment everything else runs inside. The name is asked for rather
# than fixed, because .venv is only the usual answer and not the only one.
command = "uv venv {{directory, usually .venv}}"
output = "popup"
[[tool]]
name = "~S~ync"
command = "uv sync"
output = "popup"
[[tool]]
name = "~F~ormat"
command = "uv run ruff format ."
output = "popup"
[[tool]]
name = "~L~int"
command = "uv run ruff check ."
output = "popup"
[[tool]]
name = "~T~est"
command = "uv run pytest"
output = "popup"
[[tool]]
name = "~R~un"
command = "uv run {{script}}"
# A terminal, not a popup: a program that reads the keyboard has to be able to
# be answered, and one that runs long has to be able to be interrupted. Python
# scripts are usually both.
output = "terminal"
# A tool naming a `menu` gets a menu of its own on the bar. Nothing above does,
# so every tool above is in the Python menu. This one is in a menu called Tools,
# which appears between Python and Help — that is the whole mechanism.
[[tool]]
name = "~E~cho"
command = "echo 🎉 tada!"
menu = "Tools"
output = "terminal"
|