Skip to content

Update to dulwich 0.25#10665

Closed
hroncok wants to merge 1 commit intopython-poetry:mainfrom
hroncok:peeled
Closed

Update to dulwich 0.25#10665
hroncok wants to merge 1 commit intopython-poetry:mainfrom
hroncok:peeled

Conversation

@hroncok
Copy link
Contributor

@hroncok hroncok commented Dec 18, 2025

PEELED_TAG_SUFFIX was renamed in dulwich 0.21.2: jelmer/dulwich@beb8f959 but it was kept for backwards compatibility until it was completely removed in 0.25.0: jelmer/dulwich@b5674746

In 0.25, it also moved to dulwich.protocol.

Pull Request Check List

  • Added tests for changed code. not applicable
  • Updated documentation for changed code. not applicable

Summary by Sourcery

Update Git backend to use the renamed peeled tag suffix from dulwich and bump the dulwich dependency to the 0.25.x series.

Enhancements:

  • Adjust internal Git tag handling to use the new peeled tag suffix constant introduced in dulwich 0.21.2.

Build:

  • Raise the dulwich dependency range from 0.24.x to 0.25.x in project configuration.

PEELED_TAG_SUFFIX was renamed in dulwich 0.21.2: jelmer/dulwich@beb8f959
but it was kept for backwards compatibility until it was completely removed in 0.25.0:
jelmer/dulwich@b5674746

In 0.25, it also moved to dulwich.protocol.
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 18, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates Poetry’s Git backend to be compatible with dulwich 0.25 by switching from the removed ANNOTATED_TAG_SUFFIX constant to the new PEELED_TAG_SUFFIX and bumping the dulwich dependency range accordingly.

Class diagram for git backend changes using PEELED_TAG_SUFFIX

classDiagram
    class GitBackendModule {
        +annotated_tag(ref) bytes
        +_clone(url, refspec, target) Repo
    }

    class DulwichProtocol {
        <<external>>
        +PEELED_TAG_SUFFIX bytes
    }

    GitBackendModule ..> DulwichProtocol : uses PEELED_TAG_SUFFIX

    class annotated_tag {
        +ref str_or_bytes
        +return bytes
    }

    class _clone {
        +url str
        +refspec GitRefSpec
        +target Path
        +return Repo
    }

    GitBackendModule o-- annotated_tag : defines
    GitBackendModule o-- _clone : defines

    annotated_tag ..> DulwichProtocol : appends PEELED_TAG_SUFFIX
    _clone ..> DulwichProtocol : filters refs not ending with PEELED_TAG_SUFFIX
Loading

File-Level Changes

Change Details Files
Switch Git tag handling from ANNOTATED_TAG_SUFFIX to PEELED_TAG_SUFFIX to match dulwich 0.25 API.
  • Update annotated_tag helper to append the PEELED_TAG_SUFFIX constant instead of ANNOTATED_TAG_SUFFIX.
  • Adjust filtering of remote refs so it excludes peeled tag refs using PEELED_TAG_SUFFIX in the suffix check.
src/poetry/vcs/git/backend.py
Bump dulwich dependency to the 0.25.x series.
  • Raise the minimum dulwich version to 0.25.0 and the upper bound to <0.26.0 in project metadata.
  • Regenerate lockfile entries to reflect the new dulwich version (and any transitive updates).
pyproject.toml
poetry.lock

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.

Hey there - I've reviewed your changes - here's some feedback:

  • Since PEELED_TAG_SUFFIX moved to dulwich.protocol in 0.25, make sure the imports are updated accordingly and that ANNOTATED_TAG_SUFFIX is removed or no longer referenced anywhere in the codebase.
  • Given the minimum dulwich version is now 0.25, consider checking whether any other dulwich APIs used in this module changed between 0.24 and 0.25 to avoid subtle runtime issues (e.g., renamed or relocated symbols).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since `PEELED_TAG_SUFFIX` moved to `dulwich.protocol` in 0.25, make sure the imports are updated accordingly and that `ANNOTATED_TAG_SUFFIX` is removed or no longer referenced anywhere in the codebase.
- Given the minimum dulwich version is now 0.25, consider checking whether any other dulwich APIs used in this module changed between 0.24 and 0.25 to avoid subtle runtime issues (e.g., renamed or relocated symbols).

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.

@hroncok
Copy link
Contributor Author

hroncok commented Dec 18, 2025

seems like mypy has exploded. Perhaps this is less ready than I thought. I won't be able to update the annotations if they are caused by new dulwich types :/

EDIT: They are. Changes like this are needed, but not all of them re so trivial

+ from dulwich.refs import HEADREF, Ref
 ...
-    ref: bytes = dataclasses.field(default_factory=lambda: b"HEAD")
+    ref: Ref = dataclasses.field(default_factory=lambda: HEADREF)

@hroncok hroncok marked this pull request as draft December 18, 2025 19:15
@Secrus
Copy link
Member

Secrus commented Dec 29, 2025

Superseded by #10674

@Secrus Secrus closed this Dec 29, 2025
@github-actions
Copy link

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 Jan 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants