[Python] How to import nested modules with uv

Discussão em 'Python' iniciado por Stack, Maio 9, 2025.

  1. Stack

    Stack Membro Participativo

    I am managing a project with uv. My project includes

    - src
    - app.py
    - constants.py
    - notebooks
    - testing.ipynb
    - pyproject.toml


    where my pyproject.toml file is

    [project]
    name = "benchmark-extractor"
    version = "0.1.0"
    description = "Add your description here"
    readme = "README.md"
    requires-python = ">=3.13"
    dependencies = [
    "anthropic>=0.42.0",
    "ipykernel>=6.29.5",
    "markitdown>=0.0.1a3",
    "pandera>=0.22.1",
    "tabula-py>=2.10.0",
    ]


    I want to import files app.py and constants.py into notebooks/testing.ipynb, for experimentation purposes. When I do this naively, e.g., import src.app, I get a "ModuleNotFoundError".

    I believe I could approach this using uv pip install -e . (e.g., Sibling package imports), but when I try that, I get


    ERROR: Package 'benchmark-extractor' requires a different Python: 3.11.3 not in '>=3.13'
    ​

    Continue reading...

Compartilhe esta Página