Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Support PEP 735 [dependency-groups] in pyproject.toml #10847

Open
1 task done
vrslev opened this issue Oct 27, 2024 · 12 comments · Fixed by #11796
Open
1 task done

Python: Support PEP 735 [dependency-groups] in pyproject.toml #10847

vrslev opened this issue Oct 27, 2024 · 12 comments · Fixed by #11796
Labels
L: python T: feature-request Requests for new features

Comments

@vrslev
Copy link

vrslev commented Oct 27, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Feature description

uv recently released new version that supports now standardized [dependency-groups] table. See uv 0.4.27 and PEP 735.

@vrslev vrslev added the T: feature-request Requests for new features label Oct 27, 2024
@vrslev vrslev changed the title Support PEP 735 [dependency-groups] in pyproject.toml Python: Support PEP 735 [dependency-groups] in pyproject.toml Oct 27, 2024
@KyeRussell
Copy link

KyeRussell commented Nov 18, 2024

Additional context to hopefully nudge this one along: this is a dependency declaration standard being used right now by at least one Python package / project manager with a significant userbase (uv via uv add --dev ...). Parsing this is essentially the same as parsing [project.optional-dependencies], which dependabot can already handle. It's be great to see this included!

@dpgraham4401
Copy link

dpgraham4401 commented Nov 18, 2024

It's also used by PDM. Our team encountered error from dependabot if there were multiple groups listed under the dependency-groups section.

Dependabot can't parse your pyproject.toml
Dependabot failed to update your dependencies because there was an error parsing the pyproject.toml found at /pyproject.toml.

Dependabot encountered the following error:

/pyproject.toml not parseable

The logs do not include additional information about the parsing error. We were able to troubleshoot by placing all dependency-groups into one dev group.

EDIT: after placing all development dependencies into one dev group under the [dependency-groups], dependabot stopped erroring but actually didn't successfully start creating PRs. We ended up moving to the uv pip interface and optional-dependencies for the time being.

@evanbernstein
Copy link

I really hope that Dependabot is updated to support dev dependencies for modern python tooling. My codebases currently use two package managers, one for dependabot and the real one, which I have to update manually when dependabot pings us to update the old one. It is gross. I'm so glad that the python community is landing on a standard, and I hope it gets implemented soon!

@AA-Turner
Copy link

The pip project has just merged support for the PEP 735 [dependency-groups] table (pypa/pip#13065), which will likely be released in April.

@markhallen
Copy link
Contributor

We have raised an issue for the toml-rb gem.

If they don't have a quick fix for this we have the option to use tomlrb or perfect_toml:

# minimal.toml
[dependency-groups]
dev = [
    {"include-group" = "docs"},
    "deptry>=0.15.0",
]
docs = [
    "furo>=2024.5.6",
]
irb(main):005:0> Tomlrb.load_file("minimal.toml")
=> {"dependency-groups"=>{"dev"=>[{"include-group"=>"docs"}, "deptry>=0.15.0"], "docs"=>["furo>=2024.5.6"]}}
irb(main):006:0> PerfectTOML.load_file("minimal.toml")
=> {"dependency-groups"=>{"dev"=>[{"include-group"=>"docs"}, "deptry>=0.15.0"], "docs"=>["furo>=2024.5.6"]}}

@markhallen
Copy link
Contributor

This is closed for uv, but I need to test the handling for other python package managers before closing.

@markhallen markhallen reopened this Mar 13, 2025
@evanbernstein
Copy link

@markhallen Thanks for doing this. If I'm reading this correctly, if I switch from rye to uv then Dependabot will work correctly for all packages? If so, I've found a new project for today.

@rslinckx
Copy link

I can't find the code that looks for dependency-groups in dependabot, according to the comment above it seems to have been fixed, but what was fixed is only the parser understanding the toml, not the actual extraction of dependency-groups ?

github-merge-queue bot pushed a commit to meltano/meltano that referenced this issue Mar 14, 2025
<!--

Please, go through these steps when you submit a PR.

1. Make sure your branch is not protected. In particular, avoid making
PRs from the `main` branch of your fork.

2. Give a descriptive title to your PR. We use semantic titles, and the
accepted types and scopes are listed in
https://github.com/meltano/meltano/blob/main/.github/semantic.yml.

   A good title should look like this:

   ```
feat(cli): The `meltano run` command now accepts a `--timeout` option to
limit the time it runs
   ```

3. Provide a description of your changes.

4. Put "Closes #XXXX" in your comment to auto-close the issue that your
PR fixes (if such).

-->

## Description

<!-- Describe the changes introduced by this PR -->

Started with [`uvx
migrate-to-uv`](https://github.com/mkniewallner/migrate-to-uv/) but had
to fix some re-ordering of pyproject sections and removed comments.

GitHub GA announcement:
https://github.blog/changelog/2025-03-13-dependabot-version-updates-now-support-uv-in-general-availability/.

## Related Issues

* Closes #8474
* Closes #9014
* #8938
* dependabot/dependabot-core#10478
* dependabot/dependabot-core#10847
@abdulapopoola
Copy link
Member

abdulapopoola commented Mar 15, 2025

@rslinckx , here is the PR: #11796

@rslinckx
Copy link

As you can see here: https://github.com/dependabot/dependabot-core/blob/main/uv/helpers/lib/parser.py#L58 the only sections that are parsed are dependencies and optional-dependencies. I'm not even sure why the ruby gem toml has any relevance since it's python code reading and parsing the pyproject.toml anyway? (the call site is around here: https://github.com/dependabot/dependabot-core/blob/main/uv/lib/dependabot/uv/file_parser/pyproject_files_parser.rb#L93 )

@MusicalNinjaDad
Copy link

The issue fixed by #11796 was that the updater, which uses rb-toml, errored out as described in this comment

@rslinckx
Copy link

rslinckx commented Apr 9, 2025

Unfortunately the uv ecosystem still doesn't look for the legacy [tool.uv].dev-dependencies or the new [dependency-groups].dev keys, so the UV updater cannot possibly update dev dependencies nor present them as dev dependencies according to dependabot filtering/grouping rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: python T: feature-request Requests for new features
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

9 participants