From a0d3dad5452d4724a0e8750baa181198c173a75e Mon Sep 17 00:00:00 2001 From: Vlad Emelianov Date: Mon, 9 Dec 2024 05:44:36 +0300 Subject: [PATCH] Build packages in isolated environment for release (#330) * Convert release to uv script * Revert --no-project * Isolate publish build scripts * Update to astral-sh/setup-uv@v4 * Rework uv cache * Use actions/setup-python for prereleases * Build docs in isolated uv script * Remove docs from git * Use uvx for building packages * Add debug to full package builds * Fix all isolated builds --with * Try sparce checkout * Use actions/setup-python * Update all CI scripts * Revert matrix changes * Rename publish jobs --- .github/workflows/aio_integration.yml | 5 +- .github/workflows/aio_sanity_check.yml | 2 +- .github/workflows/integration.yml | 4 +- .github/workflows/integration_build.yml | 2 +- .github/workflows/integration_full.yml | 2 +- .github/workflows/on_push.yml | 7 +- .github/workflows/on_push_coverage.yml | 2 +- .github/workflows/on_release.yml | 10 +-- .github/workflows/on_release_docs.yml | 9 +-- .../workflows/publish_aiobotocore_full.yml | 53 ++++--------- .../workflows/publish_aiobotocore_stubs.yml | 50 ++++-------- .github/workflows/publish_boto3_full.yml | 71 +++++------------ .github/workflows/publish_boto3_stubs.yml | 78 ++++++------------- .github/workflows/publish_types_aioboto3.yml | 47 ++++------- .github/workflows/publish_types_boto3.yml | 76 ++++++------------ .../workflows/publish_types_boto3_full.yml | 69 ++++------------ .github/workflows/sanity_check.yml | 2 +- scripts/release.py | 9 +++ 18 files changed, 155 insertions(+), 343 deletions(-) diff --git a/.github/workflows/aio_integration.yml b/.github/workflows/aio_integration.yml index a533fa89..39e76997 100644 --- a/.github/workflows/aio_integration.yml +++ b/.github/workflows/aio_integration.yml @@ -16,7 +16,7 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Install the project @@ -60,9 +60,8 @@ jobs: with: python-version: ${{ matrix.version }} allow-prereleases: true - cache: "pip" - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Check output diff --git a/.github/workflows/aio_sanity_check.yml b/.github/workflows/aio_sanity_check.yml index 13124190..afbb0f6e 100644 --- a/.github/workflows/aio_sanity_check.yml +++ b/.github/workflows/aio_sanity_check.yml @@ -51,7 +51,7 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Install the project diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 06891e06..c9accfb7 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -16,7 +16,7 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Install the project @@ -59,7 +59,7 @@ jobs: python-version: ${{ matrix.version }} allow-prereleases: true - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Check output diff --git a/.github/workflows/integration_build.yml b/.github/workflows/integration_build.yml index db94a5fe..b7e8391b 100644 --- a/.github/workflows/integration_build.yml +++ b/.github/workflows/integration_build.yml @@ -16,7 +16,7 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: types-boto3 build diff --git a/.github/workflows/integration_full.yml b/.github/workflows/integration_full.yml index 86c62a3b..6459fd91 100644 --- a/.github/workflows/integration_full.yml +++ b/.github/workflows/integration_full.yml @@ -16,7 +16,7 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: types-boto3-full integration tests diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index ec3bdb2c..03553747 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -8,8 +8,6 @@ jobs: unit-tests: name: Code style & unit tests runs-on: ubuntu-latest - env: - UV_CACHE_DIR: /tmp/.uv-cache strategy: matrix: version: @@ -21,12 +19,13 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "${{ matrix.version }}" + python-version: ${{ matrix.version }} allow-prereleases: true - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" + enable-cache: true - name: Install the project run: uv sync --extra check --dev - name: Install extra dependencies diff --git a/.github/workflows/on_push_coverage.yml b/.github/workflows/on_push_coverage.yml index 6e5bb75f..fb55c78e 100644 --- a/.github/workflows/on_push_coverage.yml +++ b/.github/workflows/on_push_coverage.yml @@ -20,7 +20,7 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Install the project diff --git a/.github/workflows/on_release.yml b/.github/workflows/on_release.yml index 5afd46e1..ac894582 100644 --- a/.github/workflows/on_release.yml +++ b/.github/workflows/on_release.yml @@ -16,10 +16,6 @@ jobs: - uses: actions/checkout@v4 with: ref: main - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version-file: .python-version - name: Get version id: version uses: actions/github-script@v7 @@ -30,8 +26,12 @@ jobs: return context.payload.inputs.version } return context.ref.split('/').pop() + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Install the project diff --git a/.github/workflows/on_release_docs.yml b/.github/workflows/on_release_docs.yml index 9d4d950d..3cede2a6 100644 --- a/.github/workflows/on_release_docs.yml +++ b/.github/workflows/on_release_docs.yml @@ -44,18 +44,13 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - - name: Install the project - run: uv sync --dev - - name: Install handsdown - run: | - uv run pip install -r requirements.mkdocs.txt - name: Build docs run: | rm -rf docs/* - uv run mkdocs build + uvx --with-requirements requirements.mkdocs.txt mkdocs build - name: Checkout gh-pages branch uses: actions/checkout@v4 with: diff --git a/.github/workflows/publish_aiobotocore_full.yml b/.github/workflows/publish_aiobotocore_full.yml index 14c7461f..87294e69 100644 --- a/.github/workflows/publish_aiobotocore_full.yml +++ b/.github/workflows/publish_aiobotocore_full.yml @@ -1,5 +1,5 @@ name: Publish types-aiobotocore-full -concurrency: update_types_aiobotocore_full +concurrency: publish_types_aiobotocore_full on: schedule: @@ -31,7 +31,6 @@ jobs: runs-on: ubuntu-latest outputs: aiobotocore: ${{ steps.aiobotocore.outputs.result }} - aiobotocore-url: ${{ steps.aiobotocore-url.outputs.result }} version: ${{ steps.version.outputs.result }} extra-flags: ${{ steps.extra-flags.outputs.result }} steps: @@ -100,63 +99,45 @@ jobs: core.notice(`Extra flags = ${extraFlags}`) return extraFlags.join(' ') - - name: Aiobotocore download URL - id: aiobotocore-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - const url = await getDownloadURL('aiobotocore', "${{ steps.aiobotocore.outputs.result }}") - core.notice(`aiobotocore download URL ${url}`) - return url - publish-types-aiobotocore: - name: Publish types-aiobotocore + publish: + name: Publish types-aiobotocore-full runs-on: ubuntu-latest needs: versions if: needs.versions.outputs.version steps: - uses: actions/checkout@v4 + with: + sparse-checkout: | + scripts/release.py + .python-version - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: .python-version - - name: Install builder - run: | - rm -rf mypy_boto3_builder - python -m pip install mypy_boto3_builder - - name: Install aiobotocore - run: | - mkdir installtemp - cd installtemp - wget ${{ needs.versions.outputs.aiobotocore-url }} - pip uninstall -y s3transfer - pip install aiobotocore*.whl s3transfer - cd .. - rm -rf installtemp + - name: Set up uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" - name: Build env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + AIOBOTOCORE_VERSION: ${{ needs.versions.outputs.aiobotocore }} run: | rm -rf mypy_boto3_output/* - - echo "Building" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --no-cache \ + --with aiobotocore==${AIOBOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product aiobotocore-full \ ${EXTRA_FLAGS} \ --download-static-stubs \ -s all -d - - name: Install dependencies for publishing - run: | - python -m pip install setuptools wheel twine - name: Publish to PyPI env: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python ./scripts/release.py + uv run --no-project ./scripts/release.py diff --git a/.github/workflows/publish_aiobotocore_stubs.yml b/.github/workflows/publish_aiobotocore_stubs.yml index 128b81c1..96952840 100644 --- a/.github/workflows/publish_aiobotocore_stubs.yml +++ b/.github/workflows/publish_aiobotocore_stubs.yml @@ -1,5 +1,5 @@ name: Publish types-aiobotocore -concurrency: update_types_aiobotocore +concurrency: publish_types_aiobotocore on: schedule: @@ -36,7 +36,6 @@ jobs: runs-on: ubuntu-latest outputs: aiobotocore: ${{ steps.aiobotocore.outputs.result }} - aiobotocore-url: ${{ steps.aiobotocore-url.outputs.result }} version: ${{ steps.version.outputs.result }} extra-flags: ${{ steps.extra-flags.outputs.result }} steps: @@ -107,63 +106,44 @@ jobs: core.notice(`Extra flags = ${extraFlags}`) return extraFlags.join(' ') - - name: Aiobotocore download URL - id: aiobotocore-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - const url = await getDownloadURL('aiobotocore', "${{ steps.aiobotocore.outputs.result }}") - core.notice(`aiobotocore download URL ${url}`) - return url - publish-types-aiobotocore: + publish: name: Publish types-aiobotocore runs-on: ubuntu-latest needs: versions if: needs.versions.outputs.version steps: - uses: actions/checkout@v4 + with: + sparse-checkout: | + scripts/release.py + .python-version - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: .python-version - - name: Install builder - run: | - rm -rf mypy_boto3_builder - python -m pip install mypy_boto3_builder - - name: Install aiobotocore - run: | - mkdir installtemp - cd installtemp - wget ${{ needs.versions.outputs.aiobotocore-url }} - pip uninstall -y s3transfer - pip install aiobotocore*.whl s3transfer - cd .. - rm -rf installtemp + - name: Set up uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" - name: Build all packages env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + AIOBOTOCORE_VERSION: ${{ needs.versions.outputs.aiobotocore }} run: | rm -rf mypy_boto3_output/* - - echo "Building all packages" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --with aiobotocore==${AIOBOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product aiobotocore aiobotocore-lite aiobotocore-services \ ${EXTRA_FLAGS} \ --download-static-stubs \ -s all -d - - name: Install dependencies for publishing - run: | - python -m pip install setuptools wheel twine - name: Publish to PyPI env: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python ./scripts/release.py + uv run --no-project ./scripts/release.py diff --git a/.github/workflows/publish_boto3_full.yml b/.github/workflows/publish_boto3_full.yml index 3cd920bc..af5adbee 100644 --- a/.github/workflows/publish_boto3_full.yml +++ b/.github/workflows/publish_boto3_full.yml @@ -1,5 +1,5 @@ name: Publish boto3-stubs-full -concurrency: update_boto3_stubs_full +concurrency: publish_boto3_stubs_full on: schedule: @@ -33,8 +33,6 @@ jobs: outputs: boto3: ${{ steps.boto3.outputs.result }} botocore: ${{ steps.botocore.outputs.result }} - boto3-url: ${{ steps.boto3-url.outputs.result }} - botocore-url: ${{ steps.botocore-url.outputs.result }} version: ${{ steps.version.outputs.result }} extra-flags: ${{ steps.extra-flags.outputs.result }} steps: @@ -115,79 +113,46 @@ jobs: core.notice(`Extra flags = ${extraFlags}`) return extraFlags.join(' ') - - name: Boto3 download URL - id: boto3-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - - const url = await getDownloadURL('boto3', "${{ steps.boto3.outputs.result }}") - core.notice(`boto3 download URL ${url}`) - return url - - name: Botocore download URL - id: botocore-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - const url = await getDownloadURL('botocore', "${{ steps.botocore.outputs.result }}") - core.notice(`botocore download URL ${url}`) - return url - - publish-boto3-stubs: - name: Publish boto3-stubs + publish: + name: Publish boto3-stubs-full runs-on: ubuntu-latest needs: versions if: needs.versions.outputs.version steps: - uses: actions/checkout@v4 + with: + sparse-checkout: | + scripts/release.py + .python-version - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: .python-version - - name: Install boto3 - run: | - mkdir installtemp - cd installtemp - wget ${{ needs.versions.outputs.boto3-url }} - wget ${{ needs.versions.outputs.botocore-url }} - pip uninstall -y s3transfer - pip install botocore*.whl - pip install boto3*.whl - cd .. - rm -rf installtemp - - name: Install builder - run: | - rm -rf mypy_boto3_builder - python -m pip install mypy_boto3_builder + - name: Set up uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" - name: Build env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + BOTO3_VERSION: ${{ needs.versions.outputs.boto3 }} + BOTOCORE_VERSION: ${{ needs.versions.outputs.botocore }} run: | rm -rf mypy_boto3_output/* - - echo "Building" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --with boto3==${BOTO3_VERSION} \ + --with botocore==${BOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product boto3-full \ ${EXTRA_FLAGS} \ --download-static-stubs \ -s all - - name: Install dependencies for publishing - run: | - python -m pip install setuptools wheel twine - name: Publish to PyPI env: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python ./scripts/release.py + uv run --no-project ./scripts/release.py diff --git a/.github/workflows/publish_boto3_stubs.yml b/.github/workflows/publish_boto3_stubs.yml index 28c04d6c..98f41cca 100644 --- a/.github/workflows/publish_boto3_stubs.yml +++ b/.github/workflows/publish_boto3_stubs.yml @@ -43,8 +43,6 @@ jobs: outputs: boto3: ${{ steps.boto3.outputs.result }} botocore: ${{ steps.botocore.outputs.result }} - boto3-url: ${{ steps.boto3-url.outputs.result }} - botocore-url: ${{ steps.botocore-url.outputs.result }} version: ${{ steps.version.outputs.result }} build-all: ${{ steps.build-all.outputs.result }} extra-flags: ${{ steps.extra-flags.outputs.result }} @@ -148,69 +146,39 @@ jobs: core.notice(`Extra flags = ${extraFlags}`) return extraFlags.join(' ') - - name: Boto3 download URL - id: boto3-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - - const url = await getDownloadURL('boto3', "${{ steps.boto3.outputs.result }}") - core.notice(`boto3 download URL ${url}`) - return url - - name: Botocore download URL - id: botocore-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - - const url = await getDownloadURL('botocore', "${{ steps.botocore.outputs.result }}") - core.notice(`botocore download URL ${url}`) - return url - publish-boto3-stubs: + publish: name: Publish boto3-stubs runs-on: ubuntu-latest needs: versions if: needs.versions.outputs.version steps: - uses: actions/checkout@v4 + with: + sparse-checkout: | + scripts/release.py + .python-version - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: .python-version - - name: Install boto3 - run: | - mkdir installtemp - cd installtemp - wget ${{ needs.versions.outputs.boto3-url }} - wget ${{ needs.versions.outputs.botocore-url }} - pip uninstall -y s3transfer - pip install botocore*.whl - pip install boto3*.whl - cd .. - rm -rf installtemp - - name: Install builder - run: | - rm -rf mypy_boto3_builder - python -m pip install mypy_boto3_builder + - name: Set up uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" - name: Build updated packages only if: needs.versions.outputs.build-all == 'false' env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + BOTO3_VERSION: ${{ needs.versions.outputs.boto3 }} + BOTOCORE_VERSION: ${{ needs.versions.outputs.botocore }} run: | rm -rf mypy_boto3_output/* - - echo "Building updated packages" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --with boto3==${BOTO3_VERSION} \ + --with botocore==${BOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product boto3 boto3-services \ ${EXTRA_FLAGS} \ @@ -221,22 +189,22 @@ jobs: env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + BOTO3_VERSION: ${{ needs.versions.outputs.boto3 }} + BOTOCORE_VERSION: ${{ needs.versions.outputs.botocore }} run: | - rm -rf mypy_boto3_output/* - - echo "Building all packages" - python -m mypy_boto3_builder mypy_boto3_output \ + rm -rf mypy_boto3_output/* || true + uvx \ + --with boto3==${BOTO3_VERSION} \ + --with botocore==${BOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product boto3 boto3-lite boto3-services \ ${EXTRA_FLAGS} \ --download-static-stubs \ -s all -d - - name: Install dependencies for publishing - run: | - python -m pip install setuptools wheel twine - name: Publish to PyPI env: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python ./scripts/release.py + uv run --no-project ./scripts/release.py diff --git a/.github/workflows/publish_types_aioboto3.yml b/.github/workflows/publish_types_aioboto3.yml index d1d0dbbc..11d9b260 100644 --- a/.github/workflows/publish_types_aioboto3.yml +++ b/.github/workflows/publish_types_aioboto3.yml @@ -1,5 +1,5 @@ name: Publish types-aioboto3 -concurrency: update_types_aioboto3 +concurrency: publish_types_aioboto3 on: schedule: @@ -32,7 +32,6 @@ jobs: runs-on: ubuntu-latest outputs: aioboto3: ${{ steps.aioboto3.outputs.result }} - aioboto3-url: ${{ steps.aioboto3-url.outputs.result }} version: ${{ steps.version.outputs.result }} extra-flags: ${{ steps.extra-flags.outputs.result }} steps: @@ -101,52 +100,36 @@ jobs: core.notice(`Extra flags = ${extraFlags}`) return extraFlags.join(' ') - - name: Aioboto3 download URL - id: aioboto3-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - const url = await getDownloadURL('aioboto3', "${{ steps.aioboto3.outputs.result }}") - core.notice(`aioboto3 download URL ${url}`) - return url - publish-types-aioboto3: + publish: name: Publish types-aioboto3 runs-on: ubuntu-latest needs: versions if: needs.versions.outputs.version steps: - uses: actions/checkout@v4 + with: + sparse-checkout: | + scripts/release.py + .python-version - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: .python-version - - name: Install builder - run: | - rm -rf mypy_boto3_builder - python -m pip install mypy_boto3_builder - - name: Install aioboto3 - run: | - mkdir installtemp - cd installtemp - wget ${{ needs.versions.outputs.aioboto3-url }} - pip uninstall -y s3transfer - pip install aioboto3* s3transfer - cd .. - rm -rf installtemp + - name: Set up uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" - name: Build all packages env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + AIOBOTO3_VERSION: ${{ needs.versions.outputs.aioboto3 }} run: | rm -rf mypy_boto3_output/* - - echo "Building all packages" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --with aioboto3==${AIOBOTO3_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product aioboto3 aioboto3-lite \ ${EXTRA_FLAGS} \ @@ -160,4 +143,4 @@ jobs: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python ./scripts/release.py + uv run --no-project ./scripts/release.py diff --git a/.github/workflows/publish_types_boto3.yml b/.github/workflows/publish_types_boto3.yml index 6307adbc..0d2cbc8a 100644 --- a/.github/workflows/publish_types_boto3.yml +++ b/.github/workflows/publish_types_boto3.yml @@ -43,8 +43,6 @@ jobs: outputs: boto3: ${{ steps.boto3.outputs.result }} botocore: ${{ steps.botocore.outputs.result }} - boto3-url: ${{ steps.boto3-url.outputs.result }} - botocore-url: ${{ steps.botocore-url.outputs.result }} version: ${{ steps.version.outputs.result }} build-all: ${{ steps.build-all.outputs.result }} extra-flags: ${{ steps.extra-flags.outputs.result }} @@ -148,69 +146,39 @@ jobs: core.notice(`Extra flags = ${extraFlags}`) return extraFlags.join(' ') - - name: Boto3 download URL - id: boto3-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - const url = await getDownloadURL('boto3', "${{ steps.boto3.outputs.result }}") - core.notice(`boto3 download URL ${url}`) - return url - - name: Botocore download URL - id: botocore-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - - const url = await getDownloadURL('botocore', "${{ steps.botocore.outputs.result }}") - core.notice(`botocore download URL ${url}`) - return url - - publish-types-boto3: + publish: name: Publish types-boto3 runs-on: ubuntu-latest needs: versions if: needs.versions.outputs.version steps: - uses: actions/checkout@v4 + with: + sparse-checkout: | + scripts/release.py + .python-version - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: .python-version - - name: Install boto3 - run: | - mkdir installtemp - cd installtemp - wget ${{ needs.versions.outputs.boto3-url }} - wget ${{ needs.versions.outputs.botocore-url }} - pip uninstall -y s3transfer - pip install botocore*.whl - pip install boto3*.whl - cd .. - rm -rf installtemp - - name: Install builder - run: | - rm -rf mypy_boto3_builder - python -m pip install mypy_boto3_builder + - name: Set up uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" - name: Build updated packages only if: needs.versions.outputs.build-all == 'false' env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + BOTO3_VERSION: ${{ needs.versions.outputs.boto3 }} + BOTOCORE_VERSION: ${{ needs.versions.outputs.botocore }} run: | rm -rf mypy_boto3_output/* - - echo "Building updated packages" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --with boto3==${BOTO3_VERSION} \ + --with botocore==${BOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product types-boto3 types-boto3-lite types-boto3-services \ ${EXTRA_FLAGS} \ @@ -222,23 +190,23 @@ jobs: env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + BOTO3_VERSION: ${{ needs.versions.outputs.boto3 }} + BOTOCORE_VERSION: ${{ needs.versions.outputs.botocore }} run: | rm -rf mypy_boto3_output/* - - echo "Building all packages" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --with boto3==${BOTO3_VERSION} \ + --with botocore==${BOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product types-boto3 types-boto3-lite types-boto3-services \ ${EXTRA_FLAGS} \ --output-type wheel sdist \ --download-static-stubs \ -s all -d - - name: Install dependencies for publishing - run: | - python -m pip install setuptools wheel twine - name: Publish to PyPI env: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python ./scripts/release.py --threads 1 --retries 1 + uv run --no-project ./scripts/release.py diff --git a/.github/workflows/publish_types_boto3_full.yml b/.github/workflows/publish_types_boto3_full.yml index 3b1eb561..4ded7adb 100644 --- a/.github/workflows/publish_types_boto3_full.yml +++ b/.github/workflows/publish_types_boto3_full.yml @@ -33,8 +33,6 @@ jobs: outputs: boto3: ${{ steps.boto3.outputs.result }} botocore: ${{ steps.botocore.outputs.result }} - boto3-url: ${{ steps.boto3-url.outputs.result }} - botocore-url: ${{ steps.botocore-url.outputs.result }} version: ${{ steps.version.outputs.result }} extra-flags: ${{ steps.extra-flags.outputs.result }} steps: @@ -115,79 +113,46 @@ jobs: core.notice(`Extra flags = ${extraFlags}`) return extraFlags.join(' ') - - name: Boto3 download URL - id: boto3-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - - const url = await getDownloadURL('boto3', "${{ steps.boto3.outputs.result }}") - core.notice(`boto3 download URL ${url}`) - return url - - name: Botocore download URL - id: botocore-url - if: steps.version.outputs.result - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') - setupGlobals({ core, context, fetch }) - const url = await getDownloadURL('botocore', "${{ steps.botocore.outputs.result }}") - core.notice(`botocore download URL ${url}`) - return url - - publish-types-boto3: - name: Publish types-boto3 + publish: + name: Publish types-boto3-full runs-on: ubuntu-latest needs: versions if: needs.versions.outputs.version steps: - uses: actions/checkout@v4 + with: + sparse-checkout: | + scripts/release.py + .python-version - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: .python-version - - name: Install boto3 - run: | - mkdir installtemp - cd installtemp - wget ${{ needs.versions.outputs.boto3-url }} - wget ${{ needs.versions.outputs.botocore-url }} - pip uninstall -y s3transfer - pip install botocore*.whl - pip install boto3*.whl - cd .. - rm -rf installtemp - - name: Install builder - run: | - rm -rf mypy_boto3_builder - python -m pip install mypy_boto3_builder + - name: Set up uv + uses: astral-sh/setup-uv@v4 + with: + version: "latest" - name: Build env: VERSION: ${{ needs.versions.outputs.version }} EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} + BOTO3_VERSION: ${{ needs.versions.outputs.boto3 }} + BOTOCORE_VERSION: ${{ needs.versions.outputs.botocore }} run: | rm -rf mypy_boto3_output/* - - echo "Building" - python -m mypy_boto3_builder mypy_boto3_output \ + uvx \ + --with boto3==${BOTO3_VERSION} \ + --with botocore==${BOTOCORE_VERSION} \ + mypy_boto3_builder mypy_boto3_output \ -b ${VERSION} \ --product types-boto3-full \ ${EXTRA_FLAGS} \ --download-static-stubs \ -s all -d - - name: Install dependencies for publishing - run: | - python -m pip install setuptools wheel twine - name: Publish to PyPI env: PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python ./scripts/release.py + uv run --no-project ./scripts/release.py diff --git a/.github/workflows/sanity_check.yml b/.github/workflows/sanity_check.yml index 9e99e726..15fb5f81 100644 --- a/.github/workflows/sanity_check.yml +++ b/.github/workflows/sanity_check.yml @@ -51,7 +51,7 @@ jobs: with: python-version-file: .python-version - name: Set up uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 with: version: "latest" - name: Install the project diff --git a/scripts/release.py b/scripts/release.py index e3be7a11..776cffb2 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -1,4 +1,13 @@ #!/usr/bin/env python +# /// script +# requires-python = ">=3.12" +# dependencies = [ +# "requests", +# "setuptools", +# "twine", +# "wheel", +# ] +# /// """ Publish packages to PyPI.