Skip to content

Commit

Permalink
Add temp release all for types-boto3
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Nov 28, 2024
1 parent 4c38ac4 commit 0a47f16
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 30 deletions.
59 changes: 38 additions & 21 deletions .github/workflows/publish_types_boto3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Publish types-boto3
concurrency: publish_types_boto3

on:
# schedule:
# - cron: "*/15 * * * *"
schedule:
- cron: "0 * * * *"
workflow_dispatch:
inputs:
boto3_version:
Expand Down Expand Up @@ -201,24 +201,40 @@ jobs:
run: |
rm -rf mypy_boto3_builder
python -m pip install mypy_boto3_builder
- 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 }}
run: |
rm -rf mypy_boto3_output/*
# - 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 }}
# run: |
# rm -rf mypy_boto3_output/*

echo "Building updated packages"
python -m 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 updated -d
- name: Build all packages
if: needs.versions.outputs.build-all == 'true'
# echo "Building updated packages"
# python -m 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 updated -d
# - name: Build all packages
# if: needs.versions.outputs.build-all == 'true'
# env:
# VERSION: ${{ needs.versions.outputs.version }}
# EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }}
# run: |
# rm -rf mypy_boto3_output/*

# echo "Building all packages"
# python -m 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
# FIXME: Delete tomorrow
- name: Temp initial release all packages
env:
VERSION: ${{ needs.versions.outputs.version }}
EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }}
Expand All @@ -231,7 +247,8 @@ jobs:
--product types-boto3 types-boto3-lite types-boto3-services \
${EXTRA_FLAGS} \
--output-type wheel sdist \
--download-static-stubs \
--skip-published \
--no-smart-version \
-s all -d
- name: Install dependencies for publishing
run: |
Expand All @@ -241,4 +258,4 @@ jobs:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python ./scripts/release.py
python ./scripts/release.py --publish-threads 1 --retries 1
22 changes: 14 additions & 8 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import shutil
import subprocess
import sys
import time
from contextlib import contextmanager
from dataclasses import dataclass
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -86,7 +87,6 @@ class CLINamespace:
"""

path: Path
threads: int
publish_threads: int
filter: tuple[Path, ...]
skip_build: bool
Expand All @@ -105,16 +105,14 @@ def parse_args() -> CLINamespace:
type=Path,
default=Path().parent.parent / "mypy_boto3_output",
)
parser.add_argument("-t", "--threads", type=int, default=10)
parser.add_argument("--publish-threads", type=int, default=3)
parser.add_argument("--publish-threads", type=int, default=1)
parser.add_argument("-f", "--filter", nargs="+", type=Path, default=[])
parser.add_argument("--skip-build", action="store_true")
parser.add_argument("--skip-publish", action="store_true")
parser.add_argument("-r", "--retries", type=int, default=10)
args = parser.parse_args()
return CLINamespace(
path=args.path,
threads=args.threads,
publish_threads=args.publish_threads,
filter=tuple(args.filter),
skip_build=args.skip_build,
Expand Down Expand Up @@ -221,7 +219,6 @@ def publish(paths: Sequence[Path]) -> Sequence[Path]:
),
[path.as_posix()],
)

except TwineException:
logger.warning(f"Configuration error while publishing {path.name}")
raise
Expand All @@ -236,11 +233,13 @@ def publish(paths: Sequence[Path]) -> Sequence[Path]:
logger.warning(f"Error while publishing {path.name}: {e}")
logger.warning(f"Response: {response}")
logger.info(f"Retrying {path.name} {attempt} time in 10 seconds")
time.sleep(10)
except RequestsConnectionError as e:
attempt += 1
last_error = e
logger.warning(f"Error while publishing {path.name}: {e}")
logger.info(f"Retrying {path.name} {attempt} time in 10 seconds")
time.sleep(10)
else:
return paths

Expand Down Expand Up @@ -288,14 +287,21 @@ def publish_batches(args: CLINamespace, path_batches: Sequence[Sequence[Sequence
current_total = 0
logger = logging.getLogger(LOGGER_NAME)
for path_batch in path_batches:
with ThreadPool(processes=args.publish_threads) as pool:
publish_args = [(i,) for i in path_batch]
for index, paths in enumerate(pool.starmap(publish, publish_args)):
if args.publish_threads == 1:
for index, paths in enumerate(map(publish, path_batch)):
current_index = current_total + index
path_names = " ".join(path.name for path in paths)
logger.info(
f"{get_progress_str(current_index, total)} Published {path_names}",
)
else:
with ThreadPool(processes=args.publish_threads) as pool:
for index, paths in enumerate(pool.map(publish, path_batch)):
current_index = current_total + index
path_names = " ".join(path.name for path in paths)
logger.info(
f"{get_progress_str(current_index, total)} Published {path_names}",
)
current_total += len(path_batch)


Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0a47f16

Please sign in to comment.