Skip to content

Commit

Permalink
Merge branch 'master' into sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
br3ndonland committed Jul 5, 2021
2 parents 536500f + 22c3aad commit 6e09fa5
Show file tree
Hide file tree
Showing 60 changed files with 1,695 additions and 947 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/docs.yml

This file was deleted.

33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Change Log

## [1.2.0a1] - 2021-05-21

This release is the first testing release of the upcoming 1.2.0 version.

It **drops** support for Python 2.7 and 3.5.

### Added

- Poetry now supports a plugin system to alter or expand Poetry's functionality. ([#3733](https://github.com/python-poetry/poetry/pull/3733))
- Poetry now supports [PEP 610](https://www.python.org/dev/peps/pep-0610/). ([#3876](https://github.com/python-poetry/poetry/pull/3876))
- Several configuration options to better control the way virtual environments are created are now available. ([#3157](https://github.com/python-poetry/poetry/pull/3157), [#3711](https://github.com/python-poetry/poetry/pull/3711)).
- The `new` command now supports namespace packages. ([#2768](https://github.com/python-poetry/poetry/pull/2768))
- The `add` command now supports the `--editable` option to add packages in editable mode. ([#3940](https://github.com/python-poetry/poetry/pull/3940))

### Changed

- Python 2.7 and 3.5 are no longer supported. ([#3405](https://github.com/python-poetry/poetry/pull/3405))
- The usage of the `get-poetry.py` script is now deprecated and is replaced by the `install-poetry.py` script. ([#3706](https://github.com/python-poetry/poetry/pull/3706))
- Directory dependencies are now in non-develop mode by default. ([poetry-core#98](https://github.com/python-poetry/poetry-core/pull/98))
- Improved support for PEP 440 specific versions that do not abide by semantic versioning. ([poetry-core#140](https://github.com/python-poetry/poetry-core/pull/140))
- Improved the CLI experience and performance by migrating to the latest version of Cleo. ([#3618](https://github.com/python-poetry/poetry/pull/3618))
- Packages previously considered as unsafe (`pip`, `setuptools`, `wheels` and `distribute`) can now be managed as any other package. ([#2826](https://github.com/python-poetry/poetry/pull/2826))
- The `new` command now defaults to the Markdown format for README files. ([#2768](https://github.com/python-poetry/poetry/pull/2768))

### Fixed

- Fixed an error where command line options were not taken into account when using the `run` command. ([#3618](https://github.com/python-poetry/poetry/pull/3618))
- Fixed an error in the way custom repositories were resolved. ([#3406](https://github.com/python-poetry/poetry/pull/3406))


## [1.1.5] - 2021-03-04

### Fixed
Expand Down Expand Up @@ -1093,7 +1123,8 @@ Initial release



[Unreleased]: https://github.com/python-poetry/poetry/compare/1.1.4...master
[Unreleased]: https://github.com/python-poetry/poetry/compare/1.2.0a1...master
[1.2.0a1]: https://github.com/python-poetry/poetry/compare/1.2.0a1
[1.1.4]: https://github.com/python-poetry/poetry/compare/1.1.4
[1.1.3]: https://github.com/python-poetry/poetry/compare/1.1.3
[1.1.2]: https://github.com/python-poetry/poetry/releases/tag/1.1.2
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-
**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:
The installer installs the `poetry` tool to Poetry's `bin` directory. This location depends on your system:

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

If this directory is not on you `PATH`, you will need to add it manually
If this directory is not on your `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.
Expand Down Expand Up @@ -92,6 +92,9 @@ python install-poetry.py --git https://github.com/python-poetry/poetry.git@maste

Updating poetry to the latest stable version is as simple as calling the `self update` command.

**Warning**: Poetry versions installed using the now deprecated `get-poetry.py` installer will not be able to use this
command to update to 1.2 releases or later. Migrate to using the `install-poetry.py` installer or `pipx`.

```bash
poetry self update
```
Expand Down
62 changes: 38 additions & 24 deletions docs/docs/index.md → docs/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
---
title: "Introduction"
draft: false
type: docs
layout: "single"

menu:
docs:
weight: 0
---

# Introduction

Poetry is a tool for dependency management and packaging in Python.
Poetry is a tool for **dependency management** and **packaging** in Python.
It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.


Expand All @@ -9,11 +20,10 @@ It allows you to declare the libraries your project depends on and it will manag
Poetry requires Python 2.7 or 3.5+. It is multi-platform and the goal is to make it work equally well
on Windows, Linux and OSX.

!!! note

Python 2.7 and 3.5 will no longer be supported in the next feature release (1.2).
You should consider updating your Python version to a supported one.

{{% note %}}
Python 2.7 and 3.5 will no longer be supported in the next feature release (1.2).
You should consider updating your Python version to a supported one.
{{% /note %}}

## Installation

Expand All @@ -29,17 +39,17 @@ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-
(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.
{{% 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.
{{% /warning %}}

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. This location depends on your system:

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

If this directory is not on you `PATH`, you will need to add it manually
If this directory is not on your `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.
Expand Down Expand Up @@ -89,9 +99,9 @@ You can also install Poetry for a `git` repository by using the `--git` option:
python install-poetry.py --git https://github.com/python-poetry/poetry.git@master
````

!!!note

Note that the installer does not support Python < 3.6.
{{% note %}}
Note that the installer does not support Python < 3.6.
{{% /note %}}


### Alternative installation methods
Expand Down Expand Up @@ -123,11 +133,10 @@ Using `pip` to install Poetry is possible.
pip install --user poetry
```

!!!warning

Be aware that it will also install Poetry's dependencies
which might cause conflicts with other packages.
{{% warning %}}
Be aware that it will also install Poetry's dependencies
which might cause conflicts with other packages.
{{% /warning %}}
## Updating `poetry`
Expand All @@ -137,6 +146,11 @@ Updating Poetry to the latest stable version is as simple as calling the `self u
poetry self update
```
{{% warning %}}
Poetry versions installed using the now deprecated `get-poetry.py` installer will not be able to use this
command to update to 1.2 releases or later. Migrate to using the `install-poetry.py` installer or `pipx`.
{{% /warning %}}
If you want to install pre-release versions, you can use the `--preview` option.
```bash
Expand Down Expand Up @@ -182,9 +196,9 @@ poetry completions zsh > ~/.zprezto/modules/completion/external/src/_poetry
```
!!! note
You may need to restart your shell in order for the changes to take effect.
{{% note %}}
You may need to restart your shell in order for the changes to take effect.
{{% /note %}}
For `zsh`, you must then add the following line in your `~/.zshrc` before `compinit`:
Expand All @@ -194,7 +208,7 @@ fpath+=~/.zfunc
For `oh-my-zsh`, you must then enable poetry in your `~/.zshrc` plugins
```
```text
plugins(
poetry
...
Expand Down
82 changes: 47 additions & 35 deletions docs/docs/basic-usage.md → docs/basic-usage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
---
title: "Basic usage"
draft: false
type: docs
layout: single

menu:
docs:
weight: 10
---

# Basic usage

For the basic usage introduction we will be installing `pendulum`, a datetime library.
If you have not yet installed Poetry, refer to the [Introduction](/docs/) chapter.
If you have not yet installed Poetry, refer to the [Introduction]({{< relref "docs" >}} "Introduction") chapter.

## Project setup

Expand Down Expand Up @@ -77,8 +88,8 @@ It will automatically find a suitable version constraint **and install** the pac
## Using your virtual environment

By default, poetry creates a virtual environment in `{cache-dir}/virtualenvs` (`{cache-dir}\virtualenvs` on Windows).
You can change the [`cache-dir`](/docs/configuration/#cache-dir) value by editing the poetry config.
Additionally, you can use the [`virtualenvs.in-project`](/docs/configuration/#virtualenvs.in-project) configuration variable
You can change the [`cache-dir`]({{< relref "configuration#cache-dir" >}} "cache-dir configuration documentation") value by editing the poetry config.
Additionally, you can use the [`virtualenvs.in-project`]({{< relref "configuration#virtualenvsin-project" >}} "#virtualenvs.in-project configuration documentation") configuration variable
to create virtual environment within your project directory.


Expand All @@ -96,18 +107,19 @@ The easiest way to activate the virtual environment is to create a new shell wit
To deactivate the virtual environment and exit this new shell type `exit`.
To deactivate the virtual environment without leaving the shell use `deactivate`.

!!!note
{{% note %}}
**Why a new shell?**

**Why a new shell?**
Child processes inherit their environment from their parents, but do not share
them. As such, any modifications made by a child process, is not persisted after
the child process exits. A Python application (Poetry), being a child process,
cannot modify the environment of the shell that it has been called from such
that an activated virtual environment remains active after the Poetry command
has completed execution.
Child processes inherit their environment from their parents, but do not share
them. As such, any modifications made by a child process, is not persisted after
the child process exits. A Python application (Poetry), being a child process,
cannot modify the environment of the shell that it has been called from such
that an activated virtual environment remains active after the Poetry command
has completed execution.

Therefore, Poetry has to create a sub-shell with the virtual environment activated
in order for the subsequent commands to run from within the virtual environment.
Therefore, Poetry has to create a sub-shell with the virtual environment activated
in order for the subsequent commands to run from within the virtual environment.
{{% /note %}}


Alternatively, to avoid creating a new shell, you can manually activate the
Expand All @@ -116,33 +128,33 @@ To get the path to your virtual environment run `poetry env info --path`.
You can also combine these into a nice one-liner, `source $(poetry env info --path)/bin/activate`
To deactivate this virtual environment simply use `deactivate`.

| | POSIX Shell | Windows | Exit/Deactivate |
|-------------------|---------------------------------------------------|---------------------------------------------|-----------------|
| New Shell | `poetry shell` | `poetry shell` | `exit` |
| Manual Activation | `source {path_to_venv}/bin/activate` | `{path_to_venv}\Scripts\activate.bat` | `deactivate` |
| One-liner | ```source `poetry env info --path`/bin/activate```| | `deactivate` |
| | POSIX Shell | Windows | Exit/Deactivate |
| ----------------- | -------------------------------------------------- | ------------------------------------- | --------------- |
| New Shell | `poetry shell` | `poetry shell` | `exit` |
| Manual Activation | `source {path_to_venv}/bin/activate` | `{path_to_venv}\Scripts\activate.bat` | `deactivate` |
| One-liner | ```source `poetry env info --path`/bin/activate``` | | `deactivate` |


### Version constraints

In our example, we are requesting the `pendulum` package with the version constraint `^1.4`.
This means any version greater or equal to 1.4.0 and less than 2.0.0 (`>=1.4.0 <2.0.0`).

Please read [Dependency specification](/docs/dependency-specification) for more in-depth information on versions,
Please read [Dependency specification]({{< relref "dependency-specification" >}} "Dependency specification documentation") for more in-depth information on versions,
how versions relate to each other, and on the different ways you can specify dependencies.


!!!note

**How does Poetry download the right files?**
{{% note %}}
**How does Poetry download the right files?**

When you specify a dependency in `pyproject.toml`, Poetry first takes the name of the package
that you have requested and searches for it in any repository you have registered using the `repositories` key.
If you have not registered any extra repositories, or it does not find a package with that name in the
repositories you have specified, it falls back on PyPI.
When you specify a dependency in `pyproject.toml`, Poetry first takes the name of the package
that you have requested and searches for it in any repository you have registered using the `repositories` key.
If you have not registered any extra repositories, or it does not find a package with that name in the
repositories you have specified, it falls back on PyPI.

When Poetry finds the right package, it then attempts to find the best match
for the version constraint you have specified.
When Poetry finds the right package, it then attempts to find the best match
for the version constraint you have specified.
{{% /note %}}


## Installing dependencies
Expand Down Expand Up @@ -189,9 +201,9 @@ Even if you develop alone, in six months when reinstalling the project you can f
the dependencies installed are still working even if your dependencies released many new versions since then.
(See note below about using the update command.)

!!!note

For libraries it is not necessary to commit the lock file.
{{% note %}}
For libraries it is not necessary to commit the lock file.
{{% /note %}}

### Installing dependencies only

Expand All @@ -212,7 +224,7 @@ This will fetch the latest matching versions (according to your `pyproject.toml`
and update the lock file with the new versions.
(This is equivalent to deleting the `poetry.lock` file and running `install` again.)

!!!note

Poetry will display a **Warning** when executing an install command if `poetry.lock` and `pyproject.toml`
are not synchronized.
{{% note %}}
Poetry will display a **Warning** when executing an install command if `poetry.lock` and `pyproject.toml`
are not synchronized.
{{% /note %}}
Loading

0 comments on commit 6e09fa5

Please sign in to comment.