-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
60 lines (47 loc) · 2.21 KB
/
Copy pathjustfile
File metadata and controls
60 lines (47 loc) · 2.21 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
set quiet
set lazy # introduced in 1.47.0
_default:
just --list
# regenerate the autodocs
[no-exit-message]
update-docs:
uv run -- _meta/update_docs.py
prettier --write --log-level silent README.md
# regenerate the json schema
[no-exit-message]
dump-schema:
uv run -- potent schema dump > schema.json
docs: update-docs dump-schema
# run unit tests against all supported Python versions
[positional-arguments]
test-versions *args:
# this handles the build and installs magically - it's very cool
uv run -- tox -p "$@"
lint *args:
uv run -- ruff check {{ args }}
typecheck:
uv run -- pyright
_is_valid_python_identifier name:
{{ assert(name =~ "^[A-Za-z_]*$", "not a valid python identifier") }}
# create new command
init-command name: (_is_valid_python_identifier name) && (lint "src/potent/cli.py" "--fix" "--quiet")
{{ assert(path_exists("src/potent/commands/" + name + ".py") == "false", "command `" + name + "` already exists") }}
cp _meta/command.py.tmpl src/potent/commands/{{ name }}.py
sed -i '' 's/<NAME>/{{ name }}/g' src/potent/commands/{{ name }}.py
sed -i '' $'/# COMMAND IMPORTS/i\\\nfrom potent.commands.{{ name }} import app as {{ name }}\\\n' src/potent/cli.py
sed -i '' $'/# COMMANDS/i\\\napp.command({{ name }}, name="*")\\\n' src/potent/cli.py
# create new operation
init-operation name: (_is_valid_python_identifier name) && (lint "src/potent/plan.py" "--fix" "--quiet")
{{ assert(path_exists("src/potent/operations/" + name + ".py") == "false", "operation `" + name + "` already exists") }}
cp _meta/operation.py.tmpl src/potent/operations/{{ name }}.py
sed -i '' $'/# OPERATION IMPORTS/i\\\nfrom potent.operations.{{ name }} import TKTK\\\n' src/potent/plan.py
sed -i '' $'/# OPERATIONS/i\\\n TKTK,\\\n' src/potent/plan.py
bump level: lint typecheck docs
uv version --bump {{ level }}
package_version := `uv run potent --version`
[confirm("This will release the package as written. Have you already run `just bump LEVEL`? (yN)")]
release:
rm -rf dist
uv build
uv publish
gh release create v{{ package_version }} --notes "See [the changelog](https://github.com/xavdid/potent/blob/main/CHANGELOG.md#{{ replace(package_version, ".", "") }}) for detailed information."