Skip to content

Commit

Permalink
Install: option to skip current project package
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Seleem committed Dec 21, 2018
1 parent 3c26c8d commit ea621bb
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,28 @@ poetry install --extras "mysql pgsql"
poetry install -E mysql -E pgsql
```

By default `poetry` will install your project's package everytime you run `install`:

```bash
$ poetry install
Installing dependencies from lock file

Nothing to install or update

- Installing <your-package-name> (x.x.x)

```

If you want to skip this installation, use the `--no-root` option.

```bash
poetry install --no-root
```

#### Options

* `--no-dev`: Do not install dev dependencies.
* `--no-root`: Do not install the root package (your project).
* `-E|--extras`: Features to install (multiple values allowed).

### update
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,28 @@ poetry install --extras "mysql pgsql"
poetry install -E mysql -E pgsql
```

By default `poetry` will install your project's package everytime you run `install`:

```bash
$ poetry install
Installing dependencies from lock file

Nothing to install or update

- Installing <your-package-name> (x.x.x)

```

If you want to skip this installation, use the `--no-root` option.

```bash
poetry install --no-root
```

### Options

* `--no-dev`: Do not install dev dependencies.
* `--no-root`: Do not install the root package (your project).
* `--extras (-E)`: Features to install (multiple values allowed).

## update
Expand Down
13 changes: 8 additions & 5 deletions poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class InstallCommand(EnvCommand):
install
{ --no-dev : Do not install dev dependencies. }
{ --no-root : Do not install the root package (your project). }
{ --dry-run : Outputs the operations but will not execute anything
(implicitly enables --verbose). }
{ --E|extras=* : Extra sets of dependencies to install. }
Expand Down Expand Up @@ -46,6 +47,7 @@ def handle(self):

installer.extras(extras)
installer.dev_mode(not self.option("no-dev"))
installer.install_root(not self.option("no-root"))
installer.develop(self.option("develop"))
installer.dry_run(self.option("dry-run"))
installer.verbose(self.option("verbose"))
Expand All @@ -63,13 +65,14 @@ def handle(self):
# If this is a true error it will be picked up later by build anyway.
return 0

self.line(
" - Installing <info>{}</info> (<comment>{}</comment>)".format(
self.poetry.package.pretty_name, self.poetry.package.pretty_version
if not self.option("no-root"):
self.line(
" - Installing <info>{}</info> (<comment>{}</comment>)".format(
self.poetry.package.pretty_name, self.poetry.package.pretty_version
)
)
)

if self.option("dry-run"):
if self.option("dry-run") or self.option("no-root"):
return 0

setup = self.poetry.file.parent / "setup.py"
Expand Down
9 changes: 9 additions & 0 deletions poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
self._locker = locker
self._pool = pool

self._install_root = True
self._dry_run = False
self._update = False
self._verbose = False
Expand Down Expand Up @@ -75,6 +76,14 @@ def run(self):

return 0

def install_root(self, install_root=True): # type: (bool) -> Installer
self._install_root = install_root

return self

def is_install_root(self): # type: () -> bool
return self._install_root

def dry_run(self, dry_run=True): # type: (bool) -> Installer
self._dry_run = dry_run

Expand Down

0 comments on commit ea621bb

Please sign in to comment.