Skip to content

Commit

Permalink
overrode install command to include [extra] by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhausen committed Aug 1, 2024
1 parent e4ad484 commit cc9685e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .spin/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,63 @@ def asv(asv_args):
os.environ["ASV_ENV_DIR"] = "/Users/adam2392/miniforge3"
os.environ["PYTHONPATH"] = f'{site_path}{os.sep}:{os.environ.get("PYTHONPATH", "")}'
util.run(["asv"] + list(asv_args))


@click.command()
@click.option(
"--editable/--no-editable",
default=True,
help="Install in editable mode.",
)
@click.option(
"-v/-q",
"--verbose/--quiet",
is_flag=True,
default=True,
help="Print detailed build output.",
)
@click.option(
"--verbose-import/--no-verbose-import",
is_flag=True,
default=True,
help="Meson only: importing an editable install may trigger a build. This flag determines whether to print that build's output.",
)
@click.option(
"--with-extra/--no-extra",
is_flag=True,
default=True,
help="Install with extra dependencies.",
)
@click.argument("pip_args", nargs=-1)
def install(*, pip_args, editable, verbose, verbose_import, with_extra):
"""💽 Build and install package using pip.
By default, the package is installed in editable mode.
Arguments after `--` are passed through to pip, e.g.:
spin install -- --no-clean
would translated to:
pip install . --no-build-isolation --editable --no-clean
"""
pip_args = list(pip_args)
pip_cmd = ["pip", "install"]
pip_args += ["--no-build-isolation"]

if editable:
pip_args += ["--editable"]

if verbose_import:
pip_args = ["--config-settings=editable-verbose=true"] + pip_args

if verbose:
pip_args = ["-v"] + pip_args

pkg = ["."]
if with_extra:
pkg[0] += "[extra]"

print(pip_cmd + pip_args + pkg)
util.run(pip_cmd + pip_args + pkg, sys_exit=False, replace=True)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ Build = [
".spin/cmds.py:build",
".spin/cmds.py:setup_submodule",
"spin.cmds.meson.test",
"spin.cmds.pip.install"
".spin/cmds.py:install"
]
Environments = [
'spin.cmds.meson.shell',
Expand Down

0 comments on commit cc9685e

Please sign in to comment.