Skip to content

Commit

Permalink
Merge branch 'master' into docs/pipx-first
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus authored Sep 11, 2023
2 parents 692f410 + 6b1a640 commit d25ebfd
Show file tree
Hide file tree
Showing 60 changed files with 1,152 additions and 691 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
timeout 10s poetry run pip --version || rm -rf .venv
- name: Check lock file
run: poetry lock --check
run: poetry check --lock

- name: Install dependencies
run: poetry install --with github-actions
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ repos:
- id: debug-statements
- id: check-docstring-first

- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.0
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit
rev: v3.3.3
rev: v3.4.0
hooks:
- id: validate_manifest

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.280
rev: v0.0.287
hooks:
- id: ruff
14 changes: 12 additions & 2 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,30 @@
entry: poetry check
language: python
pass_filenames: false
files: ^(.*/)?pyproject.toml$
files: ^(.*/)?pyproject\.toml$

- id: poetry-lock
name: poetry-lock
description: run poetry lock to update lock file
entry: poetry lock
language: python
pass_filenames: false
files: ^(.*/)?(poetry\.lock|pyproject\.toml)$

- id: poetry-export
name: poetry-export
description: run poetry export to sync lock file with requirements.txt
entry: poetry export
language: python
pass_filenames: false
files: ^poetry.lock$
files: ^(.*/)?poetry\.lock$
args: ["-f", "requirements.txt", "-o", "requirements.txt"]

- id: poetry-install
name: poetry-install
description: run poetry install to install dependencies from the lock file
entry: poetry install
language: python
pass_filenames: false
stages: [post-checkout, post-merge]
always_run: true
66 changes: 65 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,68 @@
# Change Log


## [1.6.1] - 2023-08-21

### Fixed

