Skip to content

docs: note VCS ignore interaction with packages#10835

Merged
radoering merged 2 commits into
python-poetry:mainfrom
SarthakB11:docs/10831-packages-vcs-warning
Apr 22, 2026
Merged

docs: note VCS ignore interaction with packages#10835
radoering merged 2 commits into
python-poetry:mainfrom
SarthakB11:docs/10831-packages-vcs-warning

Conversation

@SarthakB11
Copy link
Copy Markdown
Contributor

@SarthakB11 SarthakB11 commented Apr 11, 2026

Resolves #10831

What

Adds a short warning block to the packages subsection of docs/pyproject.md explaining that files matched by VCS ignore settings (e.g. .gitignore) are excluded from the built distributions even when their parent directory is listed under packages, and points readers to exclude and include for the include-with-format workaround.

Why

On #10831 the reporter listed a generated-code directory under packages but had the same directory in .gitignore, and poetry build silently produced empty sdist/wheel archives. @dimbleby correctly pointed out that the behaviour is documented in the exclude and include subsection, but the reporter noted (and I agree) that the packages subsection itself does not mention the cross-talk — which is exactly where a user going from "I want to include this directory" to "my build is empty" lands first.

Quoting the reporter's refined ask on 2026-04-09:

However, the documentation for packages does not mention this cross-talk with the version control. If this is intended behaviour, I suggest putting a warning there, similar to that in the exclude-and-include section.

Diff

 Thus, you only have to specify the directory where your root package resides.
 {{% /note %}}
 
+{{% warning %}}
+If a VCS is being used, files matched by its ignore settings (for example by
+`.gitignore` for git) are excluded from the built distributions even when their
+parent directory is listed under `packages`. This can be surprising if a
+`packages` entry points at generated code or another path that is intentionally
+kept out of version control. To ship such files, add them back via
+[`include`]({{< relref "#exclude-and-include" >}}) with an explicit `format`.
+{{% /warning %}}
+
 ### exclude and include

No code change, no behaviour change — docs-only, 9 lines added.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • Consider tightening the warning text to split the long sentence into two (e.g. one for the VCS-ignore behavior and a second for the generated-code scenario) to improve readability and make the key behavior easier to scan.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider tightening the warning text to split the long sentence into two (e.g. one for the VCS-ignore behavior and a second for the generated-code scenario) to improve readability and make the key behavior easier to scan.

## Individual Comments

### Comment 1
<location path="docs/pyproject.md" line_range="702-705" />
<code_context>

+{{% warning %}}
+If a VCS is being used, files matched by its ignore settings (for example by
+`.gitignore` for git) are excluded from the built distributions even when their
+parent directory is listed under `packages`. This can be surprising if a
+`packages` entry points at generated code or another path that is intentionally
</code_context>
<issue_to_address>
**nitpick (typo):** Consider adding a comma after "for example" and capitalizing "Git".

You could rephrase to something like "(for example, by `.gitignore` for Git)" so that "for example" is followed by a comma and the VCS name is capitalized.

