From 86cf08447f3b390ddba3d704609b7d70a2d4a077 Mon Sep 17 00:00:00 2001 From: Yasen Date: Mon, 9 Feb 2026 13:38:53 +0100 Subject: [PATCH 1/2] Change the default chunk size to infinite --- CHANGES/1305.feature | 1 + src/pulp_cli/generic.py | 8 +++++--- src/pulpcore/cli/ansible/content.py | 4 ++-- tests/test_help_pages.py | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 CHANGES/1305.feature diff --git a/CHANGES/1305.feature b/CHANGES/1305.feature new file mode 100644 index 000000000..a524139e6 --- /dev/null +++ b/CHANGES/1305.feature @@ -0,0 +1 @@ +Change the default chunking value to "infinite". If users wants to, they can still specify a value based on their needs. \ No newline at end of file diff --git a/src/pulp_cli/generic.py b/src/pulp_cli/generic.py index 8e1369fcf..e6e32a63e 100644 --- a/src/pulp_cli/generic.py +++ b/src/pulp_cli/generic.py @@ -717,7 +717,9 @@ def _callback( units = {"B": 1, "KB": 10**3, "MB": 10**6, "GB": 10**9, "TB": 10**12} -def parse_size_callback(ctx: click.Context, param: click.Parameter, value: str) -> int: +def parse_size_callback(ctx: click.Context, param: click.Parameter, value: str | None) -> int: + if value is None: + return sys.maxsize size = value.strip().upper() match = re.match(r"^([0-9]+)\s*([KMGT]?B)?$", size) if not match: @@ -1216,8 +1218,8 @@ def _type_callback(ctx: click.Context, param: click.Parameter, value: str | None chunk_size_option = pulp_option( "--chunk-size", - help=_("Chunk size to break up {entity} into. Defaults to 1MB"), - default="1MB", + help=_("Chunk size to break up {entity} into. Defaults to not chunking at all."), + default=None, callback=parse_size_callback, ) diff --git a/src/pulpcore/cli/ansible/content.py b/src/pulpcore/cli/ansible/content.py index ab2b918b6..97ac90e48 100644 --- a/src/pulpcore/cli/ansible/content.py +++ b/src/pulpcore/cli/ansible/content.py @@ -184,8 +184,8 @@ def content(ctx: click.Context, pulp_ctx: PulpCLIContext, /, content_type: str) @repository_option @pulp_option( "--chunk-size", - help=_("Chunk size to break up {entity} into. Defaults to 1MB"), - default="1MB", + help=_("Chunk size to break up {entity} into. Defaults to not chunking at all."), + default=None, callback=parse_size_callback, allowed_with_contexts=content_context, ) diff --git a/tests/test_help_pages.py b/tests/test_help_pages.py index 87e082cee..5be2a247c 100644 --- a/tests/test_help_pages.py +++ b/tests/test_help_pages.py @@ -32,7 +32,7 @@ def traverse_commands(command: click.Command, args: t.List[str]) -> t.Iterator[t def pytest_generate_tests(metafunc: pytest.Metafunc) -> None: m = next(metafunc.definition.iter_markers("help_page"), None) if m is not None and "base_cmd" in m.kwargs: - rel_main:click.Group = main + rel_main: click.Group = main base_cmd = m.kwargs["base_cmd"] for step in base_cmd: sub = rel_main.commands[step] From 4b7c34afa7f478ad656508a00c99bedb027ad5ca Mon Sep 17 00:00:00 2001 From: Yasen Date: Tue, 17 Feb 2026 22:42:36 +0100 Subject: [PATCH 2/2] max.size triggers cpythern error --- src/pulp_cli/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulp_cli/generic.py b/src/pulp_cli/generic.py index e6e32a63e..20cfdbb6b 100644 --- a/src/pulp_cli/generic.py +++ b/src/pulp_cli/generic.py @@ -719,7 +719,7 @@ def _callback( def parse_size_callback(ctx: click.Context, param: click.Parameter, value: str | None) -> int: if value is None: - return sys.maxsize + return 8 * 10**9 size = value.strip().upper() match = re.match(r"^([0-9]+)\s*([KMGT]?B)?$", size) if not match: