Skip to content
This repository was archived by the owner on Jul 13, 2025. It is now read-only.
This repository was archived by the owner on Jul 13, 2025. It is now read-only.

Order of keyword args between versions can cause breakage. #526

@dhermes

Description

@dhermes

In Python, keyword args can also be passed as positional args. So in gapic-google-logging-v2 (0.9.3), LoggingServiceV2Api.list_log_entries had the signature:

def list_log_entries(self,
                     project_ids,
                     filter_='',
                     order_by='',
                     page_size=0,
                     options=None):

but in gapic-google-logging-v2 (0.10.1), it became:

def list_log_entries(self,
                     project_ids,
                     resource_names=None,
                     filter_='',
                     order_by='',
                     page_size=0,
                     options=None):

i.e. it grew resource_names in the middle. Hence when we called via positional only

page_iter = self._gax_api.list_log_entries(
    projects, filter_, order_by, page_size, options)

that code broke on the upgrade from 0.9.x to 0.10.x.


This is somewhat fine, but if you wanted, you could force users to always use some arguments as keywords by using *args, **kwargs and then unpacking args according to a specified length needed for positional and then removing from kwargs to sanitize.

Metadata

Metadata

Assignees

Labels

lang: pythonIssues specific to Python.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions