Skip to content

Commit

Permalink
Add --pipx option to install task
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Sep 9, 2024
1 parent 500f406 commit 0aedb7e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,26 @@ def test(ctx, unit=False, integration=False, pattern=None):


@task
def install(ctx, pip=False):
def install(ctx, pip=False, pipx=False):
with ctx.cd(ROOT):
uninstall(ctx, pip)
uninstall(ctx, pip, pipx)
build(ctx)
wheel = next(ROOT.glob("dist/*.whl"))
if pip:
ctx.run('pip install "{}"'.format(wheel))
ctx.run('pip install "{}[plugin]"'.format(wheel))
elif pipx:
ctx.run('pipx inject poetry "{}[plugin]"'.format(wheel))
else:
ctx.run('poetry self add "{}[plugin]"'.format(wheel))


@task
def uninstall(ctx, pip=False):
def uninstall(ctx, pip=False, pipx=False):
try:
if pip:
ctx.run("pip uninstall -y poetry-dynamic-versioning")
elif pipx:
ctx.run("pipx runpip poetry uninstall -y poetry-dynamic-versioning")
else:
ctx.run("poetry self remove poetry-dynamic-versioning")
except Exception:
Expand Down

0 comments on commit 0aedb7e

Please sign in to comment.