Skip to content

Add way to run commands in the invoke env #38325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .dda/extend/commands/run/i/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import annotations

from typing import TYPE_CHECKING

import click
from dda.cli.base import dynamic_command, ensure_features_installed, pass_app

if TYPE_CHECKING:
from dda.cli.application import Application


@dynamic_command(
short_help="Run command in the legacy invoke virtual env",
context_settings={"help_option_names": [], "ignore_unknown_options": True},
)
@click.argument("args", nargs=-1, required=True)
@pass_app
def cmd(app: Application, *, args: tuple[str, ...]) -> None:
"""
Run command in the legacy invoke virtual env.
"""
venv_path = app.config.storage.join("venvs", "legacy").data
with app.tools.uv.virtual_env(venv_path) as venv:
ensure_features_installed(["legacy-tasks"], app=app, prefix=str(venv.path))
app.subprocess.attach(list(args))