Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a new bootstrapping method #3706

Merged
merged 7 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,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
abn marked this conversation as resolved.
Show resolved Hide resolved

- 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 @@ -58,12 +65,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 -p no:sugar -q tests/
run: poetry run python -m pytest -p no:sugar -q tests/
74 changes: 52 additions & 22 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but should we link to our documentation here instead of maintaining duplication information here? Might be good for the brevity of the README as well.


### 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
117 changes: 50 additions & 67 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,109 +18,89 @@ on Windows, Linux and OSX.
## 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/get-poetry.py -UseBasicParsing).Content | python -
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python -
```

!!! note
!!!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.

You only need to install Poetry once. It will automatically pick up the current
Python version and use it to [create virtualenvs](/docs/managing-environments) accordingly.
The installer installs the `poetry` tool to Poetry's `bin` directory. This location depends on you system:

The installer installs the `poetry` tool to Poetry's `bin` directory.
On Unix it is located at `$HOME/.poetry/bin` and on Windows at `%USERPROFILE%\.poetry\bin`.
- `$HOME/.local/bin` for Unix
- `%APPDATA%\Python\Scripts` on Windows

This directory will be automatically added to your `$PATH` environment variable,
by appending a statement to your `$HOME/.profile` configuration (or equivalent files).
If you do not feel comfortable with this, please pass the `--no-modify-path` flag to
the installer and manually add the Poetry's `bin` directory to your path.
If this directory is not on you `PATH`, you will need to add it manually
if you want to invoke Poetry with simply `poetry`.

Finally, open a new shell and type the following:
Alternatively, you can use the full path to `poetry` to use it.

Once Poetry is installed you can execute the following:

```bash
poetry --version
```

If you see something like `Poetry 0.12.0` then you are ready to use Poetry.
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.

```bash
python get-poetry.py --uninstall
POETRY_UNINSTALL=1 python get-poetry.py
python install-poetry.py --uninstall
POETRY_UNINSTALL=1 python install-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:
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
POETRY_HOME=/etc/poetry python get-poetry.py
POETRY_HOME=/etc/poetry python install-poetry.py
```

If you want to install prerelease versions, you can do so by passing `--preview` to `get-poetry.py`
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 --preview
POETRY_PREVIEW=1 python get-poetry.py
python install-poetry.py --preview
POETRY_PREVIEW=1 python install-poetry.py
```

Similarly, if you want to install a specific version, you can use `--version` or the `POETRY_VERSION`
Similarly, if you want to install a specific version, you can use `--version` option or the `POETRY_VERSION`
environment variable:

```bash
python get-poetry.py --version 0.12.0
POETRY_VERSION=0.12.0 python get-poetry.py
python install-poetry.py --version 1.2.0
POETRY_VERSION=1.2.0 python install-poetry.py
```

!!!note

Note that the installer does not support Poetry releases < 0.12.0.
You can also install Poetry for a `git` repository by using the `--git` option:

!!!note

The setup script must be able to find one of following executables in your shell's path environment:

- `python` (which can be a py3 or py2 interpreter)
- `python3`
- `py.exe -3` (Windows)
- `py.exe -2` (Windows)

### Alternative installation methods (not recommended)
```bash
python install-poetry.py --git https://github.com/python-poetry/poetry.git@master
````

!!!note

Using alternative installation methods will make Poetry always
use the Python version for which it has been installed to create
virtualenvs.
Note that the installer does not support Python < 3.6.

So, you will need to install Poetry for each Python version you
want to use and switch between them.

#### Installing with `pip`

Using `pip` to install Poetry is possible.

```bash
pip install --user poetry
```

!!!warning

Be aware that it will also install Poetry's dependencies
which might cause conflicts with other packages.
### Alternative installation methods

#### Installing with `pipx`

Using [`pipx`](https://github.com/cs01/pipx) to install Poetry is also possible. `pipx` is used to install Python CLI applications globally while still isolating them in virtual environments. This allows for clean upgrades and uninstalls. `pipx` supports Python 3.6 and later. If using an earlier version of Python, consider [`pipsi`](https://github.com/mitsuhiko/pipsi).
Using [`pipx`](https://github.com/pipxproject/pipx) to install Poetry is also possible.
`pipx` is used to install Python CLI applications globally while still isolating them in virtual environments.
This allows for clean upgrades and uninstalls.

```bash
pipx install poetry
Expand All @@ -134,7 +114,19 @@ pipx upgrade poetry
pipx uninstall poetry
```

[Github repository](https://github.com/cs01/pipx).

#### Installing with `pip`

Using `pip` to install Poetry is possible.

```bash
pip install --user poetry
```

!!!warning

Be aware that it will also install Poetry's dependencies
which might cause conflicts with other packages.


## Updating `poetry`
Expand All @@ -155,18 +147,9 @@ And finally, if you want to install a specific version, you can pass it as an ar
to `self update`.

```bash
poetry self update 0.8.0
poetry self update 1.2.0
```

!!!note

The `self update` command will only work if you used the recommended
installer to install Poetry.

!!!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
Loading