Skip to content

Unifying target version parameter for upgrade_document #77

@tom-tan

Description

@tom-tan

The current implementation of upgrade_document has the following signature:

def upgrade_document(
    document: Any, v1_only: bool, v1_1_only: bool, output_dir: str, imports: Set[str]
) -> Any:

IMO it is not scalable for future releases because the new parameter should be added for each release version.

How about fixing the signature as follows?

def upgrade_document(
    document: Any, target_version: Optional[str] = "latest", output_dir: str, imports: Set[str]
) -> Any:

The target_version parameter takes a version string such as "v1.0", "v1.1", "v1.2" and "latest" (same as "v1.2").
It enables upgrading upgrade_document to other future release versions without changing its signature.

If it is OK for this change, I will send a pull request for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions