🏎️💨 pyqwe
The Quick Work Environment for Python.
Run commands quickly from the pyproject.toml (or pyqwe.toml) file.
pip install pyqwe
pyqwe requires Python 3.12 or newer.
- 🏎️💨 pyqwe
Usage
Add commands to the pyproject.toml or pyqwe.toml file.
🚨NOTE - If you have both a pyproject.toml and a pyqwe.toml file, the pyqwe.toml file will be used and the pyproject.toml file will be ignored.
[tool.pyqwe]
flask = "flask_app:run"
say_hello = "*:echo Hello World"
If you're using a pyqwe.toml file you can drop the [tool.pyqwe]
flask = "flask_app:run"
say_hello = "*:echo Hello World"
To see information on the available commands in the toml file you can run:
qwe list
# or
qwe ls
# or
qwe --list
# or
qwe -l
qwe is a shorter alias for pyqwe, every example here works with either.
If you define your own command called list or ls, yours is run instead,
and qwe --list still lists your commands.
You can run the commands by using the command name:
qwe flask
Running qwe without any option or command will show all available
commands in a menu you can choose from.
qwe
0...Exit
1...flask
2...say_hello
Select a command to run [0]:
Choosing 1 will run the flask command.
Describing commands
A command can be a table with run and help, the help text is shown in
qwe ls, the menu, and shell completion in zsh and fish:
[tool.pyqwe]
test = { run = "*:pytest", help = "Run the tests" }
dev = { run = ["*:npm run dev", "app:run"], help = "Start the dev servers" }
Sections
A sub-table of commands is shown as its own section in qwe ls and the
menu. Use __header__ to give it a title, otherwise the table name is used:
[tool.pyqwe]
test = "*:pytest"
[tool.pyqwe.js]
__header__ = "JavaScript"
js_install = "*(js_app):npm install"
js_dev = "*(js_app):npm run dev"
Commands in sections are run by their name, qwe js_install, so names must
be unique across all sections.
Python commands
For Python, the commands are structured like (package &/ module):function
Package example
project/
flask_app/
__init__.py
[tool.pyqwe]
flask = "flask_app:run"
This command will run the function
run() from the __init__.py file in the flask_app package.
Module example
project/
app.py
[tool.pyqwe]
flask = "app:run"
This command will run the function
run() from the app.py file. Writing app.py:run works too.
Modules inside packages use dots, my_package.inside:run will run the
function run() from my_package/inside.py. Modules are imported by their
full name relative to the project folder, so relative imports work, and a
module in your project takes priority over an installed package with the
same name.
Each Python command runs in its own process, using the same Python that
pyqwe is installed in. This means Ctrl+C stops it, it can set the exit code
with sys.exit(), and Python commands in a group do not share imports.
Now run the pyqwe command:
qwe flask
This will start the Flask app.
*:... commands (terminal)
Any command that starts with * will be run using subprocess.
For example:
[tool.pyqwe]
say_hello = "*:echo Hello World"
Now running the pyqwe command:
qwe say_hello
Will print Hello World.
Run as shell
To run the command as a subprocess shell command, add the shell key to the
command.
On Windows, terminal commands always run through the shell, so that commands
like npm and shell built-ins like echo can be found.
[tool.pyqwe]
say_hello = "*shell:echo Hello World"
Change the working directory
You can change the working directory of a subprocess by adding the folder
within parentheses to the command, (node_app) for example.
The folder must be relative to the pyproject.toml file.
Absolute paths are not supported.
Moving up directories is not supported, ../node_app for example.
[tool.pyqwe]
npm_install = "*(node_app):npm install"
The shell key is still available when changing the directory.
[tool.pyqwe]
npm_install = "*shell(node_app):npm i"
Passing extra arguments
Adding > to a terminal command (*>:...) allows it to take extra
arguments. Anything given after the command name is appended to the
end of the command.
[tool.pyqwe]
uv = "*>:uv run --env-file .env -- uv"
qwe uv add python-dotenv
This will run uv run --env-file .env -- uv add python-dotenv.
> can be combined with shell and the working directory,
*shell>:..., *(node_app)>:... or *shell(node_app)>:....
The parts must be in this order: *, then shell, then (folder), then
>. Anything else, *sh:... or *>(node_app):... for example, is reported
as an invalid runner before anything runs.
Passing extra arguments to a command that is not marked with > will
raise an error.
Grouped commands
You can group commands together in a list to have one pyqwe command run multiple commands.
Grouped commands can also be run in Step, Sync, or Async mode. Async being the default.
This will run the commands in the group in sequence, pausing for confirmation between each command:
[tool.pyqwe]
group = [
"@step",
"*:echo 'Hello, World! 1'",
"*:echo 'Hello, World! 2'",
"*:echo 'Hello, World! 3'"
]
This will run the commands in the group in sequence, one after the other, stopping at the first command that fails:
[tool.pyqwe]
group = [
"@sync",
"*:echo 'Hello, World! 1'",
"*:echo 'Hello, World! 2'",
"*:echo 'Hello, World! 3'"
]
This will run the commands in the group in parallel:
[tool.pyqwe]
group = [
"@async",
"*:echo 'Hello, World! 1'",
"*:echo 'Hello, World! 2'",
"*:echo 'Hello, World! 3'"
]
Of course, you can leave out the @step, @sync or @async to use the
default async mode. Any other @ mode, @synch for example, is reported as
an error.
For example, this will also run the commands in the group in parallel:
[tool.pyqwe]
group = [
"*:echo 'Hello, World! 1'",
"*:echo 'Hello, World! 2'",
"*:echo 'Hello, World! 3'"
]
Waiting before starting a runner
Sometimes you might need to have a runner wait before starting. This might be the case if you have a group of runners in async mode but one runner connects to another.
You can tell a runner to sleep for a number of seconds by using the sleep for marker:
[tool.pyqwe]
group = [
"@async",
"*:~10~ echo 'Hello, World! 1'",
"*:echo 'Hello, World! 2'",
"*:echo 'Hello, World! 3'"
]
This also works on module runs:
[tool.pyqwe]
flask = "~10~ flask_app:run"
Each of the examples above will sleep for 10 seconds before the runner will start.
Exit codes
pyqwe exits with the exit code of the command it ran, so it can be used in scripts and CI:
qwe test && qwe deploy
| Situation | Exit code |
|---|---|
| The command succeeded | 0 |
| A terminal command failed | The command's own code |
| A terminal command was not found | 127 |
| A Python function raised an error | 1 |
| The command is invalid, or the menu choice is invalid | 1 |
Unknown command, or extra arguments given without > |
2 |
| Stopped with Ctrl+C | 130 |
Error messages are printed to stderr.
For grouped commands:
@syncstops at the first command that fails and exits with its code. Pressing Ctrl+C stops the current command and moves on to the next.@stepcarries on, since you choose whether to run each command, and exits with the code of the first command that failed.@asyncwaits for all commands and exits with the code of the first command that failed.
Using environment variables
To use environment variables in the command, use the {{ }}
markers:
[tool.pyqwe]
talk = "*shell:echo {{ MESSAGE }}"
pyqwe fills in the values before running anything. If a variable is not set, pyqwe reports it and runs nothing.
Variables already set in your environment always work. To also load them
from a .env file, install python-dotenv:
pip install python-dotenv
pyqwe then loads the .env file in the project folder, if there is one. To
load other files, set __env_files__:
[tool.pyqwe]
__env_files__ = [".env", ".env.local"]
talk = "*shell:echo {{ MESSAGE }}"
Every file listed in __env_files__ must exist, and __env_files__ needs
python-dotenv to be installed. Values already set in your environment are
not overwritten.
To turn off everything to do with environment variables, set
__env_ignore__ to true:
[tool.pyqwe]
__env_ignore__ = true
talk = "*shell:echo {{ MESSAGE }}"
No .env files are loaded, and {{ MESSAGE }} is passed to the command
as it is.
Clearing the terminal setting
Setting the __clear_terminal__ setting option to true will clear the
terminal before a command runs, or before the menu is shown. It does nothing
for --help, --list, --dry-run or errors, and nothing when the output
is not a terminal. Results may vary between terminals and OS platforms.
This option is set to false by default.
[tool.pyqwe]
__clear_terminal__ = true
talk = "*shell:echo {{MESSAGE}}"
Dry run
--dry-run (or -n) shows what a command would run, without running it.
Environment variables and extra arguments are filled in, so it is a good way
to check a command:
qwe --dry-run deploy
deploy (@sync) would run:
=> python app.build:run
=> (after 5s) (in web) npm run deploy --prod
Shell completion
pyqwe can complete command names and options in bash, zsh and fish. Add one of these to your shell's startup file:
# ~/.bashrc
eval "$(qwe --completion bash)"
# ~/.zshrc, after compinit
eval "$(qwe --completion zsh)"
# ~/.config/fish/config.fish
qwe --completion fish | source
Completion works for both qwe and pyqwe, using the commands of the
project in the current folder. zsh and fish also show each command's help
text next to its name:
$ qwe <tab>
build -- Build the package
db:migrate -- Run the database migrations
test
Options such as --list and --dry-run are completed before the command
name. Everything after the command name belongs to the command, so the shell
completes file names there instead.
In bash, command names containing : (like db:migrate) complete correctly
when the bash-completion package is
installed, which most Linux distributions and Homebrew's bash include.
Colours
pyqwe uses colour and emoji when printing to a terminal, and plain text when
the output is piped or redirected. Set NO_COLOR=1 to always turn colour
off, or FORCE_COLOR=1 to always turn it on.
Other commands
| Option | Description |
|---|---|
-l, --list |
List all commands |
-n, --dry-run |
Show what a command would run, without running it |
--completion {bash,zsh,fish} |
Print a shell completion script |
-h, --help |
Show the help message |
-v, --version |
Show the version |
Options go before the command name. Anything after the command name is passed to the command, see Passing extra arguments.
Metadata
Release files for pyqwe 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyqwe-4.0.0.tar.gz | 21.5 kB | With provenance | Details for pyqwe-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyqwe-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for pyqwe-4.0.0-py3-none-any.whl |
Total release size: 42.2 kB
Release files / pyqwe-4.0.0.tar.gz
| Download URL | pyqwe-4.0.0.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f884ff528b57496f84e04f14a020271a7df38b48514f6cca5dfb1a334765dfd7
|
|
BLAKE2b-256 checksum How to use checksums |
0bdce6ce4184825ab63daa082d61182245d9c8e4ee1365e900af3e438608276c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / pyqwe-4.0.0-py3-none-any.whl
| Download URL | pyqwe-4.0.0-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a453903637f0735273a9bcb5d7a0d55dc6e349044e3ccd86f93fa9d3e2d5ff4
|
|
BLAKE2b-256 checksum How to use checksums |
f870e5ea511be9dfcea309a1b4f5d938ed3df2b12948055144489cf10726f6e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for pyqwe 4.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyqwe-4.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.