From fb908568e2de88aa52871ff1fa6f2502ed504623 Mon Sep 17 00:00:00 2001 From: Kevin Deldycke Date: Thu, 18 Jul 2024 10:49:13 +0400 Subject: [PATCH] Do not print progress bars on uv calls --- .github/workflows/autofix.yaml | 26 +++++++++++------------ .github/workflows/changelog.yaml | 28 ++++++++++++------------- .github/workflows/docs.yaml | 36 ++++++++++++++++---------------- .github/workflows/lint.yaml | 16 +++++++------- .github/workflows/release.yaml | 24 ++++++++++----------- .github/workflows/tests.yaml | 14 ++++++------- changelog.md | 2 ++ gha_utils/metadata.py | 5 +++-- requirements/uv.txt | 2 +- 9 files changed, 78 insertions(+), 75 deletions(-) diff --git a/.github/workflows/autofix.yaml b/.github/workflows/autofix.yaml index 6a153db4b..245fa7714 100644 --- a/.github/workflows/autofix.yaml +++ b/.github/workflows/autofix.yaml @@ -91,14 +91,14 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install gha-utils run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt - name: Project metadata id: project-metadata env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: | - uv run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" + uv --no-progress run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" format-python: name: Format Python @@ -145,8 +145,8 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install Ruff, blacken-docs and autopep8 run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/format-python.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/format-python.txt - name: Run autopep8 if: needs.project-metadata.outputs.python_files # Ruff is not wrapping comments: https://github.com/astral-sh/ruff/issues/7414 @@ -155,7 +155,7 @@ jobs: # - --aggressive is requires to force autopep8 to consider comments. # Explicit list of files is provided, as autopep8 is not able to handle find files in ".github" subdirectory. run: > - uv tool run autopep8 --recursive --in-place --max-line-length 88 --select E501 --aggressive + uv --no-progress tool run autopep8 --recursive --in-place --max-line-length 88 --select E501 --aggressive ${{ needs.project-metadata.outputs.python_files }} - name: Optional Ruff config if: needs.project-metadata.outputs.ruff_py_version @@ -212,12 +212,12 @@ jobs: cat ./ruff.toml - name: Run Ruff check run: | - uv tool run ruff check --config ./ruff.toml + uv --no-progress tool run ruff check --config ./ruff.toml - name: Run Ruff format # XXX: Ruff is planning to support linting and formatting in one unified command at one point. # See: https://github.com/astral-sh/ruff/issues/8232 run: | - uv tool run ruff format --config ./ruff.toml + uv --no-progress tool run ruff format --config ./ruff.toml - name: Remove temporary Ruff config run: | rm ./ruff.toml @@ -231,7 +231,7 @@ jobs: # TODO: replace blacken-docs by ruff. See: https://github.com/astral-sh/ruff/issues/8237 # https://github.com/astral-sh/ruff/issues/3792 run: > - uv tool run blacken-docs + uv --no-progress tool run blacken-docs --line-length 88 ${{ needs.project-metadata.outputs.blacken_docs_params }} ${{ needs.project-metadata.outputs.doc_files }} @@ -282,7 +282,7 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Sync uv.lock run: | - uv sync --upgrade + uv --no-progress sync --upgrade - uses: peter-evans/create-pull-request@v6.1.0 with: assignees: ${{ github.actor }} @@ -347,14 +347,14 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install mdformat run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/mdformat.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/mdformat.txt - name: Install shfmt run: | sudo apt install --yes shfmt - name: Auto-format Markdown run: | - find ./ -iname "*.md" -exec uv tool run mdformat "{}" \; + find ./ -iname "*.md" -exec uv --no-progress tool run mdformat "{}" \; - name: Markdown fixes for Awesome Lists if: startsWith(github.event.repository.name, 'awesome-') # Remove forbidden TOC entries diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml index 414bfa5ec..ceae73f33 100644 --- a/.github/workflows/changelog.yaml +++ b/.github/workflows/changelog.yaml @@ -46,17 +46,17 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install bump-my-version run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt - name: ${{ matrix.part }} version bump # TODO: get configuration URL once https://github.com/callowayproject/bump-my-version/issues/148 is addressed, # so we can factorize projects' pyproject.toml files to kdeldycke/workflow/pyproject.toml . run: | - uv tool run bump-my-version bump --verbose ${{ matrix.part }} + uv --no-progress tool run bump-my-version bump --verbose ${{ matrix.part }} - name: Extract version id: get_version run: | - echo "new_version=$( uv tool run bump-my-version show current_version )" >> "$GITHUB_OUTPUT" + echo "new_version=$( uv --no-progress tool run bump-my-version show current_version )" >> "$GITHUB_OUTPUT" - name: Print version run: | echo "New version: ${{ steps.get_version.outputs.new_version }}" @@ -128,12 +128,12 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install bump-my-version and gha-utils run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt - name: Extract version id: get_version run: | - echo "current_version=$( uv tool run bump-my-version show current_version )" >> "$GITHUB_OUTPUT" + echo "current_version=$( uv --no-progress tool run bump-my-version show current_version )" >> "$GITHUB_OUTPUT" - name: Print version run: | echo "Current version: ${{ steps.get_version.outputs.current_version }}" @@ -145,19 +145,19 @@ jobs: # TOML. run: > RELEASE_DEFAULT_BRANCH="main" && - uv tool run bump-my-version replace --no-configured-files --ignore-missing-version + uv --no-progress tool run bump-my-version replace --no-configured-files --ignore-missing-version --search "/workflows/$RELEASE_DEFAULT_BRANCH/" --replace "/workflows/v{current_version}/" ./.github/workflows/*.yaml - name: Set release date in changelog run: > - uv tool run bump-my-version replace --no-configured-files + uv --no-progress tool run bump-my-version replace --no-configured-files --search " (unreleased)" --replace " ({utcnow:%Y-%m-%d})" ./changelog.md - name: Update comparison URL in changelog run: > - uv tool run bump-my-version replace --no-configured-files + uv --no-progress tool run bump-my-version replace --no-configured-files --search "...main" --replace "...v{current_version}" ./changelog.md @@ -166,7 +166,7 @@ jobs: # > \[!IMPORTANT\] # > ... run: > - uv tool run bump-my-version replace --no-configured-files --ignore-missing-version + uv --no-progress tool run bump-my-version replace --no-configured-files --ignore-missing-version --regex --search "^> \\\.\!IMPORTANT\\\..+?\\n\\n" --replace "" ./changelog.md @@ -188,18 +188,18 @@ jobs: # TOML. run: > RELEASE_DEFAULT_BRANCH="main" && - uv tool run bump-my-version replace --no-configured-files --ignore-missing-version + uv --no-progress tool run bump-my-version replace --no-configured-files --ignore-missing-version --search "/workflows/v{current_version}/" --replace "/workflows/$RELEASE_DEFAULT_BRANCH/" ./.github/workflows/*.yaml - name: Add new changelog entry run: | - uv run gha-utils --verbosity DEBUG changelog ./changelog.md + uv --no-progress run gha-utils --verbosity DEBUG changelog ./changelog.md - name: Version bump # TODO: get configuration URL once https://github.com/callowayproject/bump-my-version/issues/148 is addressed, # so we can factorize projects' pyproject.toml files to kdeldycke/workflow/pyproject.toml . run: | - uv tool run bump-my-version bump --verbose patch + uv --no-progress tool run bump-my-version bump --verbose patch - name: Reset uv.lock # Exclude `uv.lock` file which might be auto-updated by calls to `uv run`. # See: https://github.com/peter-evans/create-pull-request#controlling-committed-files diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index cf8077865..dc3a418e6 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -110,11 +110,11 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install gha-utils run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt - name: Generate .mailmap run: | - uv run gha-utils --verbosity DEBUG mailmap-sync --skip-if-missing ./.mailmap + uv --no-progress run gha-utils --verbosity DEBUG mailmap-sync --skip-if-missing ./.mailmap - name: Reset uv.lock # Exclude `uv.lock` file which might be auto-updated by calls to `uv run`. # See: https://github.com/peter-evans/create-pull-request#controlling-committed-files @@ -194,14 +194,14 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install gha-utils run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt - name: Project metadata id: project-metadata env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: | - uv run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" + uv --no-progress run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" update-deps-graph: name: Update dependency graph @@ -224,19 +224,19 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install pipdeptree run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/pipdeptree.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/pipdeptree.txt - name: Install project run: | - uv pip install . + uv --no-progress pip install . - name: Run uv for debug # TODO: switch from pipdeptree to uv. # See: https://github.com/astral-sh/uv/issues/4439#issuecomment-2183911185 run: | - uv pip tree + uv --no-progress pip tree - name: Run pipdeptree for debug run: > - uv run pipdeptree ${{ needs.project-metadata.outputs.package_name + uv --no-progress run pipdeptree ${{ needs.project-metadata.outputs.package_name && format('--packages {0}', needs.project-metadata.outputs.package_name)}} - name: Create dir structure run: | @@ -245,7 +245,7 @@ jobs: # See: https://github.com/tox-dev/pipdeptree/issues/107 - name: Generate graph run: > - uv run pipdeptree ${{ needs.project-metadata.outputs.package_name + uv --no-progress run pipdeptree ${{ needs.project-metadata.outputs.package_name && format('--packages {0}', needs.project-metadata.outputs.package_name)}} --mermaid > ${{ env.dependency-graph-output }} - name: Reset uv.lock @@ -294,11 +294,11 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install project dependencies run: | - uv venv --system - uv pip install --extra docs --requirement ./pyproject.toml + uv --no-progress venv --system + uv --no-progress pip install --extra docs --requirement ./pyproject.toml - name: Run Sphinx run: | - uv run sphinx-apidoc --no-toc --module-first --force -o ./docs . + uv --no-progress run sphinx-apidoc --no-toc --module-first --force -o ./docs . - name: Reset uv.lock # Exclude `uv.lock` file which might be auto-updated by calls to `uv run`. # See: https://github.com/peter-evans/create-pull-request#controlling-committed-files @@ -343,8 +343,8 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install project dependencies run: | - uv venv --system - uv pip install --all-extras --requirement ./pyproject.toml + uv --no-progress venv --system + uv --no-progress pip install --all-extras --requirement ./pyproject.toml - name: Install Graphviz # So we can use the sphinx.ext.graphviz plugin. # See: https://www.sphinx-doc.org/en/master/usage/extensions/graphviz.html @@ -353,7 +353,7 @@ jobs: sudo apt install --yes graphviz - name: Build documentation run: | - uv run sphinx-build -b html ./docs ./docs/html + uv --no-progress run sphinx-build -b html ./docs ./docs/html - name: Deploy uses: peaceiris/actions-gh-pages@v4.0.0 with: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a4272d2bf..5d7d29fad 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -71,14 +71,14 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install gha-utils run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt - name: Project metadata id: project-metadata env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: | - uv run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" + uv --no-progress run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" mypy-lint: needs: @@ -101,15 +101,15 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install Mypy run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/mypy.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/mypy.txt - name: Install package from all requirement files run: | - uv pip install --all-extras ${{ needs.project-metadata.outputs.uv_requirement_params }} + uv --no-progress pip install --all-extras ${{ needs.project-metadata.outputs.uv_requirement_params }} - name: Run Mypy # --color-output - Force colorized output as in CI, Mypy defaults to no color in CI. run: > - uv run mypy --color-output ${{ needs.project-metadata.outputs.mypy_params }} + uv --no-progress run mypy --color-output ${{ needs.project-metadata.outputs.mypy_params }} ${{ needs.project-metadata.outputs.python_files }} lint-yaml: @@ -163,7 +163,7 @@ jobs: uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/yamllint.txt - name: Run yamllint run: | - uv tool run yamllint --strict --config-data "{rules: {line-length: {max: 120}}}" --format github . + uv --no-progress tool run yamllint --strict --config-data "{rules: {line-length: {max: 120}}}" --format github . lint-zsh: runs-on: ubuntu-22.04 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b6a20f3ec..883bf025a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -61,14 +61,14 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install gha-utils run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/gha-utils.txt - name: Project metadata id: project-metadata env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: | - uv run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" + uv --no-progress run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" package-build: name: "build & check package" @@ -95,11 +95,11 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install build dependencies run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/build.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/build.txt - name: Build package run: | - uv run python -m build + uv --no-progress run python -m build - name: Upload artifacts uses: actions/upload-artifact@v4.3.4 with: @@ -107,8 +107,8 @@ jobs: path: ./dist/* - name: Validates package metadata run: | - uv tool run twine check ./dist/* - uv tool run check-wheel-contents ./dist/*.whl + uv --no-progress tool run twine check ./dist/* + uv --no-progress tool run check-wheel-contents ./dist/*.whl compile-binaries: name: "Nuitka: generate binaries" @@ -135,14 +135,14 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install Nuitka run: | - uv venv --system - uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/nuitka.txt + uv --no-progress venv --system + uv --no-progress pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/nuitka.txt - name: Nuitka + compilers versions run: | - uv run python ${{ matrix.extra_python_params }} -m nuitka --version + uv --no-progress run python ${{ matrix.extra_python_params }} -m nuitka --version - name: Build binary run: > - uv run python ${{ matrix.extra_python_params }} -m nuitka + uv --no-progress run python ${{ matrix.extra_python_params }} -m nuitka --onefile --assume-yes-for-downloads --output-filename=${{ matrix.bin_name }} ${{ matrix.module_path }} - name: Upload binaries diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e89da2e34..cfca15456 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -123,22 +123,22 @@ jobs: python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt - name: Install project run: | - uv venv --system - uv pip install . + uv --no-progress venv --system + uv --no-progress pip install . # CLI tests. - name: gha-utils --help run: | - uv run gha-utils --help + uv --no-progress run gha-utils --help - name: gha-utils --verbosity DEBUG --version run: | - uv run gha-utils --verbosity DEBUG --version + uv --no-progress run gha-utils --verbosity DEBUG --version - name: gha-utils --verbosity INFO metadata run: | - uv run gha-utils --verbosity INFO metadata + uv --no-progress run gha-utils --verbosity INFO metadata - name: gha-utils --verbosity INFO changelog run: | - uv run gha-utils --verbosity INFO changelog + uv --no-progress run gha-utils --verbosity INFO changelog - name: gha-utils --verbosity INFO mailmap-sync run: | - uv run gha-utils --verbosity INFO mailmap-sync \ No newline at end of file + uv --no-progress run gha-utils --verbosity INFO mailmap-sync \ No newline at end of file diff --git a/changelog.md b/changelog.md index 2289555d0..8df4958a0 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,8 @@ > \[!IMPORTANT\] > This version is not released yet and is under active development. +- Do not print progress bars on `uv` calls. + ## [4.3.0 (2024-07-17)](https://github.com/kdeldycke/workflows/compare/v4.2.1...v4.3.0) - Add a new job to keep `uv.lock` updated and in sync. diff --git a/gha_utils/metadata.py b/gha_utils/metadata.py index 32d4544f1..1dd00db65 100644 --- a/gha_utils/metadata.py +++ b/gha_utils/metadata.py @@ -267,10 +267,11 @@ def github_context(self) -> dict[str, Any]: env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: | - uv run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" + uv --no-progress run gha-utils --verbosity DEBUG metadata --overwrite "$GITHUB_OUTPUT" .. todo:: - Try to remove reliance on GitHub context entirely so we can eliminate the JSON/env hack above. + Try to remove reliance on GitHub context entirely so we can eliminate the + JSON/env hack above. """ if "GITHUB_CONTEXT" not in os.environ: if self.in_ci_env: diff --git a/requirements/uv.txt b/requirements/uv.txt index a6b418443..66634dd54 100644 --- a/requirements/uv.txt +++ b/requirements/uv.txt @@ -1 +1 @@ -uv == 0.2.25 +uv == 0.2.26