Enable dependencies from `dependency-groups`
Currently, the docs group should be under project.optional-dependencies, but that gets also shipped to the end user. Package managers like uv add the groups under dependency-groups.
It seems like the following PR enables specifying dependency-groups needed to be installed: https://github.com/pypa/pip/issues/12963
I am not sure if it is already available, but I would keep an eye on it :)
| Feature | project.optional-dependencies | dependency-groups |
|---|---|---|
| Scope | Published | Local |
| Purpose | Optional features for users | Dev/internal tools |
| Installation | pip install package[extra] | Not for end users |
| Core Functionality | Enhances, not required | Not part of package |
That sounds good, thanks for you information, I wonder if this change is shipped in the latest pip?
That sounds good, thanks for you information, I wonder if this change is shipped in the latest pip?
I am unsure since I mostly use uv to manage my dependencies.
But for now, I found a temporary solution for this use case:
jobs:
docs:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- name: Setup | Checkout repository
uses: actions/checkout@v4
- name: Setup | Install uv
uses: astral-sh/setup-uv@v4
- name: Setup | Export requirements
run: uv export --no-hashes --only-group docs > ./docs/requirements.txt
- id: deployment
uses: sphinx-notes/pages@v3
with:
checkout: false
P.S. uv follows PEP, so they don't implement their own needed sections in pyproject.toml, like it is done by poetry -> it can be used for projects that are not managed with uv.