Skip to content

Commit 1bb0a59

Browse files
authored
Merge branch 'main' into docs-existing-project-usage
2 parents 36bb6d6 + 5e1fd5e commit 1bb0a59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1310
-194
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ repos:
2323
- id: check-docstring-first
2424

2525
- repo: https://github.com/pre-commit/pre-commit
26-
rev: v4.5.0
26+
rev: v4.5.1
2727
hooks:
2828
- id: validate_manifest
2929

3030
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.14.6
31+
rev: v0.14.10
3232
hooks:
3333
- id: ruff-check
3434
- id: ruff-format
3535

3636
- repo: https://github.com/woodruffw/zizmor-pre-commit
37-
rev: v1.16.3
37+
rev: v1.19.0
3838
hooks:
3939
- id: zizmor

docs/cli.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,9 +711,15 @@ poetry publish
711711
It can also build the package if you pass it the `--build` option.
712712

713713
{{% note %}}
714-
See [Publishable Repositories]({{< relref "repositories/#publishable-repositories" >}}) for more information on how to configure and use publishable repositories.
714+
See [Publishable Repositories]({{< relref "repositories/#publishable-repositories" >}}) for more information
715+
on how to configure and use publishable repositories.
715716
{{% /note %}}
716717

718+
{{% warning %}}
719+
Only artifacts of the latest version of your package in the dist directory will be uploaded.
720+
Older versions from previous builds as well as artifacts of other packages are ignored.
721+
{{% /warning %}}
722+
717723
#### Options
718724

719725
* `--repository (-r)`: The repository to register the package to (default: `pypi`).

docs/configuration.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ Your local configuration of Poetry application is stored in the `poetry.toml` fi
3535
which is separate from `pyproject.toml`.
3636
{{% /note %}}
3737

38-
{{% warning %}}
39-
Be mindful about checking in this file into your repository since it may contain user-specific or sensitive information.
38+
{{% note %}}
39+
If a setting is defined in both `poetry.toml` (local/project) and `config.toml` (global),
40+
the local/project configuration takes precedence over the global configuration.
4041
{{% /note %}}
4142

43+
{{% warning %}}
44+
Be mindful when checking in this file into your repository since it may contain user-specific or sensitive information.
45+
{{% /warning %}}
46+
4247
## Listing the current configuration
4348

4449
To list the current configuration you can use the `--list` option

docs/plugins.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,16 @@ in the `tool.poetry.requires-plugins` section of the pyproject.toml file:
263263
```toml
264264
[tool.poetry.requires-plugins]
265265
my-application-plugin = ">1.0"
266+
custom-plugin = {path = "custom_plugin", develop = true}
266267
```
267268

268269
If the plugin is not installed in Poetry's own environment when running `poetry install`,
269270
it will be installed only for the current project under `.poetry/plugins`
270271
in the project's directory.
271272

272273
The syntax to specify `plugins` is the same as for [dependencies]({{< relref "managing-dependencies" >}}).
274+
Plugins can be installed in editable mode using path dependencies with `develop = true`,
275+
which is useful for plugin development.
273276

274277
{{% warning %}}
275278
You can even overwrite a plugin in Poetry's own environment with another version.

poetry.lock

Lines changed: 46 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ version = "2.2.1"
44
description = "Python dependency management and packaging made easy."
55
requires-python = ">=3.10,<4.0"
66
dependencies = [
7-
"poetry-core (==2.2.1)",
7+
"poetry-core @ git+https://github.com/python-poetry/poetry-core.git",
88
"build (>=1.2.1,<2.0.0)",
99
"cachecontrol[filecache] (>=0.14.0,<0.15.0)",
1010
"cleo (>=2.1.0,<3.0.0)",
11-
"dulwich (>=0.24.0,<0.25.0)",
11+
"dulwich (>=0.25.0,<0.26.0)",
1212
"fastjsonschema (>=2.18.0,<3.0.0)",
1313
"installer (>=0.7.0,<0.8.0)",
1414
"keyring (>=25.1.0,<26.0.0)",

src/poetry/console/commands/publish.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ def handle(self) -> int:
8282

8383
self.call("build", args=f"--output {dist_dir}")
8484

85-
files = publisher.files
86-
if not files:
85+
publisher = Publisher(self.poetry, self.io, Path(dist_dir))
86+
87+
if not publisher.files:
8788
self.line_error(
8889
"<error>No files to publish. "
8990
"Run poetry build first or use the --build option.</error>"

src/poetry/inspection/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929

3030
if TYPE_CHECKING:
3131
from collections.abc import Iterator
32-
from collections.abc import Mapping
3332
from collections.abc import Sequence
3433

3534
from packaging.metadata import RawMetadata
3635
from packaging.utils import NormalizedName
36+
from poetry.core.packages.package import PackageFile
3737
from poetry.core.packages.project_package import ProjectPackage
3838

3939

@@ -57,7 +57,7 @@ def __init__(
5757
summary: str | None = None,
5858
requires_dist: list[str] | None = None,
5959
requires_python: str | None = None,
60-
files: Sequence[Mapping[str, str]] | None = None,
60+
files: Sequence[PackageFile] | None = None,
6161
yanked: str | bool = False,
6262
cache_version: str | None = None,
6363
) -> None:

src/poetry/packages/locker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,10 @@ def _get_locked_package(
420420
package.files = package_files
421421
elif "hashes" in metadata:
422422
hashes = cast("dict[str, Any]", metadata["hashes"])
423-
package.files = [{"name": h, "hash": h} for h in hashes[name]]
423+
# Strictly speaking, this is not correct,
424+
# but we do not know the file names here,
425+
# so we just set both file and hash.
426+
package.files = [{"file": h, "hash": h} for h in hashes[name]]
424427
elif source_type in {"git", "directory", "url"}:
425428
package.files = []
426429
else:

src/poetry/plugins/plugin_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from functools import cached_property
1010
from importlib import metadata
1111
from pathlib import Path
12+
from site import addsitedir
1213
from typing import TYPE_CHECKING
1314

1415
import tomlkit
@@ -62,7 +63,10 @@ def add_project_plugin_path(directory: Path) -> None:
6263

6364
plugin_path = pyproject_toml.parent / ProjectPluginCache.PATH
6465
if plugin_path.exists():
66+
# insert at the beginning to allow overriding dependencies
6567
EnvManager.get_system_env(naive=True).sys_path.insert(0, str(plugin_path))
68+
# process .pth files (among other things)
69+
addsitedir(str(plugin_path))
6670

6771
@classmethod
6872
def ensure_project_plugins(cls, poetry: Poetry, io: IO) -> None:

0 commit comments

Comments
 (0)