aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2022-02-10 08:56:27 -0600
committerGitHub <noreply@github.com>2022-02-10 16:56:27 +0200
commit0b1e3ee299fd0eae0d85637fb469934743bc7c38 (patch)
tree417110f07576f96a1056ddc6b169dd87770bbc2e /README.md
parentReplace toml with tomli for TOML v1 support (#43) (diff)
downloadtaskipy2-0b1e3ee299fd0eae0d85637fb469934743bc7c38.zip
Add support for recursive variables (#44)
* Use `self` in pyproject * Add support for recursive variables * Remove duplicate psutil from pyproject * Tweak implementation based on issue feedback * Add type hint to vars_dict * Use `count_of_previously_resolved_vars` name * Clarify test name * Revert refactor and use tuple for variable type return * Add non recursive variable test case * Alter test case name * Add recursive variable docs * Add recursive variables to table of contents * Use PyProject to access static methods * Add better handling of invalid variables * Fix lockfile hash * Move variable import * Only resolve variables once if we are using vars * Fix minor type issue * Reword error message
Diffstat (limited to 'README.md')
-rw-r--r--README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/README.md b/README.md
index 5a955d4..d15a76c 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,7 @@
- [Using Variables](#using-variables)
- [String Formatting](#string-formatting)
- [Always Use Variables](#always-use-variables)
+ - [Recursive Variables](#recursive-variables)
- [Using Taskipy Without Poetry](#using-taskipy-without-poetry)
- [Installing With PIP](#installing-with-pip)
- [Running Tasks](#running-tasks-1)
@@ -258,6 +259,24 @@ lint = "pylint {path}"
black = "black {path}"
```
+#### Recursive Variables
+
+If we want to use variables within other variables, we can utilize recursive variables. By default, variables are not recursive, but we can specify a variable to be recursive by setting the `recursive` key to `true`.
+
+```toml
+[tool.taskipy.settings]
+use_vars = true
+
+[tool.taskipy.variables]
+src_dir = "src"
+package_dir = { var = "{src_dir}/package", recursive = true }
+
+[tool.taskipy.tasks]
+echo = "echo {package_dir}"
+```
+
+In this example, we could run `task echo` and we would then see `src/package`.
+
### Using Taskipy Without Poetry
Taskipy was created with poetry projects in mind, but actually only requires a valid `pyproject.toml` file in your project's directory. As a result, you can use it even eithout poetry: