Use lib/ts_utils for scripts/sync_protobuf (#12913)

- Simplified `download_file` error handling (400+ return codes already raised errors!)
- Moved `update_metadata` from `scripts/sync_protobuf/_utils.py` to `lib/ts_utils/metadata.py`
- Improved `update_metadata` to support any key (values unvalidated atm) and return the modified dictionary
- Updated `scripts/stubsabot.py` to use `update_metadata`
- Updated `scripts/sync_protobuf/*` to use  `lib/ts_utils`
- Updated `scripts/sync_protobuf/tensorflow.py` and `scripts/sync_protobuf/google_protobuf.py` to use the version directly from the `METADATA.toml` file
This commit is contained in:
Avasam
2024-10-28 06:47:52 -04:00
committed by GitHub
parent c225ac7587
commit bff5547abc
9 changed files with 54 additions and 60 deletions

View File

@@ -1,12 +1,11 @@
# Whenever you update version here, PACKAGE_VERSION should be updated
# in scripts/sync_proto/tensorflow.py and vice-versa.
version = "2.17.*"
# Using an exact number in the specifier for scripts/sync_proto/tensorflow.py
version = "~=2.17.1"
upstream_repository = "https://github.com/tensorflow/tensorflow"
# requires a version of numpy with a `py.typed` file
# see https://github.com/python/typeshed/issues/12551
# on why we need the upper bound for numpy
requires = ["numpy>=1.20,<2.1.0", "types-protobuf", "types-requests"]
extra_description = "Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 26.1 on `tensorflow==2.17.0`."
extra_description = "Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 27.2 on `tensorflow==2.17.1`."
partial_stub = true
[tool.stubtest]