Skip to content

Conversation

@daniel7an
Copy link

@daniel7an daniel7an commented Feb 9, 2026

Fixes python-poetry/poetry#10714

When readme is specified as inline text in pyproject.toml, the text was incorrectly joined with the project root path. Changed to use the text value directly.

Added test_create_poetry_inline_readme_text.

Summary by Sourcery

Handle inline README text correctly when creating Poetry packages.

Bug Fixes:

  • Use the inline README text value directly instead of treating it as a filesystem path when parsing pyproject.toml.

Tests:

  • Add a factory test verifying that inline README text and its content type are preserved on the created package.

When readme is specified as inline text in pyproject.toml
(e.g. readme = { text = "some text", content-type = "text/markdown" }),
the text content was incorrectly being joined with the project root path
via `root / readme["text"]`, producing a bogus path instead of using
the text directly.

Fixes python-poetry/poetry#10714
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 9, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts how inline README text from pyproject.toml is handled by the Factory, and adds a regression test to verify correct readme content and content-type extraction.

Sequence diagram for handling inline README text in package metadata

sequenceDiagram
    actor Developer
    participant PoetryCLI
    participant Factory
    participant Package

    Developer->>PoetryCLI: Run build / publish with pyproject.toml
    PoetryCLI->>Factory: _configure_package_metadata(pyproject, root, package)
    Factory->>Factory: Detect readme.text in tool.poetry.readme
    Factory->>Package: set readme_content(readme.text)
    Factory->>Package: set readme_content_type(readme.content-type)
    PoetryCLI->>Package: Read readme_content and readme_content_type for packaging
    Package-->>PoetryCLI: Inline README content used directly
Loading

File-Level Changes

Change Details Files
Use inline README text value directly instead of treating it as a filesystem path when configuring package metadata.
  • Change readme handling so that when a README is provided as inline text, the raw text value is assigned to the package readme_content field.
  • Ensure that only file-based README configuration is joined with the project root, while text-based configuration bypasses path joining.
src/poetry/core/factory.py
Add regression test to cover inline README text handling in pyproject.toml.
  • Create a temporary pyproject.toml defining project.readme as an inline text table with content-type.
  • Instantiate a Poetry object via Factory().create_poetry and assert that readme_content and readme_content_type are set from the inline text configuration.
tests/test_factory.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@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.

We failed to fetch pull request #914.

You can try again by commenting this pull request with @sourcery-ai review, or contact us for help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

makes a mess of "readme.text" in pyproject.toml

1 participant