diff --git a/.github/workflows/codspeed-benchmarks.yaml b/.github/workflows/codspeed-benchmarks.yaml index 93ac7c2fe559..ca16194c9ca7 100644 --- a/.github/workflows/codspeed-benchmarks.yaml +++ b/.github/workflows/codspeed-benchmarks.yaml @@ -37,29 +37,14 @@ jobs: persist-credentials: false fetch-depth: 0 - - name: Set up Docker Buildx - if: ${{ matrix.build-docker-images }} - uses: docker/setup-buildx-action@v3 - with: - driver-opts: image=moby/buildkit:v0.12.5 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 + - name: Set up uv + uses: astral-sh/setup-uv@v5 with: python-version: "3.12" - - - name: UV Cache - uses: actions/cache@v4 - id: cache-uv - with: - path: ~/.cache/uv - key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }} - - - name: Install packages - run: | - python -m pip install -U uv - uv pip install --upgrade --system .[dev] pytest-codspeed - uv pip uninstall --system pytest-benchmark + enable-cache: true + + - name: Install the project + run: uv sync --extra dev --compile-bytecode - name: Start server run: | diff --git a/.github/workflows/python-tests.yaml b/.github/workflows/python-tests.yaml index 4c3f7f26ee36..ab2365986a20 100644 --- a/.github/workflows/python-tests.yaml +++ b/.github/workflows/python-tests.yaml @@ -112,26 +112,14 @@ jobs: persist-credentials: false fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - id: setup_python + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} + enable-cache: true - - name: UV Cache - # Manually cache the uv cache directory - # until setup-python supports it: - # https://github.com/actions/setup-python/issues/822 - uses: actions/cache@v4 - id: cache-uv - with: - path: ~/.cache/uv - key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }} - - - name: Install packages - run: | - python -m pip install -U uv - uv pip install --upgrade --system -e .[dev] + - name: Install the project + run: uv sync --extra dev --compile-bytecode - name: Start database container if: ${{ startsWith(matrix.database, 'postgres') }} @@ -170,7 +158,7 @@ jobs: - name: Run tests run: | - pytest ${{ matrix.test-type.modules }} \ + uv run pytest ${{ matrix.test-type.modules }} \ --numprocesses auto \ --maxprocesses 6 \ --dist worksteal \ @@ -218,21 +206,11 @@ jobs: with: driver-opts: image=moby/buildkit:v0.12.5 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - id: setup_python + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} - - - name: UV Cache - # Manually cache the uv cache directory - # until setup-python supports it: - # https://github.com/actions/setup-python/issues/822 - uses: actions/cache@v4 - id: cache-uv - with: - path: ~/.cache/uv - key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }} + enable-cache: true - name: Get image tag id: get_image_tag @@ -272,10 +250,8 @@ jobs: docker load --input /tmp/image.tar docker run --rm prefecthq/prefect-dev:${{ steps.get_image_tag.outputs.image_tag }} prefect version - - name: Install packages - run: | - python -m pip install -U uv - uv pip install --upgrade --system -e .[dev] + - name: Install the project + run: uv sync --extra dev --compile-bytecode - name: Start database container if: ${{ startsWith(matrix.database, 'postgres') }} @@ -322,8 +298,7 @@ jobs: - name: Run tests run: | - echo "Using COVERAGE_FILE=$COVERAGE_FILE" - pytest tests --ignore=tests/typesafety \ + uv run pytest tests --ignore=tests/typesafety \ --numprocesses auto \ --maxprocesses 6 \ --dist worksteal \ @@ -331,22 +306,6 @@ jobs: --only-service docker \ --durations 26 \ - - name: Create and Upload failure flag - if: ${{ failure() }} - id: create_failure_flag - run: | - sanitized_name="${{ matrix.python-version }}-${{ matrix.database }}" - sanitized_name="${sanitized_name//:/-}" - echo "Failure in $sanitized_name" > "${sanitized_name}-failure.txt" - echo "artifact_name=${sanitized_name}-failure" >> $GITHUB_OUTPUT - - - name: Upload failure flag - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.create_failure_flag.outputs.artifact_name }} - path: "${{ steps.create_failure_flag.outputs.artifact_name }}.txt" - - name: Check database container # Only applicable for Postgres, but we want this to run even when tests fail if: always() @@ -366,28 +325,12 @@ jobs: persist-credentials: false fetch-depth: 0 - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - id: setup_python + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v5 with: - python-version: 3.12 - - - name: UV Cache - # Manually cache the uv cache directory - # until setup-python supports it: - # https://github.com/actions/setup-python/issues/822 - uses: actions/cache@v4 - id: cache-uv - with: - path: ~/.cache/uv - key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }} - - - name: Install packages - run: | - python -m pip install -U uv - uv pip install --upgrade --system -e .[dev] + python-version: "3.12" + enable-cache: true - name: Run tests run: | - pytest tests/typesafety \ - --disable-docker-image-builds + uv run pytest tests/typesafety --disable-docker-image-builds diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index 2c08b587f306..bde69d91d201 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -34,26 +34,14 @@ jobs: persist-credentials: false fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v5 - id: setup_python - with: - python-version: "3.9.18" - - - name: UV Cache - # Manually cache the uv cache directory - # until setup-python supports it: - # https://github.com/actions/setup-python/issues/822 - uses: actions/cache@v4 - id: cache-uv + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v5 with: - path: ~/.cache/uv - key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }} + python-version: "3.9" + enable-cache: true - - name: Install packages - run: | - python -m pip install -U uv pre-commit - uv pip install --upgrade --system -e .[dev] + - name: Install the project + run: uv sync --extra dev --compile-bytecode - name: Setup NodeJS uses: actions/setup-node@v4 @@ -66,7 +54,7 @@ jobs: - name: Run pre-commit run: | - pre-commit run --show-diff-on-failure --color=always --all-files + uv run pre-commit run --show-diff-on-failure --color=always --all-files type-checks: name: Type Checks @@ -82,25 +70,16 @@ jobs: with: python-version: "3.12" enable-cache: true - cache-dependency-glob: "requirements**.txt" + + - name: Install the project + run: uv sync --extra dev --compile-bytecode - name: Run type completeness check run: >- - uv tool run - --with-editable . - --with-requirements requirements-otel.txt - --with-requirements requirements-dev.txt - pyright - --ignoreexternal - --verifytypes prefect + uv run pyright --ignoreexternal --verifytypes prefect - name: Run pyright check run: >- - uv tool run - --with-editable . - --with-requirements requirements-otel.txt - --with-requirements requirements-dev.txt - pyright - -p pyrightconfig-ci.json + uv run pyright -p pyrightconfig-ci.json diff --git a/pyproject.toml b/pyproject.toml index 156514724354..771a28ce9155 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,12 +128,19 @@ dev = [ "mkdocs-material>=9.6.4", "mkdocstrings[python]>=0.28.0", "mkdocs-gen-files>=0.5.0", + # Need to stay in sync with otel extra below + "opentelemetry-distro>=0.48b0,<1.0.0", + "opentelemetry-exporter-otlp>=1.27.0,<2.0.0", + "opentelemetry-instrumentation>=0.48b0,<1.0.0", + "opentelemetry-instrumentation-logging>=0.48b0,<1.0.0", + "opentelemetry-test-utils>=0.48b0,<1.0.0" ] otel = [ "opentelemetry-distro>=0.48b0,<1.0.0", "opentelemetry-exporter-otlp>=1.27.0,<2.0.0", "opentelemetry-instrumentation>=0.48b0,<1.0.0", "opentelemetry-instrumentation-logging>=0.48b0,<1.0.0", + "opentelemetry-test-utils>=0.48b0,<1.0.0" ] # Infrastructure extras aws = ["prefect-aws>=0.5.0"] @@ -239,20 +246,12 @@ ignore_errors = true [tool.hatch.version] source = "vcs" +tag-pattern = "(\\d+\\.\\d+\\.\\d+(?:\\.dev\\d+)?)$" raw-options = { git_describe_command = 'git describe --dirty --tags --long --match "[0-9]*.[0-9]*.[0-9]*"' } [tool.hatch.build.hooks.vcs] version-file = "src/prefect/_version.py" -[tool.vermin] -make_paths_absolute = false -backports = ["typing_extensions"] -format = "parsable" -eval_annotations = true -only_show_violations = true -targets = ["3.9-"] -exclusion_regex = "^src/prefect/_vendor/.*$|^src/prefect/utilities/compat\\.py$|^tests/workers/test_process_worker.py$|^tests/test_background_tasks.py$|^src/integrations/.*/tests/.*$" - [tool.ruff] src = ["src"] extend-select = ["I"] @@ -268,7 +267,6 @@ extend-select = ["I"] [tool.ruff.isort] known-third-party = [] - [tool.uv.sources] prefect-aws = { path = "src/integrations/prefect-aws" } prefect-azure = { path = "src/integrations/prefect-azure" }