diff options
| author | Roy Sommer <roy@sommer.co.il> | 2019-12-23 00:13:27 +0200 |
|---|---|---|
| committer | Roy Sommer <roy@sommer.co.il> | 2019-12-23 00:13:27 +0200 |
| commit | 4c6711a8d7e6d8aaecc0c6499f416dfea1ff3f6a (patch) | |
| tree | af4c524f908c394bcd13feb4f0b34270b8a6ec7b | |
| parent | v1.0.0 (diff) | |
| download | taskipy2-4c6711a8d7e6d8aaecc0c6499f416dfea1ff3f6a.zip | |
renaming
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | pyproject.toml | 4 | ||||
| -rwxr-xr-x | taskipy/cli.py | 2 | ||||
| -rw-r--r-- | taskipy/run.py | 4 | ||||
| -rw-r--r-- | tests/fixtures/project_with_pre_post_task_hooks/pyproject.toml | 2 | ||||
| -rw-r--r-- | tests/fixtures/project_with_pyproject_and_tasks/pyproject.toml | 2 | ||||
| -rw-r--r-- | tests/test_taskipy.py | 2 |
7 files changed, 16 insertions, 16 deletions
@@ -38,7 +38,7 @@ poetry add --dev taskipy ``` ### Adding Tasks -In your `pyproject.toml` file, add a new section called `[tool.taskify.tasks]`. +In your `pyproject.toml` file, add a new section called `[tool.taskipy.tasks]`. The section is a key-value map, from the names of the task to the actual command that should be run in the shell. @@ -46,7 +46,7 @@ Example: __pyproject.toml__ ```toml -[tool.taskify.tasks] +[tool.taskipy.tasks] test = "python -m unittest tests/test_*.py" lint = "pylint tests taskipy" ``` @@ -67,14 +67,14 @@ poetry run task test #### Grouping Subtasks Together Some tasks are composed of multiple subtasks. Instead of writing plain shell commands and stringing them together, you can break them down into multiple subtasks: ```toml -[tool.taskify.tasks] +[tool.taskipy.tasks] lint_pylint = "pylint tests taskipy" lint_mypy = "mypy tests taskipy" ``` And then create a composite task: ```toml -[tool.taskify.tasks] +[tool.taskipy.tasks] lint = "task lint_pylint && task lint_mypy" lint_pylint = "pylint tests taskipy" lint_mypy = "mypy tests taskipy" @@ -83,14 +83,14 @@ lint_mypy = "mypy tests taskipy" #### Pre Task Hook Tasks might also depend on one another. For example, tests might require some binaries to be built. Take the two following commands, for instance: ```toml -[tool.taskify.tasks] +[tool.taskipy.tasks] test = "python -m unittest tests/test_*.py" build = "make ." ``` You could make tests depend on building, by using the **pretask hook**: ```toml -[tool.taskify.tasks] +[tool.taskipy.tasks] pre_test = "task build" test = "python -m unittest tests/test_*.py" build = "make ." @@ -101,14 +101,14 @@ The pretask hook looks for `pre_<task_name>` task for a given `task_name`. It wi #### Post Task Hook From time to time, you might want to run a task in conjuction with another. For example, you might want to run linting after a successful test run. Take the two following commands, for instance: ```toml -[tool.taskify.tasks] +[tool.taskipy.tasks] test = "python -m unittest tests/test_*.py" lint = "pylint tests taskipy" ``` You could make tests trigger linting, by using the **posttask hook**: ```toml -[tool.taskify.tasks] +[tool.taskipy.tasks] test = "python -m unittest tests/test_*.py" post_test = "task lint" lint = "pylint tests taskipy" diff --git a/pyproject.toml b/pyproject.toml index c5060ed..3ca8bef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "taskipy" description = "tasks runner for python projects" -version = "1.0.0" +version = "1.0.1" authors = ["Roy Sommer <roy@sommer.co.il>"] readme = "README.md" repository = "https://github.com/illBeRoy/taskipy" @@ -28,7 +28,7 @@ pylint = "^2.4.4" mypy = "^0.761" rope = "^0.14.0" -[tool.taskify.tasks] +[tool.taskipy.tasks] test = "python -m unittest tests/test_*.py" post_test = "./task lint" diff --git a/taskipy/cli.py b/taskipy/cli.py index 4ef6170..a450db0 100755 --- a/taskipy/cli.py +++ b/taskipy/cli.py @@ -3,7 +3,7 @@ import argparse from taskipy.run import run_task def main(): - parser = argparse.ArgumentParser(prog='task', description='runs a task specified in your pyproject.toml under [tool.taskify.tasks]') + parser = argparse.ArgumentParser(prog='task', description='runs a task specified in your pyproject.toml under [tool.taskipy.tasks]') parser.add_argument('name', help='name of the task') args = parser.parse_args() diff --git a/taskipy/run.py b/taskipy/run.py index 4c7d553..b8ae4ab 100644 --- a/taskipy/run.py +++ b/taskipy/run.py @@ -25,9 +25,9 @@ def run_task(task_name: str, cwd=os.curdir): sys.exit(1) try: - tasks = pyproject['tool']['taskify']['tasks'] + tasks = pyproject['tool']['taskipy']['tasks'] except: - print('no tasks found. add a [tool.taskify.tasks] section to your pyproject.toml') + print('no tasks found. add a [tool.taskipy.tasks] section to your pyproject.toml') sys.exit(127) commands = [] diff --git a/tests/fixtures/project_with_pre_post_task_hooks/pyproject.toml b/tests/fixtures/project_with_pre_post_task_hooks/pyproject.toml index fb9a142..032f87f 100644 --- a/tests/fixtures/project_with_pre_post_task_hooks/pyproject.toml +++ b/tests/fixtures/project_with_pre_post_task_hooks/pyproject.toml @@ -2,7 +2,7 @@ name = "taskipy" description = "tasks runner for python projects" -[tool.taskify.tasks] +[tool.taskipy.tasks] pre_hello = "echo 'pre_task'" hello = "echo 'hello'" post_hello = "echo 'post_task'" diff --git a/tests/fixtures/project_with_pyproject_and_tasks/pyproject.toml b/tests/fixtures/project_with_pyproject_and_tasks/pyproject.toml index 289fcf4..d5b9ba5 100644 --- a/tests/fixtures/project_with_pyproject_and_tasks/pyproject.toml +++ b/tests/fixtures/project_with_pyproject_and_tasks/pyproject.toml @@ -2,7 +2,7 @@ name = "taskipy" description = "tasks runner for python projects" -[tool.taskify.tasks] +[tool.taskipy.tasks] create_hello_txt = "echo 'hello, world' > hello.txt" exit_17 = "exit 17" print_hello_stdout = "echo 'hello stdout'" diff --git a/tests/test_taskipy.py b/tests/test_taskipy.py index fdd9ac5..8e220c9 100644 --- a/tests/test_taskipy.py +++ b/tests/test_taskipy.py @@ -113,7 +113,7 @@ class TaskRunFailTestCase(TaskipyTestCase): cwd = self.create_test_dir_from_fixture('project_with_pyproject_without_tasks_section') exit_code, stdout, _ = self.run_task('task_that_does_not_exist', cwd=cwd) - self.assertSubstr('no tasks found. add a [tool.taskify.tasks] section to your pyproject.toml', stdout) + self.assertSubstr('no tasks found. add a [tool.taskipy.tasks] section to your pyproject.toml', stdout) self.assertEqual(exit_code, 127) def test_exiting_with_code_1_and_printing_if_no_pyproject_toml_file_found(self): |