Task runner! #1264
Replies: 9 comments 24 replies
-
Woah, awesome, thanks! Simplifying devops is always a huge win. (I was using poethepoet since poetry doesn't have a task runner.) |
Beta Was this translation helpful? Give feedback.
-
Hello and thank you for |
Beta Was this translation helpful? Give feedback.
-
Thanks for the project, but this seems like pretty major scope creep, and I don't understand the use case. I just wanted something to manage installing dev tools and switching between versions of them, like The There's always room for another |
Beta Was this translation helpful? Give feedback.
-
I think many people will applaud the task runner capabilities (even though some will complain), since this is something you need soooooo often, and end up with a bunch of bash scripts in the end (or worse, package.json "scripts"). Using mise for this would be nice! |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the awesome project, mise tasks are really looking interesting. E.g say that my .mise.toml file is located in
and I invoke This would be really useful for tasks that always need to be executed on a specific level in a directory tree. |
Beta Was this translation helpful? Give feedback.
-
FeedbackWe have a set of tasks like this: [tasks."setup:libraries"]
depends = [
"setup:dependencies",
"setup:libraries:*", # WORKAROUND
]
[tasks."setup:libraries:cocoapods"]
depends = ["setup:dependencies:ios"]
run = ["gem install cocoapods"]
[tasks."setup:libraries:capacitor"]
depends = [
"setup:dependencies:ios",
"setup:dependencies:android",
"setup:libraries:cocoapods",
]
run = ["npm install capacitor"] But it feels a bit wrong to mix task running (running sub-tasks) with dependencies. I'd prefer if we could specify it like this: [tasks."setup:libraries"]
depends = ["setup:dependencies"]
run_tasks = ["setup:libraries:*"] # SUGGESTION
[tasks."setup:libraries:cocoapods"]
depends = ["setup:dependencies:ios"]
run = ["gem install cocoapods"]
[tasks."setup:libraries:capacitor"]
depends = [
"setup:dependencies:ios",
"setup:dependencies:android",
"setup:libraries:cocoapods",
]
run = ["npm install capacitor"] |
Beta Was this translation helpful? Give feedback.
-
I realized that some tasks will be used frequently and written manually every time when creating a Python project (or any other language). An idea that could reduce the need to write common tasks every time is a way to copy task "templates" defined in example: [tasks.format]
run = 'ruff check . --fix; ruff format .'
alias = 'f'
[tasks.lint]
run = 'ruff check .; ruff check . --diff'
alias = 'l'
[tasks.test]
run = ['pytest -s -x --cov=fast_zero -vv']
alias = 't'
[tasks.build]
run = 'poetry build'
alias = 'b' |
Beta Was this translation helpful? Give feedback.
-
The best thing about |
Beta Was this translation helpful? Give feedback.
-
Is there a way to use variables in tasks, like in Makefiles and justfiles (apart from env vars)? |
Beta Was this translation helpful? Give feedback.
-
rtx is now a task runner! Now you can define common tasks in
.rtx.toml
like this:Then you can run it like this:
rtx run build
. You can manage your scripts either by yourself or by committing them to your project repo to share with others. Of course, rtx launches these with the rtx environment—meaning all the dev tools and env vars will be configured as you'd expect. It's basically the same as running it withrtx exec
—though with extra features like watching for changes or launching sub-tasks as dependencies.There is an alternative way to add scripts by just using bash scripts with special metadata comments (this one needs to live in
.rtx/tasks/fmt-check
to be picked up by rtx):This bash script can be launched with
rtx run fmt-check
—filename is the name of the task. The script does not need to be referenced anywhere else. This makes them quick to author.I like the bash scripts more personally. They have better syntax highlighting and can be linted with shellcheck—which would be challenging inside of TOML. I like that the bash scripts are a one-step process to create. You don't even need to
chmod +x
on them—rtx will prompt to make it executable if it isn't already set. I also like that these scripts don't require rtx to run for potential non-rtx users.I think the downside of bash vs .rtx.toml they're a little less obvious to use with the magic comments and everything. You can mix and match both kinds. bash tasks can depend on toml ones and vice-versa.
Some other features on the task runner:
rtx watch -t build
will watch for file modifications to re-run the task(s)rtx task ls
will display a list of available tasksrtx task edit
edits a task in $EDITOR. This works even if it hasn't been created. I'm probably going to use this a lot anytime I want to start a little script.Like everything else in rtx, tasks are defined with a merged hierarchy. Meaning you can have an
.rtx.toml
(or.rtx/tasks
scripts) file in your home directory with global actions, then some actions specific to your company in~/work/.rtx.toml
, and project-local actions in~/work/myproj/.rtx.toml
. In case of conflicts the nearest configuration wins. This may make rtx quite unique in the world of task runners. Most/all of them support some form of importing but I don't know of any that does it implicitly like rtx.Full docs are here: https://github.com/jdx/rtx#experimental-task-runner. It should be ready for you to use but just know that while it's experimental the behavior may change without warning on new releases.
Let me know what you think. Also if you use any other task runner that you like let me know what you like about it.
Beta Was this translation helpful? Give feedback.
All reactions