- Update the minimum required version of `requests` ([#8336](https://github.com/python-poetry/poetry/pull/8336)).


## [1.6.0] - 2023-08-20

### Added

- **Add support for repositories that do not provide a supported hash algorithm** ([#8118](https://github.com/python-poetry/poetry/pull/8118)).
- **Add full support for duplicate dependencies with overlapping markers** ([#7257](https://github.com/python-poetry/poetry/pull/7257)).
- **Improve performance of `poetry lock` for certain edge cases** ([#8256](https://github.com/python-poetry/poetry/pull/8256)).
- Improve performance of `poetry install` ([#8031](https://github.com/python-poetry/poetry/pull/8031)).
- `poetry check` validates that specified `readme` files do exist ([#7444](https://github.com/python-poetry/poetry/pull/7444)).
- Add a downgrading note when updating to an older version ([#8176](https://github.com/python-poetry/poetry/pull/8176)).
- Add support for `vox` in the `xonsh` shell ([#8203](https://github.com/python-poetry/poetry/pull/8203)).
- Add support for `pre-commit` hooks for projects where the pyproject.toml file is located in a subfolder ([#8204](https://github.com/python-poetry/poetry/pull/8204)).
- Add support for the `git+http://` scheme ([#6619](https://github.com/python-poetry/poetry/pull/6619)).

### Changed

- **Drop support for Python 3.7** ([#7674](https://github.com/python-poetry/poetry/pull/7674)).
- Move `poetry lock --check` to `poetry check --lock` and deprecate the former ([#8015](https://github.com/python-poetry/poetry/pull/8015)).
- Change future warning that PyPI will only be disabled automatically if there are no primary sources ([#8151](https://github.com/python-poetry/poetry/pull/8151)).

### Fixed

- Fix an issue where `build-system.requires` were not respected for projects with build scripts ([#7975](https://github.com/python-poetry/poetry/pull/7975)).
- Fix an issue where the encoding was not handled correctly when calling a subprocess ([#8060](https://github.com/python-poetry/poetry/pull/8060)).
- Fix an issue where `poetry show --top-level` did not show top level dependencies with extras ([#8076](https://github.com/python-poetry/poetry/pull/8076)).
- Fix an issue where `poetry init` handled projects with `src` layout incorrectly ([#8218](https://github.com/python-poetry/poetry/pull/8218)).
- Fix an issue where Poetry wrote `.pth` files with the wrong encoding ([#8041](https://github.com/python-poetry/poetry/pull/8041)).
- Fix an issue where `poetry install` did not respect the source if the same version of a package has been locked from different sources ([#8304](https://github.com/python-poetry/poetry/pull/8304)).

### Docs

- Document **official Poetry badge** ([#8066](https://github.com/python-poetry/poetry/pull/8066)).
- Update configuration folder path for macOS ([#8062](https://github.com/python-poetry/poetry/pull/8062)).
- Add a warning about pip ignoring lock files ([#8117](https://github.com/python-poetry/poetry/pull/8117)).
- Clarify the use of the `virtualenvs.in-project` setting. ([#8126](https://github.com/python-poetry/poetry/pull/8126)).
- Change `pre-commit` YAML style to be consistent with pre-commit's own examples ([#8146](https://github.com/python-poetry/poetry/pull/8146)).
- Fix command for listing installed plugins ([#8200](https://github.com/python-poetry/poetry/pull/8200)).
- Mention the `nox-poetry` package ([#8173](https://github.com/python-poetry/poetry/pull/8173)).
- Add an example with a PyPI source in the pyproject.toml file ([#8171](https://github.com/python-poetry/poetry/pull/8171)).
- Use `reference` instead of deprecated `callable` in the scripts example ([#8211](https://github.com/python-poetry/poetry/pull/8211)).

### poetry-core ([`1.7.0`](https://github.com/python-poetry/poetry-core/releases/tag/1.7.0))

- Improve performance of marker handling ([#609](https://github.com/python-poetry/poetry-core/pull/609)).
- Allow `|` as a value separator in markers with the operators `in` and `not in` ([#608](https://github.com/python-poetry/poetry-core/pull/608)).
- Put pretty name (instead of normalized name) in metadata ([#620](https://github.com/python-poetry/poetry-core/pull/620)).
- Update list of supported licenses ([#623](https://github.com/python-poetry/poetry-core/pull/623)).
- Fix an issue where PEP 508 dependency specifications with names starting with a digit could not be parsed ([#607](https://github.com/python-poetry/poetry-core/pull/607)).
- Fix an issue where Poetry considered an unrelated `.gitignore` file resulting in an empty wheel ([#611](https://github.com/python-poetry/poetry-core/pull/611)).

### poetry-plugin-export ([`^1.5.0`](https://github.com/python-poetry/poetry-plugin-export/releases/tag/1.5.0))

- Fix an issue where markers for dependencies required by an extra were not generated correctly ([#209](https://github.com/python-poetry/poetry-plugin-export/pull/209)).


## [1.5.1] - 2023-05-29

### Added
Expand Down Expand Up @@ -1904,7 +1966,9 @@ Initial release



[Unreleased]: https://github.com/python-poetry/poetry/compare/1.5.1...master
[Unreleased]: https://github.com/python-poetry/poetry/compare/1.6.1...master
[1.6.1]: https://github.com/python-poetry/poetry/releases/tag/1.6.1
[1.6.0]: https://github.com/python-poetry/poetry/releases/tag/1.6.0
[1.5.1]: https://github.com/python-poetry/poetry/releases/tag/1.5.1
[1.5.0]: https://github.com/python-poetry/poetry/releases/tag/1.5.0
[1.4.2]: https://github.com/python-poetry/poetry/releases/tag/1.4.2
Expand Down
9 changes: 9 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,17 @@ The table below illustrates the effect of these rules with concrete examples.
| prerelease | 1.0.3a0 | 1.0.3a1 |
| prerelease | 1.0.3b0 | 1.0.3b1 |

The option `--next-phase` allows the increment of prerelease phase versions.

| rule | before | after |
|-------------------------|----------|----------|
| prerelease --next-phase | 1.0.3a0 | 1.0.3b0 |
| prerelease --next-phase | 1.0.3b0 | 1.0.3rc0 |
| prerelease --next-phase | 1.0.3rc0 | 1.0.3 |

### Options

* `--next-phase`: Increment the phase of the current version.
* `--short (-s)`: Output the version number only.
* `--dry-run`: Do not update pyproject.toml file.

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ poetry run pre-commit run --all-files
* Fill out the pull request body completely and describe your changes as accurately as possible. The pull request body
should be kept up to date as it will usually form the base for the final merge commit and the changelog entry.
* Be sure that your pull request contains tests that cover the changed or added code. Tests are generally required for
code be to be considered mergable, and code without passing tests will not be merged.
code be to be considered mergeable, and code without passing tests will not be merged.
* Ensure your pull request passes the mypy and pre-commit checks. Remember that you can run these tools locally
instead of relying on remote CI.
* If your changes warrant a documentation change, the pull request must also update the documentation. Make sure to
Expand Down
10 changes: 5 additions & 5 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ In this case, you can disable this feature by setting the `virtualenvs.create` s
poetry config virtualenvs.create false
```

### Why is Poetry telling me that the current project's Python requirement is not compatible with one or more packages' Python requirements?
### Why is Poetry telling me that the current project's supported Python range is not compatible with one or more packages' Python requirements?

Unlike `pip`, Poetry doesn't resolve for just the Python in the current environment. Instead it makes sure that a dependency
is resolvable within the given Python version range in `pyproject.toml`.
Expand All @@ -179,18 +179,18 @@ This means your project aims to be compatible with any Python version >=3.7,<4.0
whose Python requirement doesn't match the whole range Poetry will tell you this, e.g.:

```
The current project's Python requirement (>=3.7.0,<4.0.0) is not compatible with some of the required packages Python requirement:
The current project's supported Python range (>=3.7.0,<4.0.0) is not compatible with some of the required packages Python requirement:
- scipy requires Python >=3.7,<3.11, so it will not be satisfied for Python >=3.11,<4.0.0
```

Usually you will want to match the Python requirement of your project with the upper bound of the failing dependency.
Alternative you can tell Poetry to install this dependency [only for a specific range of Python versions]({{< relref "dependency-specification#multiple-constraints-dependencies" >}}),
Usually you will want to match the supported Python range of your project with the upper bound of the failing dependency.
Alternatively you can tell Poetry to install this dependency [only for a specific range of Python versions]({{< relref "dependency-specification#multiple-constraints-dependencies" >}}),
if you know that it's not needed in all versions.


### Why does Poetry enforce PEP 440 versions?

This is done so to be compliant with the broader Python ecosystem.
This is done to be compliant with the broader Python ecosystem.

For example, if Poetry builds a distribution for a project that uses a version that is not valid according to
[PEP 440](https://peps.python.org/pep-0440), third party tools will be unable to parse the version correctly.
Expand Down
2 changes: 1 addition & 1 deletion docs/managing-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ By default, Poetry will try to use the Python version used during Poetry's insta
to create the virtual environment for the current project.

However, for various reasons, this Python version might not be compatible
with the `python` requirement of the project. In this case, Poetry will try
with the `python` range supported by the project. In this case, Poetry will try
to find one that is and use it. If it's unable to do so then you will be prompted
to activate one explicitly, see [Switching environments](#switching-between-environments).

Expand Down
42 changes: 34 additions & 8 deletions docs/pre-commit-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ the defaults are overwritten. You must fully specify all arguments for
your hook if you make use of `args:`.
{{% /note %}}

{{% note %}}
If the `pyproject.toml` file is not in the root directory, you can specify `args: ["-C", "./subdirectory"]`.
{{% /note %}}

## poetry-check

The `poetry-check` hook calls the `poetry check` command
Expand All @@ -34,10 +38,6 @@ to make sure the poetry configuration does not get committed in a broken state.
The hook takes the same arguments as the poetry command.
For more information see the [check command]({{< relref "cli#check" >}}).

{{% note %}}
If the `pyproject.toml` file is not in the root directory, you can specify `args: ["-C", "./subdirectory"]`.
{{% /note %}}

## poetry-lock

The `poetry-lock` hook calls the `poetry lock` command
Expand All @@ -48,7 +48,6 @@ to make sure the lock file is up-to-date when committing changes.
The hook takes the same arguments as the poetry command.
For more information see the [lock command]({{< relref "cli#lock" >}}).


## poetry-export

The `poetry-export` hook calls the `poetry export` command
Expand All @@ -64,7 +63,7 @@ The hook takes the same arguments as the poetry command.
For more information see the [export command]({{< relref "cli#export" >}}).

The default arguments are `args: ["-f", "requirements.txt", "-o", "requirements.txt"]`,
which will create/update the requirements.txt file in the current working directory.
which will create/update the `requirements.txt` file in the current working directory.

You may add `verbose: true` in your `.pre-commit-config.yaml` in order to output to the
console:
Expand All @@ -84,22 +83,49 @@ hooks:
args: ["--dev", "-f", "requirements.txt", "-o", "requirements.txt"]
```

## poetry-install

The `poetry-install` hook calls the `poetry install` command to make sure all locked packages are installed.
In order to install this hook, you either need to specify `default_install_hook_types`, or you have
to install it via `pre-commit install --install-hooks -t post-checkout -t post-merge`.

### Arguments

The hook takes the same arguments as the poetry command.
For more information see the [install command]({{< relref "cli#install" >}}).

## Usage

For more information on how to use pre-commit please see the [official documentation](https://pre-commit.com/).

A full `.pre-commit-config.yaml` example:
A minimalistic `.pre-commit-config.yaml` example:

```yaml
repos:
- repo: https://github.com/python-poetry/poetry
rev: '' # add version here
hooks:
- id: poetry-check
- id: poetry-lock
- id: poetry-export
- id: poetry-install
```

A `.pre-commit-config.yaml` example for a monorepo setup or if the `pyproject.toml` file is not in the root directory:

```yaml
repos:
- repo: https://github.com/python-poetry/poetry
rev: '' # add version here
hooks:
- id: poetry-check
args: ["-C", "./subdirectory"]
- id: poetry-lock
args: ["-C", "./subdirectory"]
- id: poetry-export
args: ["-f", "requirements.txt", "-o", "requirements.txt"]
args: ["-C", "./subdirectory", "-f", "requirements.txt", "-o", "./subdirectory/requirements.txt"]
- id: poetry-install
args: ["-C", "./subdirectory"]
```

## FAQ
Expand Down
2 changes: 1 addition & 1 deletion docs/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ To specify a script that [depends on an extra](#extras), you may provide an entr

```toml
[tool.poetry.scripts]
devtest = { callable = "mypackage:test.run_tests", extras = ["test"] }
devtest = { reference = "mypackage:test.run_tests", extras = ["test"], type = "console" }
```

{{% note %}}
Expand Down
12 changes: 12 additions & 0 deletions docs/repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ poetry source add --priority=primary PyPI

This way, the priority of PyPI can be set in a fine-granular way.

The equivalent specification in `pyproject.toml` is:

```toml
[[tool.poetry.source]]
name = "pypi"
priority = "primary"
```

**Omit the `url` when specifying PyPI explicitly.** Because PyPI is internally configured
with Poetry, the PyPI repository cannot be configured with a given URL. Remember, you can always use
`poetry check` to ensure the validity of the `pyproject.toml` file.

{{% /warning %}}

{{% warning %}}
Expand Down
Loading

0 comments on commit d25ebfd

Please sign in to comment.