| Name | task-jogger JSON |
| Version |
2.0.1
JSON |
| download |
| home_page | None |
| Summary | A simple Python-based command line tool that is not quite a fully-fledged task runner. |
| upload_time | 2024-09-05 03:23:08 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.10 |
| license | MIT |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
===========
task-jogger
===========
More affectionately known as ``jogger``.
``jogger`` is a simple Python-based command line tool that isn't quite a fully-fledged task *runner*. In addition to supporting arbitrary tasks, run either directly on the command line or as Python scripts, it ships with some common, useful, Django-aware tasks that can adapt their behaviour based on which packages are available in the system.
Full documentation at: https://task-jogger.readthedocs.io/
Installation
============
Install the latest stable version from PyPI::
pip install task-jogger
Quick start
===========
1. Create ``jog.py``
--------------------
The ``jog.py`` file, created in the project root directory, stores the tasks defined for the project. It is a regular Python module, the only requirement being that it defines a ``tasks`` variable as a dictionary.
2. Define ``tasks``
-------------------
Keys in the ``jog.py`` file's ``tasks`` dictionary form each task's name, and values describe the tasks themselves. At their simplest, a task can be a string defining a command to execute on the command line:
.. code-block:: python
# jog.py
tasks = {
'hello': 'echo "Hello, World!"',
'test': 'coverage run python manage.py test'
}
Alternatively, a task can be a Python function that *returns* a command to execute on the command line. This can be useful if the command is more complex to construct or depends on dynamic values:
.. code-block:: python
# jog.py
def run_tests(settings, stdout, stderr):
"""
Run the Django test suite, with coverage.py if installed.
"""
try:
import coverage
except ImportError:
stdout.write('Warning: coverage.py not installed.', style='warning')
return 'python manage.py test'
else:
return 'coverage run python manage.py test'
tasks = {
'test': run_tests
}
Finally, particularly complex tasks can be defined as classes. Such tasks can define their own custom arguments:
.. code-block:: python
# jog.py
from jogger.tasks import Task
class TestTask(Task):
help = 'Run the Django test suite, with coverage.py if installed.'
def add_arguments(self, parser):
parser.add_argument(
'-q', '--quick',
action='store_true',
help=(
'Run a "quick" variant of the task: no coverage analysis and '
'running tests in parallel.'
)
)
def handle(self, *args, **options):
command = 'python manage.py test'
if options['quick']:
command = f'{command} --parallel'
else:
try:
import coverage
except ImportError:
self.stdout.write('Warning: coverage.py not installed.', style='warning')
else:
command = f'coverage run {command}'
self.cli(command)
tasks = {
'test': TestTask
}
3. Run ``jog``
--------------
The ``jog`` command is the interface to the tasks defined in ``jog.py``.
Given the name of a task, ``jog`` will run that task::
$ jog test
If the task accepts arguments, they can also be provided::
$ jog test --quick
Executed with no arguments, ``jog`` will display a list of all available tasks. Tasks defined as functions or classes can define a description to be displayed in this listing. Tasks defined as strings simply display the command they will run. The following shows the output of a ``jog.py`` file containing a mixture of string-based, function-based, and class-based tasks::
$ jog
Available tasks:
string: echo "Hello, World!"
function: A task defined as a function.
class: A task defined as a class.
See "jog class --help" for usage details
Raw data
{
"_id": null,
"home_page": null,
"name": "task-jogger",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Alex Church <alex@church.id.au>",
"download_url": "https://files.pythonhosted.org/packages/a3/ae/7effd3ce6ee07f369868b618f1f17130bdaf74d77770a3f915014cceb0d3/task_jogger-2.0.1.tar.gz",
"platform": null,
"description": "===========\ntask-jogger\n===========\n\nMore affectionately known as ``jogger``.\n\n``jogger`` is a simple Python-based command line tool that isn't quite a fully-fledged task *runner*. In addition to supporting arbitrary tasks, run either directly on the command line or as Python scripts, it ships with some common, useful, Django-aware tasks that can adapt their behaviour based on which packages are available in the system.\n\nFull documentation at: https://task-jogger.readthedocs.io/\n\nInstallation\n============\n\nInstall the latest stable version from PyPI::\n\n pip install task-jogger\n\n\nQuick start\n===========\n\n1. Create ``jog.py``\n--------------------\n\nThe ``jog.py`` file, created in the project root directory, stores the tasks defined for the project. It is a regular Python module, the only requirement being that it defines a ``tasks`` variable as a dictionary.\n\n2. Define ``tasks``\n-------------------\n\nKeys in the ``jog.py`` file's ``tasks`` dictionary form each task's name, and values describe the tasks themselves. At their simplest, a task can be a string defining a command to execute on the command line:\n\n.. code-block:: python\n\n # jog.py\n tasks = {\n 'hello': 'echo \"Hello, World!\"',\n 'test': 'coverage run python manage.py test'\n }\n\nAlternatively, a task can be a Python function that *returns* a command to execute on the command line. This can be useful if the command is more complex to construct or depends on dynamic values:\n\n.. code-block:: python\n\n # jog.py\n def run_tests(settings, stdout, stderr):\n \"\"\"\n Run the Django test suite, with coverage.py if installed.\n \"\"\"\n\n try:\n import coverage\n except ImportError:\n stdout.write('Warning: coverage.py not installed.', style='warning')\n return 'python manage.py test'\n else:\n return 'coverage run python manage.py test'\n\n tasks = {\n 'test': run_tests\n }\n\nFinally, particularly complex tasks can be defined as classes. Such tasks can define their own custom arguments:\n\n.. code-block:: python\n\n # jog.py\n from jogger.tasks import Task\n\n\n class TestTask(Task):\n\n help = 'Run the Django test suite, with coverage.py if installed.'\n\n def add_arguments(self, parser):\n\n parser.add_argument(\n '-q', '--quick',\n action='store_true',\n help=(\n 'Run a \"quick\" variant of the task: no coverage analysis and '\n 'running tests in parallel.'\n )\n )\n\n def handle(self, *args, **options):\n\n command = 'python manage.py test'\n\n if options['quick']:\n command = f'{command} --parallel'\n else:\n try:\n import coverage\n except ImportError:\n self.stdout.write('Warning: coverage.py not installed.', style='warning')\n else:\n command = f'coverage run {command}'\n\n self.cli(command)\n\n tasks = {\n 'test': TestTask\n }\n\n3. Run ``jog``\n--------------\n\nThe ``jog`` command is the interface to the tasks defined in ``jog.py``.\n\nGiven the name of a task, ``jog`` will run that task::\n\n $ jog test\n\nIf the task accepts arguments, they can also be provided::\n\n $ jog test --quick\n\nExecuted with no arguments, ``jog`` will display a list of all available tasks. Tasks defined as functions or classes can define a description to be displayed in this listing. Tasks defined as strings simply display the command they will run. The following shows the output of a ``jog.py`` file containing a mixture of string-based, function-based, and class-based tasks::\n\n $ jog\n Available tasks:\n string: echo \"Hello, World!\"\n function: A task defined as a function.\n class: A task defined as a class.\n See \"jog class --help\" for usage details\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple Python-based command line tool that is not quite a fully-fledged task runner.",
"version": "2.0.1",
"project_urls": {
"Documentation": "https://task-jogger.readthedocs.io/en/latest/",
"Homepage": "https://github.com/oogles/task-jogger",
"Source": "https://github.com/oogles/task-jogger",
"Tracker": "https://github.com/oogles/task-jogger/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1ebc85e15236ec85096a580c47a0d9aa487a96590fcdf3e959c4cf63fb01c3fd",
"md5": "e99ffbc773801898bd527b5525503f30",
"sha256": "96b397d72bf90a34d38557855698e03dc659b9cbeb5acfb28b9dacdd9c01a7e2"
},
"downloads": -1,
"filename": "task_jogger-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e99ffbc773801898bd527b5525503f30",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 32209,
"upload_time": "2024-09-05T03:23:07",
"upload_time_iso_8601": "2024-09-05T03:23:07.243359Z",
"url": "https://files.pythonhosted.org/packages/1e/bc/85e15236ec85096a580c47a0d9aa487a96590fcdf3e959c4cf63fb01c3fd/task_jogger-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a3ae7effd3ce6ee07f369868b618f1f17130bdaf74d77770a3f915014cceb0d3",
"md5": "8466053f7f985ba2d95a6f3c3624d16b",
"sha256": "d57211c70ae05cefb9562f8d706114fea9917ad06e85dda4b5a7288cadabf487"
},
"downloads": -1,
"filename": "task_jogger-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "8466053f7f985ba2d95a6f3c3624d16b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 28943,
"upload_time": "2024-09-05T03:23:08",
"upload_time_iso_8601": "2024-09-05T03:23:08.547561Z",
"url": "https://files.pythonhosted.org/packages/a3/ae/7effd3ce6ee07f369868b618f1f17130bdaf74d77770a3f915014cceb0d3/task_jogger-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-05 03:23:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "oogles",
"github_project": "task-jogger",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "task-jogger"
}