```suggestion
{{% warning %}}
If a VCS is being used, files matched by its ignore settings (for example, by
`.gitignore` for Git) are excluded from the built distributions even when their
parent directory is listed under `packages`. This can be surprising if a
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread docs/pyproject.md
@SarthakB11 SarthakB11 force-pushed the docs/10831-packages-vcs-warning branch from fd1a9cf to dc63174 Compare April 18, 2026 19:46
The 'packages' subsection of docs/pyproject.md did not mention that
entries are still subject to the VCS ignore settings that seed the
exclude field (documented in the sibling 'exclude and include'
subsection). This caught a user out on python-poetry#10831 where a package path
pointing at generated code excluded by .gitignore silently produced
empty distributions.

Adds a small warning block to the 'packages' subsection explaining
the interaction and pointing to the 'exclude and include' subsection
for the include-with-format workaround.

Refs python-poetry#10831
@radoering radoering force-pushed the docs/10831-packages-vcs-warning branch from dc63174 to 5d81f75 Compare April 22, 2026 15:26
@radoering radoering added the impact/docs Contains or requires documentation changes label Apr 22, 2026
@github-actions
Copy link
Copy Markdown

Deploy preview for website ready!

Project:website
Status: ✅  Deploy successful!
Preview URL:https://website-f63315r1n-python-poetry.vercel.app
Latest Commit:5d81f75

Deployed with vercel-action

@radoering radoering changed the title docs: note VCS ignore interaction with packages (#10831) docs: note VCS ignore interaction with packages Apr 22, 2026
@radoering radoering changed the title docs: note VCS ignore interaction with packages docs: note VCS ignore interaction with packages Apr 22, 2026
@radoering radoering merged commit b624543 into python-poetry:main Apr 22, 2026
57 checks passed
SarthakB11 added a commit to SarthakB11/SarthakB11 that referenced this pull request Apr 22, 2026
mwalbeck pushed a commit to mwalbeck/docker-python-poetry that referenced this pull request May 10, 2026
This PR contains the following updates:

| Package | Update | Change | Pending |
|---|---|---|---|
| [poetry](https://github.com/python-poetry/poetry) ([changelog](https://python-poetry.org/history/)) | minor | `2.3.4` → `2.4.0` | `2.4.1` |

---

### Release Notes

<details>
<summary>python-poetry/poetry (poetry)</summary>

### [`v2.4.0`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#240---2026-05-03)

[Compare Source](python-poetry/poetry@2.3.4...2.4.0)

##### Added

- Add `solver.min-release-age` setting to require package releases to be a certain number of days old before they are considered during dependency resolution ([#&#8203;10824](python-poetry/poetry#10824)).
- Add `solver.min-release-age-exclude` to exclude selected packages from age filtering ([#&#8203;10824](python-poetry/poetry#10824)).
- Add `solver.min-release-age-exclude-source` to exclude all packages from selected package indexes from age filtering ([#&#8203;10824](python-poetry/poetry#10824)).

##### Changed

- Raise an error instead of silently ignoring a package name that is not a dependency when it is passed to `poetry update` ([#&#8203;10721](python-poetry/poetry#10721)).
- Automatically add a trailing slash to legacy repository URLs (used for publishing) if missing ([#&#8203;10785](python-poetry/poetry#10785)).
- Require `installer>=1.0.0` ([#&#8203;10869](python-poetry/poetry#10869)).
- Allow `findpython>=0.8` ([#&#8203;10874](python-poetry/poetry#10874)).

##### Fixed

- Fix an issue where `requires-plugins` fails on Windows if scheme paths are on different drives ([#&#8203;10869](python-poetry/poetry#10869)).
- Fix an issue where the order of markers in the lock file was not deterministic ([#&#8203;10720](python-poetry/poetry#10720)).
- Fix an issue where the wrong command was suggested when `poetry self` commands failed due to an outdated lock file ([#&#8203;10715](python-poetry/poetry#10715)).
- Fix an issue where `poetry env activate` did not work for bash on Windows ([#&#8203;10716](python-poetry/poetry#10716)).
- Fix an issue where `poetry debug resolve` failed when there was a package with a marker ([#&#8203;10807](python-poetry/poetry#10807)).
- Fix an issue where the error message about a build backend failure contained garbled `--config-settings` ([#&#8203;10804](python-poetry/poetry#10804)).
- Fix an issue where a false warning about a circular dependency was printed ([#&#8203;10811](python-poetry/poetry#10811)).
- Fix an issue where falsy config values were incorrectly treated as not set ([#&#8203;10808](python-poetry/poetry#10808)).
- Fix an issue where `poetry publish --build` ignored failing builds and uploaded stale artifacts ([#&#8203;10802](python-poetry/poetry#10802)).
- Fix an issue where `poetry publish` was aborted instead of retrying after package registration ([#&#8203;10801](python-poetry/poetry#10801)).
- Fix an issue where zip files were not closed after fetching metadata via `lazy-wheel` ([#&#8203;10800](python-poetry/poetry#10800)).
- Fix an issue where data fetched via `lazy-wheel` was corrupted when part of it had already been cached ([#&#8203;10806](python-poetry/poetry#10806)).
- Fix an issue where further packages were installed even though installation should be aborted ([#&#8203;10742](python-poetry/poetry#10742)).
- Fix an issue where installed packages without a `METADATA` file caused an exception on Python 3.15+ ([#&#8203;10860](python-poetry/poetry#10860)).
- Fix an issue where `http-basic` could not be set for repository names with periods ([#&#8203;10845](python-poetry/poetry#10845)).
- Fix an issue where calculating the hash of large wheels failed with a memory error ([#&#8203;10814](python-poetry/poetry#10814)).

##### Docs

- Clarify the precedence of configuration sources ([#&#8203;10757](python-poetry/poetry#10757)).
- Add a note about the influence of `.gitignore` on `tool.poetry.packages` ([#&#8203;10835](python-poetry/poetry#10835)).

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

- Update vendored `packaging` to `26.2` ([#&#8203;936](python-poetry/poetry-core#936)).

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNzAuMTkiLCJ1cGRhdGVkSW5WZXIiOiI0My4xNzAuMTkiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://git.walbeck.it/mwalbeck/docker-python-poetry/pulls/1743
Co-authored-by: renovate-bot <bot@walbeck.it>
Co-committed-by: renovate-bot <bot@walbeck.it>
@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

impact/docs Contains or requires documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

poetry build misses package in a path excluded by .gitignore

3 participants