Skip to content

task: Replace 'toml' package #528

@ogenstad

Description

@ogenstad

Component

No response

Task Description

We currently have the 'toml' package listed as an optional requirement in the SDK:

https://github.com/opsmill/infrahub-sdk-python/blob/v1.14.0/pyproject.toml#L39

Since Python 3.11 there's a module called tomllib bundled with Python and according to https://realpython.com/python311-tomllib/ it looks like its API is the same as another package called tomli.

Meaning that when we import toml here:
https://github.com/opsmill/infrahub-sdk-python/blob/v1.14.0/infrahub_sdk/ctl/config.py#L7

We could instead have:

try:
    import tomllib
except ModuleNotFoundError:
    import tomli as tomllib

The pyproject.toml file would need to be updated to optionally install tomli when using Python 3.9 and 3.10 and when using Python 3.11 or above we wouldn't need to install any additional toml package and as such we can remove one of the external dependencies from the SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/newcomersGood for newcomerstype/taskBody of work related to an epic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions