Skip to content

Commit

Permalink
Merge branch 'master' into fixes/source-default-secondary-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzx authored Apr 4, 2021
2 parents b2defd1 + b753aaf commit 27b3b17
Show file tree
Hide file tree
Showing 137 changed files with 4,453 additions and 1,046 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.6, 3.7, 3.8, 3.9]
experimental: [false]
include:
- os: Ubuntu
python-version: "3.10.0-alpha - 3.10.0"
experimental: true
fail-fast: false
steps:
- uses: actions/checkout@v2

Expand All @@ -38,14 +45,21 @@ jobs:

- name: Bootstrap poetry
shell: bash
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install .
run: python install-poetry.py -y

- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
shell: bash
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Update Path for Windows
if: ${{ matrix.os == 'Windows' }}
shell: bash
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH

- name: Configure poetry
shell: bash
run: python -m poetry config virtualenvs.in-project true
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v2
Expand All @@ -57,12 +71,12 @@ jobs:
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s python -m poetry run pip --version || rm -rf .venv
run: timeout 10s poetry run pip --version || rm -rf .venv

- name: Install dependencies
shell: bash
run: python -m poetry install
run: poetry install

- name: Run pytest
shell: bash
run: python -m poetry run python -m pytest -v tests
run: poetry run python -m pytest -p no:sugar -q tests/
76 changes: 53 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,76 @@ The [complete documentation](https://python-poetry.org/docs/) is available on th
## Installation

Poetry provides a custom installer that will install `poetry` isolated
from the rest of your system by vendorizing its dependencies. This is the
recommended way of installing `poetry`.
from the rest of your system.

### osx / linux / bashonwindows install instructions
```bash
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
```
### windows powershell install instructions
```powershell
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python -
```

**Warning**: The previous `get-poetry.py` installer is now deprecated, if you are currently using it
you should migrate to the new, supported, `install-poetry.py` installer.

The installer installs the `poetry` tool to Poetry's `bin` directory. This location depends on you system:

- `$HOME/.local/bin` for Unix
- `%APPDATA%\Python\Scripts` on Windows

Alternatively, you can download the `get-poetry.py` file and execute it separately.
If this directory is not on you `PATH`, you will need to add it manually
if you want to invoke Poetry with simply `poetry`.

Alternatively, you can use the full path to `poetry` to use it.

Once Poetry is installed you can execute the following:

```bash
poetry --version
```

The setup script must be able to find one of following executables in your shell's path environment:
If you see something like `Poetry (version 1.2.0)` then you are ready to use Poetry.
If you decide Poetry isn't your thing, you can completely remove it from your system
by running the installer again with the `--uninstall` option or by setting
the `POETRY_UNINSTALL` environment variable before executing the installer.

- `python` (which can be a py3 or py2 interpreter)
- `python3`
- `py.exe -3` (Windows)
- `py.exe -2` (Windows)
```bash
python install-poetry.py --uninstall
POETRY_UNINSTALL=1 python install-poetry.py
```

If you want to install prerelease versions, you can do so by passing `--preview` to `get-poetry.py`:
By default, Poetry is installed into the user's platform-specific home directory.
If you wish to change this, you may define the `POETRY_HOME` environment variable:

```bash
python get-poetry.py --preview
POETRY_HOME=/etc/poetry python install-poetry.py
```

Similarly, if you want to install a specific version, you can use `--version`:
If you want to install prerelease versions, you can do so by passing `--preview` option to `install-poetry.py`
or by using the `POETRY_PREVIEW` environment variable:

```bash
python get-poetry.py --version 0.7.0
python install-poetry.py --preview
POETRY_PREVIEW=1 python install-poetry.py
```

Using `pip` to install `poetry` is also possible.
Similarly, if you want to install a specific version, you can use `--version` option or the `POETRY_VERSION`
environment variable:

```bash
pip install --user poetry
python install-poetry.py --version 1.2.0
POETRY_VERSION=1.2.0 python install-poetry.py
```

Be aware, however, that it will also install poetry's dependencies
which might cause conflicts.
You can also install Poetry for a `git` repository by using the `--git` option:

```bash
python install-poetry.py --git https://github.com/python-poetry/poetry.git@master
````

**Note**: Note that the installer does not support Python < 3.6.

## Updating `poetry`

Expand All @@ -72,13 +106,9 @@ And finally, if you want to install a specific version you can pass it as an arg
to `self update`.

```bash
poetry self update 1.0.0
poetry self update 1.2.0
```

*Note:*

If you are still on poetry version < 1.0 use `poetry self:update` instead.


## Enable tab completion for Bash, Fish, or Zsh

Expand Down Expand Up @@ -268,4 +298,4 @@ At this point the rest of the resolution is straightforward since there is no mo
* [Official Website](https://python-poetry.org)
* [Issue Tracker](https://github.com/python-poetry/poetry/issues)
* [Discord](https://discordapp.com/invite/awxPgve)
* [Discord](https://discord.com/invite/awxPgve)
47 changes: 47 additions & 0 deletions docs/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ This command locks (without installing) the dependencies specified in `pyproject
poetry lock
```

### Options

* `--check`: Verify that `poetry.lock` is consistent with `pyproject.toml`

## version

This command shows the current version of the project or bumps the version of
Expand Down Expand Up @@ -534,3 +538,46 @@ To only remove a specific package from a cache, you have to specify the cache en
```bash
poetry cache clear pypi:requests:2.24.0
```

## plugin

The `plugin` namespace regroups sub commands to manage Poetry plugins.

### `plugin add`

The `plugin add` command installs Poetry plugins and make them available at runtime.

For example, to install the `poetry-plugin` plugin, you can run:

```bash
poetry plugin add poetry-plugin
```

The package specification formats supported by the `plugin add` command are the same as the ones supported
by the [`add` command](#add).

If you just want to check what would happen by installing a plugin, you can use the `--dry-run` option

```bash
poetry plugin add poetry-plugin --dry-run
```

#### Options

* `--dry-run`: Outputs the operations but will not execute anything (implicitly enables --verbose).

### `plugin show`

The `plugin show` command lists all the currently installed plugins.

```bash
poetry plugin show
```

### `plugin remove`

The `plugin remove` command removes installed plugins.

```bash
poetry plugin remove poetry-plugin
```
18 changes: 13 additions & 5 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cache-dir = "/path/to/cache/directory"
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = true
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /path/to/cache/directory/virtualenvs
```

Expand Down Expand Up @@ -90,7 +91,6 @@ This also works for secret settings, like credentials:
export POETRY_HTTP_BASIC_MY_REPOSITORY_PASSWORD=secret
```


## Available settings

### `cache-dir`: string
Expand Down Expand Up @@ -119,7 +119,8 @@ Defaults to `true`.

If set to `false`, poetry will install dependencies into the current python environment.

!!!note:
!!!note

When setting this configuration to `false`, the Python environment used must have `pip`
installed and available.

Expand All @@ -128,10 +129,12 @@ If set to `false`, poetry will install dependencies into the current python envi
Create the virtualenv inside the project's root directory.
Defaults to `None`.

If set to `true`, the virtualenv will be created and expected in a folder named `.venv` within the root directory of the project.

If not set explicitly (default), `poetry` will use the virtualenv from the `.venv` directory when one is available. If set to `false`, `poetry` will ignore any existing `.venv` directory.
If set to `true`, the virtualenv will be created and expected in a folder named
`.venv` within the root directory of the project.

If not set explicitly (default), `poetry` will use the virtualenv from the `.venv`
directory when one is available. If set to `false`, `poetry` will ignore any
existing `.venv` directory.

### `virtualenvs.path`: string

Expand All @@ -143,6 +146,11 @@ Defaults to `{cache-dir}/virtualenvs` (`{cache-dir}\virtualenvs` on Windows).
If set to `true` the `--always-copy` parameter is passed to `virtualenv` on creation of the venv. Thus all needed files are copied into the venv instead of symlinked.
Defaults to `false`.

### `virtualenvs.options.system-site-packages`: boolean

Give the virtual environment access to the system site-packages directory.
Applies on virtualenv creation.
Defaults to `false`.

### `repositories.<name>`: string

Expand Down
10 changes: 5 additions & 5 deletions docs/docs/dependency-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ foo = [
]
```

!!!note

The constraints **must** have different requirements (like `python`)
otherwise it will cause an error when resolving dependencies.

## Expanded dependency specification syntax

In the case of more complex dependency specifications, you may find that you
Expand Down Expand Up @@ -212,8 +217,3 @@ markers = "platform_python_implementation == 'CPython'"
All of the same information is still present, and ends up providing the exact
same specification. It's simply split into multiple, slightly more readable,
lines.

!!!note

The constraints **must** have different requirements (like `python`)
otherwise it will cause an error when resolving dependencies.
Loading

0 comments on commit 27b3b17

Please sign in to comment.