[Python] Error with parsing a .toml - expected operator is the same as what is already written

Discussão em 'Python' iniciado por Stack, Agosto 8, 2025.

  1. Stack

    Stack Membro Participativo

    I am using readthedocs to create automatically updating documentation for a project in a GitHub repo and have been asked to use uv in the .readthedocs.yaml file instead of pip for installations as that is what the rest of the project will be using. However, whenever I try to build the page I get an error to do with parsing my pyproject.toml file and it tells me that the expected operator is sphinx which is already in the pyproject file.

    I've tried everything in my very limited understanding of how this works including removing the "" around sphinx and changing the format of the file but it still gives alternate versions of this error:

    error: Failed to parse: `pyproject.toml`
    Caused by: TOML parse error at line 6, column 9
    |
    6 | docs = ["sphinx"]
    | ^^^^^^^^
    Failed to parse version: Unexpected end of version specifier, expected operator:
    sphinx


    This is the pyproject.toml file:


    [build-system]
    requires = ["flit_core >=3.2,<4"]
    build-backend = "flit_core.buildapi"

    [tool.uv.dependency-groups]
    docs = ["sphinx"]

    [project]
    name = "testProject"
    authors = [{name = "Me", email = "Me@real.email"}]
    dynamic = ["version", "description"]


    and this is the .readthedocs.yaml file:


    version: 2

    build:
    os: "ubuntu-24.04"
    tools:
    python: "3.12"
    jobs:
    create_environment:
    - asdf plugin add uv
    - asdf install uv latest
    - asdf global uv latest
    - UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv venv
    - UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv pip install sphinx
    - UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --group docs
    install:
    - "true"

    sphinx:
    configuration: docs/conf.py

    formats: all


    Edit using suggestions from phd:

    getting this error for the bottom syntax, since I'm trying to use sphinx:

    error: Project `testproject` has malformed dependency groups
    Caused by: Failed to find group `docs` specified in `[tool.uv.dependency-groups]`

    Continue reading...

Compartilhe esta Página