Name | dev-cmd JSON |
Version |
0.13.0
JSON |
| download |
home_page | None |
Summary | A simple development command runner for Python projects. |
upload_time | 2025-01-17 00:33:27 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
keywords |
automation
command
runner
testing
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# dev-cmd
[![PyPI Version](https://shields.io/pypi/v/dev-cmd.svg)](https://pypi.org/project/dev-cmd/)
[![License](https://shields.io/pypi/l/dev-cmd.svg)](LICENSE)
[![Supported Pythons](https://shields.io/pypi/pyversions/dev-cmd.svg)](pyproject.toml)
[![CI](https://img.shields.io/github/actions/workflow/status/jsirois/dev-cmd/ci.yml)](https://github.com/jsirois/dev-cmd/actions/workflows/ci.yml)
The `dev-cmd` tool provides a simple way to define commands you use to develop your project with in
`pyproject.toml`.
## Configuration
You define the commands you want `dev-cmd` to run and more under the `[tool.dev-cmd]` table in
`pyproject.toml`.
### Commands
You'll need at least one command defined for `dev-cmd` to be able to do anything useful. At a
minimum a command needs a name and a list of command line arguments that form the command.
For example:
```toml
[tool.dev-cmd.commands]
greet = ["python", "-c", "import os; print(f'Hello from {os.getcwd()!r}.')"]
```
More on execution in various environments [below](#Execution), but you can run the greet command
with, for example `uv run dev-cmd greet`.
There are two special argv0's you can use in your commands:
1. "python": This will be mapped to the Python interpreter that is executing `dev-cmd`.
2. A file name ending in ".py": This will be assumed to be a python script, and it will be run using
the Python interpreter that is executing `dev-cmd`.
You can define as many commands as you want. They will all run from the project root directory (the
directory containing the `pyproject.toml` the commands are defined in) and accept no arguments
besides those defined in the command. You can gain further control over the command by defining it
in a table instead of as a list of command line arguments. For example:
```toml
[tool.dev-cmd.commands.test]
args = ["pytest"]
env = {"PYTHONPATH" = "../test-support"}
cwd = "tests"
accepts-extra-args = true
```
Here, the working directory is set to the `tests/` directory (which must exist) and the `PYTHONPATH`
is set to its sibling `test-support` directory. This allows for importable shared test code to be
placed under the `test-support` directory in a project laid out like so:
```
project-dir/
pyproject.toml
tests/
test-support/
```
#### Pass Through Args
The `accepts-extra-args = true` configuration allows for passing extra args to pytest like so:
```console
uv run dev-cmd test -- -vvs
```
All arguments after the `--` are passed to `pytest` by appending them to the `test` command `args`
list. `dev-cmd` ensures at most one command `accepts-extra-args` per invocation so that they can be
unambiguously forwarded to the command that needs them. For example, lets expand the set of commands
we support:
```toml
[tool.dev-cmd.commands]
fmt = ["ruff", "format"]
lint = ["ruff", "check", "--fix"]
[tool.dev-cmd.commands.test]
args = ["pytest"]
env = {"PYTHONPATH" = "../test-support"}
cwd = "tests"
accepts-extra-args = true
```
You can now run the following and the extra args (`-vvs`) will be forwarded to `pytest` but not to
`ruff` in the `fmt` and `lint` commands:
```console
uv run dev-cmd fmt lint test -- -vvs
```
Here we ran multiple commands in sequence passing extra args to test. We could have also run this
as:
```console
uv run dev-cmd test fmt lint -- -vvs
```
The order commands are run in does not affect where extra args are passed.
#### Parameterization
Both command arguments and env values can be parameterized with values from the execution
environment. Parameters are introduced in between brackets with an optional default value:
`{<key>(:<default>)?}`. Parameters can draw from three sources:
1. Environment variables via `{env.<name>}`; e.g.: `{env.HOME}`
2. The current Python interpreter's marker environment via `{markers.<name>}`; e.g.:
`{markers.python_version}`
3. Factors via `{-<name>}`; e.g.: `{-py:{markers.python_version}}`
In all three cases, the parameter name can itself come from a nested parameterization; e.g.:
`{markers.{-marker:{env.MARKER:python_version}}}` selects the environment marker value for the
environment marker named by the `marker` factor if defined; otherwise the `MARKER` environment
variable if defined and finally falling back to `python_version` if none of these are defined.
The available Python marker environment variables are detailed in [PEP-508](
https://peps.python.org/pep-0508/#environment-markers).
Factors are introduced as suffixes to command names and are inspired by and similar to those found
in [tox](https://tox.wiki/) configuration. If a command is named `test` but the command is invoked
as `test-py3.12`, the `-py3.12` factor will be defined. The value of `3.12` could then be read via
the `{-py}` factor parameter placeholder in the command arguments or env values. The factor name
prefix will be stripped from the factor argument to produce the substituted value. As a consequence,
you want to ensure the factor names you use are non-overlapping or else an error will be raised due
to ambiguity in which factor argument should be applied. An optional leading `:` can proceed the
factor argument value, and it will be stripped. So both `test-py:3.12` and `test-py3.12` pass `3.12`
as the value for the `-py` factor parameter. The colon-prefix helps distinguish factor name from
factor value, paralleling the default value syntax that can be used at factor parameter declaration
sites.
### Tasks
Tasks are defined in their own table and compose two or more commands to implement some larger task.
Task names share the same namespace as command names and so must be unique from those. Continuing
with the current example:
```toml
[tool.dev-cmd.commands]
fmt = ["ruff", "format"]
lint = ["ruff", "check", "--fix"]
[tool.dev-cmd.commands.test]
args = ["pytest"]
env = {"PYTHONPATH" = "../test-support"}
cwd = "tests"
accepts-extra-args = true
[tool.dev-cmd.tasks]
tidy = ["fmt", "lint"]
```
With that configuration, executing `uv run dev-cmd tidy` will execute the `fmt` command and then
the `lint` command in sequence. Each entry in the list is referred to as a step and is the name of
any command or any task defined earlier in the file. This last restriction naturally avoids cycles.
#### Parallelization
Steps are run in sequence by default and execution halts at the 1st step to fail by default. See
[Execution](#Execution) for options to control these defaults. To cause two or more steps in a task
to run in parallel, enclose them in a sub-list. Continuing with the example above, but eliding the
command definitions:
```toml
[tool.dev-cmd.tasks]
tidy = ["fmt", "lint"]
unsafe-tidy = [["fmt", "lint"]]
checks = [[["fmt", "lint"], "test"]]
```
When `uv run dev-cmd unsafe-tidy` is run, both `fmt` and `lint` will run in parallel. This is unsafe
since both commands can modify the same files. It's up to you to control for this sort of issue when
deciding which commands to run in parallel.
When `uv run dev-cmd checks` is run, The elements in the 1st nested list are again run in parallel.
This time the 1st element is a list: `["fmt", "lint]`. Each layer of list nesting alternates between
running serially and running in parallel; so `fmt` and `list` will be run serially in that order
while they race `test` as a group in parallel.
#### Expansion
The `dev-cmd` runner supports expansion of steps via enumerated placeholders like `{a,b,c}` and
range placeholders like `{0..3}`. Whether supplied as step names via the command line or in task
lists, these placeholders will result in the surrounding step name being expanded into two or more
steps. For example, the following configuration results in a type-checks task that runs `mypy` in
parallel checking against Python 3.8 through 3.13:
```toml
[tool.dev-cmd.commands]
type-check = ["mypy", "--python", "{-py:{markers.python_version}}"]
[tool.dev-cmd.tasks]
type-checks = [["type-check-py3.{8..13}"]]
```
You could also ad-hoc check against just Python 3.8 and 3.9 in parallel via the following, even if
your shell does not do parameter expansion of this sort:
```console
uv run dev-cmd -p 'type-check-py3.{8,9}'
```
### Global Options
You can set a default command or task to run when `dev-cmd` is passed no positional arguments like
so:
```toml
[tool.dev-cmd]
default = "checks"
```
This configuration means the following will run `fmt`, `lint` and `test`:
```console
uv run dev-cmd
```
You can also configure when `dev-cmd` exits when it encounters command failures in a run:
```toml
[tool.dev-cmd]
exit-style = "immediate"
```
This will cause `dev-cmd` to fail fast as soon as the 1st command fails in a run. By default, the
exit style is `"after-step"` which only exits after the step containing a command (if any)
completes. For the `checks` task defined above, this means a failure in `fmt` would not be
propagated until after `lint` completed, finishing the step `fmt` found itself in. The final choice
for `exit-style` is `end` which causes `dev-cmd` to run everything to completion, only listing
errors at the very end.
## Execution
The `dev-cmd` tool supports several command line options to control execution in ad-hoc ways. You
can override the configured `exit-style` with `-k` / `--keep-going` (which is equivalent to
`exit-style = "end"`) or `-X` / `--exit-style`. You can also cause all steps named on the command
line to be run in parallel instead of in order with `-p` / `--parallel`. Finally, you can skip steps
with `-s` / `--skip`. This can be useful when running a task like `checks` defined above that
includes several commands, but one or more you'd like to skip. This would run all checks except
the tests:
```console
uv run dev-cmd checks -s test
```
In order for `dev-cmd` to run most useful commands, dependencies will need to be installed that
bring in those commands, like `ruff` or `pytest`. This is done differently in different tools.
Below are some commonly used tools and the configuration they require along with the command used to
invoke `dev-cmd` using each tool.
### [PDM](https://pdm-project.org/) and [uv](https://docs.astral.sh/uv/)
Add `dev-cmd` as well as any other needed dependencies to the `dev` dependency group:
```toml
[dependency-groups]
dev = ["dev-cmd", "pytest", "ruff"]
```
You can then execute `dev-cmd` with `uv run dev-cmd [args...]`. For `pdm` you'll have to 1st run
`pdm install` to make `dev-cmd`, `pytest` and `ruff` available.
### [Poetry](https://python-poetry.org/)
Add `dev-cmd` as well as any other needed dependencies to the dev dependencies:
```toml
[tool.poetry.dev-dependencies]
dev-cmd = "*"
pytest = "*"
ruff = "*"
```
Run `poetry install` and then you can run `poetry run dev-cmd [args...]`.
### [Hatch](https://hatch.pypa.io/)
Add `dev-cmd` as well as any other needed dependencies to an environment's dependencies. Here we use
the `default` environment for convenience:
```toml
[tool.hatch.envs.default]
dependencies = ["dev-cmd", "pytest", "ruff"]
```
You can then execute `hatch run dev-cmd [args...]`.
## Pre 1.0 Warning
This is a very new tool that can be expected to change rapidly and in breaking ways until the 1.0
release. The current best documentation is the dogfooding this project uses for its own development
described below. You can look at the `[tool.dev-cmd]` configuration in [`pyproject.toml`](
pyproject.toml) to get a sense of how definition of commands, tasks and defaults works.
## Development
Development uses [`uv`](https://docs.astral.sh/uv/getting-started/installation/). Install as you
best see fit.
With `uv` installed, running `uv run dev-cmd` is enough to get the tools `dev-cmd` uses installed
and run against the codebase. This includes formatting code, linting code, performing type checks
and then running tests.
Raw data
{
"_id": null,
"home_page": null,
"name": "dev-cmd",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "automation, command, runner, testing",
"author": null,
"author_email": "John Sirois <john.sirois@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ff/cb/81a7d1816432a502997b0716626a5769e05ddd99a5a79f8587949f3a0bd2/dev_cmd-0.13.0.tar.gz",
"platform": null,
"description": "# dev-cmd\n\n[![PyPI Version](https://shields.io/pypi/v/dev-cmd.svg)](https://pypi.org/project/dev-cmd/)\n[![License](https://shields.io/pypi/l/dev-cmd.svg)](LICENSE)\n[![Supported Pythons](https://shields.io/pypi/pyversions/dev-cmd.svg)](pyproject.toml)\n[![CI](https://img.shields.io/github/actions/workflow/status/jsirois/dev-cmd/ci.yml)](https://github.com/jsirois/dev-cmd/actions/workflows/ci.yml)\n\nThe `dev-cmd` tool provides a simple way to define commands you use to develop your project with in\n`pyproject.toml`.\n\n## Configuration\n\nYou define the commands you want `dev-cmd` to run and more under the `[tool.dev-cmd]` table in\n`pyproject.toml`.\n\n### Commands\n\nYou'll need at least one command defined for `dev-cmd` to be able to do anything useful. At a\nminimum a command needs a name and a list of command line arguments that form the command.\nFor example:\n\n```toml\n[tool.dev-cmd.commands]\ngreet = [\"python\", \"-c\", \"import os; print(f'Hello from {os.getcwd()!r}.')\"]\n```\n\nMore on execution in various environments [below](#Execution), but you can run the greet command\nwith, for example `uv run dev-cmd greet`.\n\nThere are two special argv0's you can use in your commands:\n1. \"python\": This will be mapped to the Python interpreter that is executing `dev-cmd`.\n2. A file name ending in \".py\": This will be assumed to be a python script, and it will be run using\n the Python interpreter that is executing `dev-cmd`.\n\nYou can define as many commands as you want. They will all run from the project root directory (the\ndirectory containing the `pyproject.toml` the commands are defined in) and accept no arguments\nbesides those defined in the command. You can gain further control over the command by defining it\nin a table instead of as a list of command line arguments. For example:\n\n```toml\n[tool.dev-cmd.commands.test]\nargs = [\"pytest\"]\nenv = {\"PYTHONPATH\" = \"../test-support\"}\ncwd = \"tests\"\naccepts-extra-args = true\n```\n\nHere, the working directory is set to the `tests/` directory (which must exist) and the `PYTHONPATH`\nis set to its sibling `test-support` directory. This allows for importable shared test code to be\nplaced under the `test-support` directory in a project laid out like so:\n```\nproject-dir/\n pyproject.toml\n tests/\n test-support/\n```\n\n#### Pass Through Args\n\nThe `accepts-extra-args = true` configuration allows for passing extra args to pytest like so:\n```console\nuv run dev-cmd test -- -vvs\n```\nAll arguments after the `--` are passed to `pytest` by appending them to the `test` command `args`\nlist. `dev-cmd` ensures at most one command `accepts-extra-args` per invocation so that they can be\nunambiguously forwarded to the command that needs them. For example, lets expand the set of commands\nwe support:\n```toml\n[tool.dev-cmd.commands]\nfmt = [\"ruff\", \"format\"]\nlint = [\"ruff\", \"check\", \"--fix\"]\n\n[tool.dev-cmd.commands.test]\nargs = [\"pytest\"]\nenv = {\"PYTHONPATH\" = \"../test-support\"}\ncwd = \"tests\"\naccepts-extra-args = true\n```\nYou can now run the following and the extra args (`-vvs`) will be forwarded to `pytest` but not to\n`ruff` in the `fmt` and `lint` commands:\n```console\nuv run dev-cmd fmt lint test -- -vvs\n```\nHere we ran multiple commands in sequence passing extra args to test. We could have also run this\nas:\n```console\nuv run dev-cmd test fmt lint -- -vvs\n```\nThe order commands are run in does not affect where extra args are passed.\n\n#### Parameterization\n\nBoth command arguments and env values can be parameterized with values from the execution\nenvironment. Parameters are introduced in between brackets with an optional default value:\n`{<key>(:<default>)?}`. Parameters can draw from three sources:\n1. Environment variables via `{env.<name>}`; e.g.: `{env.HOME}`\n2. The current Python interpreter's marker environment via `{markers.<name>}`; e.g.:\n `{markers.python_version}`\n3. Factors via `{-<name>}`; e.g.: `{-py:{markers.python_version}}`\n\nIn all three cases, the parameter name can itself come from a nested parameterization; e.g.:\n`{markers.{-marker:{env.MARKER:python_version}}}` selects the environment marker value for the\nenvironment marker named by the `marker` factor if defined; otherwise the `MARKER` environment\nvariable if defined and finally falling back to `python_version` if none of these are defined.\n\nThe available Python marker environment variables are detailed in [PEP-508](\nhttps://peps.python.org/pep-0508/#environment-markers).\n\nFactors are introduced as suffixes to command names and are inspired by and similar to those found\nin [tox](https://tox.wiki/) configuration. If a command is named `test` but the command is invoked\nas `test-py3.12`, the `-py3.12` factor will be defined. The value of `3.12` could then be read via\nthe `{-py}` factor parameter placeholder in the command arguments or env values. The factor name\nprefix will be stripped from the factor argument to produce the substituted value. As a consequence,\nyou want to ensure the factor names you use are non-overlapping or else an error will be raised due\nto ambiguity in which factor argument should be applied. An optional leading `:` can proceed the\nfactor argument value, and it will be stripped. So both `test-py:3.12` and `test-py3.12` pass `3.12`\nas the value for the `-py` factor parameter. The colon-prefix helps distinguish factor name from\nfactor value, paralleling the default value syntax that can be used at factor parameter declaration\nsites.\n\n### Tasks\n\nTasks are defined in their own table and compose two or more commands to implement some larger task.\nTask names share the same namespace as command names and so must be unique from those. Continuing\nwith the current example:\n```toml\n[tool.dev-cmd.commands]\nfmt = [\"ruff\", \"format\"]\nlint = [\"ruff\", \"check\", \"--fix\"]\n\n[tool.dev-cmd.commands.test]\nargs = [\"pytest\"]\nenv = {\"PYTHONPATH\" = \"../test-support\"}\ncwd = \"tests\"\naccepts-extra-args = true\n\n[tool.dev-cmd.tasks]\ntidy = [\"fmt\", \"lint\"]\n```\n\nWith that configuration, executing `uv run dev-cmd tidy` will execute the `fmt` command and then\nthe `lint` command in sequence. Each entry in the list is referred to as a step and is the name of\nany command or any task defined earlier in the file. This last restriction naturally avoids cycles.\n\n#### Parallelization\n\nSteps are run in sequence by default and execution halts at the 1st step to fail by default. See\n[Execution](#Execution) for options to control these defaults. To cause two or more steps in a task\nto run in parallel, enclose them in a sub-list. Continuing with the example above, but eliding the\ncommand definitions:\n```toml\n[tool.dev-cmd.tasks]\ntidy = [\"fmt\", \"lint\"]\nunsafe-tidy = [[\"fmt\", \"lint\"]]\nchecks = [[[\"fmt\", \"lint\"], \"test\"]]\n```\nWhen `uv run dev-cmd unsafe-tidy` is run, both `fmt` and `lint` will run in parallel. This is unsafe\nsince both commands can modify the same files. It's up to you to control for this sort of issue when\ndeciding which commands to run in parallel.\n\nWhen `uv run dev-cmd checks` is run, The elements in the 1st nested list are again run in parallel.\nThis time the 1st element is a list: `[\"fmt\", \"lint]`. Each layer of list nesting alternates between\nrunning serially and running in parallel; so `fmt` and `list` will be run serially in that order\nwhile they race `test` as a group in parallel.\n\n#### Expansion\n\nThe `dev-cmd` runner supports expansion of steps via enumerated placeholders like `{a,b,c}` and\nrange placeholders like `{0..3}`. Whether supplied as step names via the command line or in task\nlists, these placeholders will result in the surrounding step name being expanded into two or more\nsteps. For example, the following configuration results in a type-checks task that runs `mypy` in\nparallel checking against Python 3.8 through 3.13:\n```toml\n[tool.dev-cmd.commands]\ntype-check = [\"mypy\", \"--python\", \"{-py:{markers.python_version}}\"]\n\n[tool.dev-cmd.tasks]\ntype-checks = [[\"type-check-py3.{8..13}\"]]\n```\n\nYou could also ad-hoc check against just Python 3.8 and 3.9 in parallel via the following, even if\nyour shell does not do parameter expansion of this sort:\n```console\nuv run dev-cmd -p 'type-check-py3.{8,9}'\n```\n\n### Global Options\n\nYou can set a default command or task to run when `dev-cmd` is passed no positional arguments like\nso:\n```toml\n[tool.dev-cmd]\ndefault = \"checks\"\n```\nThis configuration means the following will run `fmt`, `lint` and `test`:\n```console\nuv run dev-cmd\n```\nYou can also configure when `dev-cmd` exits when it encounters command failures in a run:\n```toml\n[tool.dev-cmd]\nexit-style = \"immediate\"\n```\nThis will cause `dev-cmd` to fail fast as soon as the 1st command fails in a run. By default, the\nexit style is `\"after-step\"` which only exits after the step containing a command (if any)\ncompletes. For the `checks` task defined above, this means a failure in `fmt` would not be\npropagated until after `lint` completed, finishing the step `fmt` found itself in. The final choice\nfor `exit-style` is `end` which causes `dev-cmd` to run everything to completion, only listing\nerrors at the very end.\n\n## Execution\n\nThe `dev-cmd` tool supports several command line options to control execution in ad-hoc ways. You\ncan override the configured `exit-style` with `-k` / `--keep-going` (which is equivalent to\n`exit-style = \"end\"`) or `-X` / `--exit-style`. You can also cause all steps named on the command\nline to be run in parallel instead of in order with `-p` / `--parallel`. Finally, you can skip steps\nwith `-s` / `--skip`. This can be useful when running a task like `checks` defined above that\nincludes several commands, but one or more you'd like to skip. This would run all checks except\nthe tests:\n```console\nuv run dev-cmd checks -s test\n```\n\nIn order for `dev-cmd` to run most useful commands, dependencies will need to be installed that\nbring in those commands, like `ruff` or `pytest`. This is done differently in different tools.\nBelow are some commonly used tools and the configuration they require along with the command used to\ninvoke `dev-cmd` using each tool.\n\n### [PDM](https://pdm-project.org/) and [uv](https://docs.astral.sh/uv/)\n\nAdd `dev-cmd` as well as any other needed dependencies to the `dev` dependency group:\n```toml\n[dependency-groups]\ndev = [\"dev-cmd\", \"pytest\", \"ruff\"]\n```\nYou can then execute `dev-cmd` with `uv run dev-cmd [args...]`. For `pdm` you'll have to 1st run\n`pdm install` to make `dev-cmd`, `pytest` and `ruff` available.\n\n### [Poetry](https://python-poetry.org/)\n\nAdd `dev-cmd` as well as any other needed dependencies to the dev dependencies:\n```toml\n[tool.poetry.dev-dependencies]\ndev-cmd = \"*\"\npytest = \"*\"\nruff = \"*\"\n```\n\nRun `poetry install` and then you can run `poetry run dev-cmd [args...]`.\n\n### [Hatch](https://hatch.pypa.io/)\n\nAdd `dev-cmd` as well as any other needed dependencies to an environment's dependencies. Here we use\nthe `default` environment for convenience:\n```toml\n[tool.hatch.envs.default]\ndependencies = [\"dev-cmd\", \"pytest\", \"ruff\"]\n```\n\nYou can then execute `hatch run dev-cmd [args...]`.\n\n## Pre 1.0 Warning\n\nThis is a very new tool that can be expected to change rapidly and in breaking ways until the 1.0\nrelease. The current best documentation is the dogfooding this project uses for its own development\ndescribed below. You can look at the `[tool.dev-cmd]` configuration in [`pyproject.toml`](\npyproject.toml) to get a sense of how definition of commands, tasks and defaults works.\n\n## Development\n\nDevelopment uses [`uv`](https://docs.astral.sh/uv/getting-started/installation/). Install as you\nbest see fit.\n\nWith `uv` installed, running `uv run dev-cmd` is enough to get the tools `dev-cmd` uses installed\nand run against the codebase. This includes formatting code, linting code, performing type checks\nand then running tests.\n",
"bugtrack_url": null,
"license": "Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. \"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. \"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. \"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. \"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License. \"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. \"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. \"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). \"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. \"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\" \"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same \"printed page\" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ",
"summary": "A simple development command runner for Python projects.",
"version": "0.13.0",
"project_urls": {
"Bug Tracker": "https://github.com/jsirois/dev-cmd/issues",
"Changelog": "https://github.com/jsirois/dev-cmd/blob/main/CHANGES.md",
"Repository": "https://github.com/jsirois/dev-cmd"
},
"split_keywords": [
"automation",
" command",
" runner",
" testing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e9ab2d9aa6dbb7a4305ce7c3be03895596992762d39b0e408f3809c7bfcfd884",
"md5": "3bcff4f4009926378ed33fd030dbd5ca",
"sha256": "0f3211e624806ba5b6a62e4edb7e4a3fbc908a31f88f9c4aca87f330b0f1822c"
},
"downloads": -1,
"filename": "dev_cmd-0.13.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3bcff4f4009926378ed33fd030dbd5ca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 32452,
"upload_time": "2025-01-17T00:33:24",
"upload_time_iso_8601": "2025-01-17T00:33:24.854149Z",
"url": "https://files.pythonhosted.org/packages/e9/ab/2d9aa6dbb7a4305ce7c3be03895596992762d39b0e408f3809c7bfcfd884/dev_cmd-0.13.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ffcb81a7d1816432a502997b0716626a5769e05ddd99a5a79f8587949f3a0bd2",
"md5": "67bdfe59e62f6e4d5c77f789255ef6a1",
"sha256": "743f82b64f922bd6738024a07755b9b8104ae3d17aef422b5e9e6cdebe94a7a1"
},
"downloads": -1,
"filename": "dev_cmd-0.13.0.tar.gz",
"has_sig": false,
"md5_digest": "67bdfe59e62f6e4d5c77f789255ef6a1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 38955,
"upload_time": "2025-01-17T00:33:27",
"upload_time_iso_8601": "2025-01-17T00:33:27.180775Z",
"url": "https://files.pythonhosted.org/packages/ff/cb/81a7d1816432a502997b0716626a5769e05ddd99a5a79f8587949f3a0bd2/dev_cmd-0.13.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-17 00:33:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jsirois",
"github_project": "dev-cmd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dev-cmd"
}