Skip to content

new logic in sdk/_version not working if included in another project #36

@marcelkb

Description

@marcelkb

hi,

since the new update code was added in sdk/_version to support the new versioning:

def _get_version() -> str:
    current_file = Path(__file__)
    pyproject_path = current_file.parent.parent / "pyproject.toml"

    try:
        with open(pyproject_path, "rb") as f:
            pyproject_data = tomllib.load(f)
        return str(pyproject_data["project"]["version"])
    except (FileNotFoundError, KeyError, Exception):
        raise ValueError("Failed to read version from pyproject.toml")

SDK_VERSION = _get_version()

this code is not working if the lib is exported and included in another project.
the pyproject.toml dont get exported by default.
another problem is that the calculated relative path points to
/venv/Lib/site-packages/pyproject.toml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions