rats.ez
¶
A collection of project-wide utilities exposed through a rats-ez
cli command.
Unlike many devtool commands, like rats-ci
, the rats-ez
commands are expected to be run from
the root of the repo, and help perform operations across components. For example, rats-ez run
allows the execution of a given command within every component, to help automate things like
running poetry update
in each component with one command.
__all__ = ['Application', 'main']
module-attribute
¶
Application(app)
¶
Bases: apps.AppContainer
, cli.Container
, apps.PluginMixin
Main application for the rats-ez
cli commands.
Not typically used directly, but can be invoked using rats.apps.AppBundle within tests or in advanced workflows.
from rats import apps, ez
ez_app = apps.AppBundle(app_plugin=ez.Application)
ez_app.project_hash()
ez_app.project_info()
ez_app.project_manifest()
ez_app.run(("poetry", "update"))
Warning
Calling ez_app.execute()
is unlikely to behave as expected, because sys.argv is
parsed by the click library.
Source code in rats/apps/_app_containers.py
execute()
¶
project_info()
¶
Show basic project structure information.
Source code in src/rats/ez/_app.py
project_hash()
¶
Calculate the hash of the project manifest.
The hash is calculated with rats.projects.ProjectTools.image_context_hash
Source code in src/rats/ez/_app.py
project_manifest()
¶
Show the project manifest.
The manifest is taken from rats.projects.ProjectTools.image_context_manifest
$ rats-ez project-manifest
…
f604f…daeadd .devcontainer/devcontainer.json
cd384…40b228 .devcontainer/direnvrc
61fa9…64db82 .devcontainer/on-create.sh
99ee7…aa6661 .devcontainer/post-create.sh
8ef70…387510 .dockerignore
…
96928…93f240 rats-apps/poetry.lock
aa057…0deabb rats-apps/poetry.toml
2c905…9c31b1 rats-apps/pyproject.toml
626c9…fe8e75 rats-apps/src/rats/annotations/__init__.py
be5cd…5c06f2 rats-apps/src/rats/annotations/__main__.py
5241e…889437 rats-apps/src/rats/annotations/_functions.py
…
01a05…d1fc56 rats-devtools/mkdocs.yaml
8833e…890b76 rats-devtools/poetry.lock
aa057…0deabb rats-devtools/poetry.toml
d346c…3ec564 rats-devtools/pyproject.toml
cf568…47c48c rats-devtools/src/rats/aml/__init__.py
d22fa…b0f5bf rats-devtools/src/rats/aml/__main__.py
69445…d8092d rats-devtools/src/rats/aml/_app.py
2d9a1…3d444a rats-devtools/src/rats/aml/_configs.py
b2d7d…8f1444 rats-devtools/src/rats/aml/_request.py
…
Source code in src/rats/ez/_app.py
run(cmd, args, component)
¶
Run a command in all of the components in your project.
By default, the command runs in all components; but one or more --component
options can
be provided to limit the commands to a set of components.
$ rats-ez run which python
running command: (which python) on ['rats-devtools', 'rats-apps', 'rats']
/…/rats/rats-devtools/.venv/bin/python
/…/rats/rats-apps/.venv/bin/python
/…/rats/rats/.venv/bin/python
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmd
|
str
|
the name of the command or full path if not present in |
required |
args
|
tuple[str, ...]
|
zero or more arguments passed to the command |
required |
component
|
tuple[str, ...]
|
filters the command to only run in the provided components |
required |
Source code in src/rats/ez/_app.py
main()
¶
The main entry-point for the application, used to define the python script for `rats-ez.