Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
78 changes: 78 additions & 0 deletions devel/measure-package-size.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env python3
# Copyright 2026 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Measure release wheel sizes without installing it or its dependencies.

Run with a Python environment containing setuptools and wheel. Pass the same
interpreter and separate clean checkouts to compare revisions. Sizes count
file contents, not filesystem allocation; bytecode uses optimization level 0.
"""

import argparse
import compileall
import json
from pathlib import Path
import subprocess
import sys
import tempfile
import zipfile


def measure(root):
with tempfile.TemporaryDirectory(prefix="kubernetes-size-") as tmp:
temp = Path(tmp)
result = subprocess.run(
[sys.executable, "setup-release.py", "bdist_wheel",
"--dist-dir", str(temp / "dist"),
"--bdist-dir", str(temp / "build")],
cwd=root, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
text=True,
)
if result.returncode:
sys.stderr.write(result.stdout)
result.check_returncode()
wheel = next((temp / "dist").glob("*.whl"))
installed = temp / "installed"
with zipfile.ZipFile(wheel) as archive:
archive.extractall(installed)
source_bytes = sum(
entry.file_size for entry in archive.infolist()
if entry.filename.endswith(".py")
)
installed_bytes = sum(
entry.file_size for entry in archive.infolist()
)
if not compileall.compile_dir(
installed, quiet=2, force=True, stripdir=str(installed), optimize=0,
):
raise RuntimeError("Wheel bytecode compilation failed")
bytecode_bytes = sum(
path.stat().st_size for path in installed.rglob("*.pyc")
)
return {
"python": sys.version.split()[0],
"source_bytes": source_bytes,
"wheel_bytes": wheel.stat().st_size,
"installed_no_compile_bytes": installed_bytes,
"bytecode_bytes": bytecode_bytes,
"installed_with_bytecode_bytes": installed_bytes + bytecode_bytes,
}


if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("checkout", type=Path, help="Client repository root")
args = parser.parse_args()
print(json.dumps(measure(args.checkout.resolve()), indent=2))
4 changes: 2 additions & 2 deletions kubernetes/.openapi-generator/COMMIT
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Requested Commit/Tag : v7.25.0
Actual Commit : ef964b04480889ef86b56cfae84ade8ad4c91c41
Requested Commit/Tag : 3cf4b374881ed853d522d67b326428e09defcf29
Actual Commit : 3cf4b374881ed853d522d67b326428e09defcf29
1 change: 1 addition & 0 deletions kubernetes/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
README.md
client/__init__.py
client/_legacy_model_helpers.py
client/api/__init__.py
client/api/admissionregistration_api.py
client/api/admissionregistration_v1_api.py
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.25.0
7.27.0-SNAPSHOT
40 changes: 39 additions & 1 deletion kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ This Python package is automatically generated by the [OpenAPI Generator](https:

- API version: release-1.37
- Package version: 37.0.0+snapshot
- Generator version: 7.25.0
- Generator version: 7.27.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python 3.10+

Packaging uses standard `[project]` metadata and `[dependency-groups]` (PEP 621/735).
Install the package with `python -m pip install .`; install development dependencies
with Poetry 2.2 or newer using `poetry install`, or pip 25.1 or newer using
`python -m pip install --group dev`. The latter installs the group, not the package.

## Installation & Usage
### pip install

Expand Down Expand Up @@ -1980,3 +1985,36 @@ Authentication schemes defined for the API:


## Author




## Request headers

Header names are compared case-insensitively in all Python client libraries.
Request headers are copied; supplying `_headers` does not change the caller's dict
or the client's shared defaults. The public `_headers` argument retains its dict
validation and existing value serialization. Pydantic can coerce mappings such as HTTPX `Headers` to a dict,
combining repeated fields into a single value; `_headers` does not provide a
repeated-field or list-of-pairs API.

Precedence, from lowest to highest:

1. `_headers` (within one dict, the last inserted case variant wins).
2. Explicit OpenAPI header parameters and generated `Content-Type` (or `_content_type`).
Generated `Accept` is added only when neither `_headers` nor explicit header
parameters contain an `Accept` case variant.
3. `ApiClient.default_headers` (including headers set with `set_default_header`).
4. The client's `cookie` setting, for `Cookie`.
5. Authentication headers. A non-empty `_request_auth` replaces configured
authentication for that call; `{}` retains configured authentication. Cookie
authentication appends to the selected `Cookie` value.

This retains the existing precedence for identically spelled names and extends it
to case variants. To override a generated content type, use `_content_type`;
client defaults still take precedence over it. The winning header's spelling and
value are retained for replacements. Cookie authentication uses the canonical
`Cookie` spelling and appends its value. Values containing legitimate
comma-separated lists are not split or deduplicated. This does not remove
duplicate values inside a header or change the handling of repeated fields
supplied directly to the transport.
4 changes: 2 additions & 2 deletions kubernetes/aio/.openapi-generator/COMMIT
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Requested Commit/Tag : v7.25.0
Actual Commit : ef964b04480889ef86b56cfae84ade8ad4c91c41
Requested Commit/Tag : 3cf4b374881ed853d522d67b326428e09defcf29
Actual Commit : 3cf4b374881ed853d522d67b326428e09defcf29
1 change: 1 addition & 0 deletions kubernetes/aio/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
README.md
client/__init__.py
client/_legacy_model_helpers.py
client/api/__init__.py
client/api/admissionregistration_api.py
client/api/admissionregistration_v1_api.py
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/aio/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.25.0
7.27.0-SNAPSHOT
40 changes: 39 additions & 1 deletion kubernetes/aio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ This Python package is automatically generated by the [OpenAPI Generator](https:

- API version: release-1.37
- Package version: 37.0.0+snapshot
- Generator version: 7.25.0
- Generator version: 7.27.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python 3.10+

Packaging uses standard `[project]` metadata and `[dependency-groups]` (PEP 621/735).
Install the package with `python -m pip install .`; install development dependencies
with Poetry 2.2 or newer using `poetry install`, or pip 25.1 or newer using
`python -m pip install --group dev`. The latter installs the group, not the package.

## Installation & Usage
### pip install

Expand Down Expand Up @@ -1980,3 +1985,36 @@ Authentication schemes defined for the API:


## Author




## Request headers

Header names are compared case-insensitively in all Python client libraries.
Request headers are copied; supplying `_headers` does not change the caller's dict
or the client's shared defaults. The public `_headers` argument retains its dict
validation and existing value serialization. Pydantic can coerce mappings such as HTTPX `Headers` to a dict,
combining repeated fields into a single value; `_headers` does not provide a
repeated-field or list-of-pairs API.

Precedence, from lowest to highest:

1. `_headers` (within one dict, the last inserted case variant wins).
2. Explicit OpenAPI header parameters and generated `Content-Type` (or `_content_type`).
Generated `Accept` is added only when neither `_headers` nor explicit header
parameters contain an `Accept` case variant.
3. `ApiClient.default_headers` (including headers set with `set_default_header`).
4. The client's `cookie` setting, for `Cookie`.
5. Authentication headers. A non-empty `_request_auth` replaces configured
authentication for that call; `{}` retains configured authentication. Cookie
authentication appends to the selected `Cookie` value.

This retains the existing precedence for identically spelled names and extends it
to case variants. To override a generated content type, use `_content_type`;
client defaults still take precedence over it. The winning header's spelling and
value are retained for replacements. Cookie authentication uses the canonical
`Cookie` spelling and appends its value. Values containing legitimate
comma-separated lists are not split or deduplicated. This does not remove
duplicate values inside a header or change the handling of repeated fields
supplied directly to the transport.
80 changes: 80 additions & 0 deletions kubernetes/aio/client/_legacy_model_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"""
Kubernetes

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: release-1.37
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


