Skip to content

Commit

Permalink
feat: bench pip *
Browse files Browse the repository at this point in the history
Directly install/update/remove packages from your env using bench pip
commands. Pretty much just like using pip

To check help don't add the --help flag, use the -h flag instead, use the pip help command. For example, checking help for pip install can be done by

    bench pip help install
    bench pip install -h
  • Loading branch information
gavindsouza committed Feb 6, 2020
1 parent 50ef739 commit f0596c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bench/commands/__init__.py
Expand Up @@ -31,11 +31,12 @@ def bench_command(bench_path='.'):
setup_logging(bench_path=bench_path)


from bench.commands.make import init, get_app, new_app, remove_app
from bench.commands.make import init, get_app, new_app, remove_app, pip
bench_command.add_command(init)
bench_command.add_command(get_app)
bench_command.add_command(new_app)
bench_command.add_command(remove_app)
bench_command.add_command(pip)


from bench.commands.update import update, retry_upgrade, switch_to_branch, switch_to_master, switch_to_develop
Expand Down
11 changes: 11 additions & 0 deletions bench/commands/make.py
Expand Up @@ -93,3 +93,14 @@ def include_app_for_update(app_name):
"Include app from updating"
from bench.app import remove_from_excluded_apps_txt
remove_from_excluded_apps_txt(app_name)


@click.command('pip', context_settings={"ignore_unknown_options": True}, help="For pip help use `bench pip help [COMMAND]` or `bench pip [COMMAND] -h`")
@click.argument('args', nargs=-1)
@click.pass_context
def pip(ctx, args):
"Run pip commands in bench env"
import os
from bench.utils import get_env_cmd
env_pip = get_env_cmd('pip')
os.execv(env_pip, (env_pip,) + args)

0 comments on commit f0596c5

Please sign in to comment.