1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] uv sync does not install dependencies into venv in GitHub Actions workflow

Discussão em 'Python' iniciado por Stack, Setembro 23, 2024.

  1. Stack

    Stack Membro Participativo

    In a GitHub Actions workflow I use uv sync to install the dependencies of a Python project:

    steps:
    - name: checkout source code
    uses: actions/checkout@v4
    - name: Set up Python ${{ matrix.python-version }}
    uses: actions/setup-python@v5
    with:
    python-version: ${{ matrix.python-version }}
    - name: Install uv
    uses: yezz123/setup-uv@v4
    with:
    uv-venv: ".venv"
    - name: Install dependencies
    run: uv sync

    - name: Ruff check
    run: uv run ruff check src tests


    However, this gives me the following error:

    [​IMG]

    If I run uv sync on my laptop, it works fine and it installs ruff and other development dependencies. Why does it not work in GitHub Actions?

    Here is my pyproject.toml file:

    [project]
    name = "pyml-regression-example1"
    version = "0.1.0"
    description = "Python Machine Learning Regression Example: Life Expectancy"
    readme = "README.md"
    requires-python = ">=3.11"
    dependencies = [
    "click>=8.1.7",
    "colorama>=0.4.6",
    "matplotlib>=3.9.2",
    "numpy>=2.1.1",
    "platformdirs>=4.3.6",
    "scikit-learn>=1.5.2",
    "sphinx-autodoc-typehints>=2.0.0",
    "sphinx-click-rst-to-ansi-formatter>=0.1.1",
    ]
    packages = [{include = "life_expectancy", from = "src"}]

    [project.scripts]
    life-expectancy = "life_expectancy.main:main"

    [build-system]
    requires = ["hatchling"]
    build-backend = "hatchling.build"

    [tool.hatch.build.targets.wheel]
    packages = ["src/life_expectancy"]

    [tool.uv]
    dev-dependencies = [
    "coverage>=7.6.1",
    "mypy>=1.11.2",
    "pytest-mock>=3.14.0",
    "pytest>=8.3.3",
    "ruff>=0.6.6",
    "sphinx-rtd-theme>=2.0.0",
    "sphinx>=7.0.0",
    "sphinx-click>=6.0.0",
    "types-click>=7.1.8",
    "types-colorama>=0.4.15.20240311",
    "pre-commit>=3.8.0",
    "rstcheck>=6.2.4",
    "tox>=4.20.0",
    "types-requests>=2.32.0.20240914",
    ]

    [tool.coverage.report]
    fail_under = 100

    Continue reading...

Compartilhe esta Página