from typing import Any

_OPENAPI_GENERATOR_TO_DICT = "_openapi_generator_to_dict"


def _get_openapi_to_dict(value: Any) -> Any:
# Reciprocal function references preserve inherited generated methods
# without reserving model member names. Checking both directions also
# rejects overrides whose decorators copy function attributes.
to_dict = getattr(value, "to_dict", None)
type_to_dict = getattr(type(value), "to_dict", None)
if (
not callable(to_dict)
or getattr(to_dict, "__func__", None) is not type_to_dict
):
return None

openapi_to_dict = getattr(
type_to_dict, _OPENAPI_GENERATOR_TO_DICT, None
)
if (
not callable(openapi_to_dict)
or getattr(
openapi_to_dict,
_OPENAPI_GENERATOR_TO_DICT,
None,
) is not type_to_dict
):
return None
return openapi_to_dict


def _to_legacy_item(value: Any, serialize: bool) -> Any:
to_dict = getattr(value, "to_dict", None)
if _get_openapi_to_dict(value) is not None and callable(to_dict):
return to_dict(serialize=serialize)
if callable(to_dict):
return to_dict()
return value


def _to_legacy_value(value: Any, serialize: bool) -> Any:
# python-legacy converted only immediate list elements or dictionary values:
# https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L203-L231
if isinstance(value, list):
return [_to_legacy_item(item, serialize) for item in value]
if isinstance(value, dict):
return {
key: _to_legacy_item(item, serialize)
for key, item in value.items()
}
return _to_legacy_item(value, serialize)


def _to_openapi_value(value: Any) -> Any:
if isinstance(value, list):
return [_to_openapi_value(item) for item in value]
if isinstance(value, dict):
return {key: _to_openapi_value(item) for key, item in value.items()}

to_openapi_dict = _get_openapi_to_dict(value)
if to_openapi_dict is not None:
return to_openapi_dict(value)

to_dict = getattr(value, "to_dict", None)
if callable(to_dict):
return to_dict()
return value
4 changes: 2 additions & 2 deletions kubernetes/aio/client/api/admissionregistration_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ async def _get_api_group_serialize(

_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
Expand All @@ -273,7 +273,7 @@ async def _get_api_group_serialize(


# set the HTTP header `Accept`
if 'Accept' not in _header_params:
if not any(key.lower() == 'accept' for key in _header_params):
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json',
Expand Down
Loading
Loading