From c1eb31f5d0470d2797a99b50493d574736fbe5e7 Mon Sep 17 00:00:00 2001 From: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Date: Fri, 12 Jul 2024 18:16:30 -0400 Subject: [PATCH] make sure package version is a string (#2695) --- .chronus/changes/fix_package_version-2024-6-12-15-20-17.md | 7 +++++++ .../typespec-python/generator/pygen/codegen/__init__.py | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 .chronus/changes/fix_package_version-2024-6-12-15-20-17.md diff --git a/.chronus/changes/fix_package_version-2024-6-12-15-20-17.md b/.chronus/changes/fix_package_version-2024-6-12-15-20-17.md new file mode 100644 index 0000000000..952479f21b --- /dev/null +++ b/.chronus/changes/fix_package_version-2024-6-12-15-20-17.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@azure-tools/typespec-python" +--- + +always interpret `package-version` as a string \ No newline at end of file diff --git a/packages/typespec-python/generator/pygen/codegen/__init__.py b/packages/typespec-python/generator/pygen/codegen/__init__.py index ea4716f86e..11d829263c 100644 --- a/packages/typespec-python/generator/pygen/codegen/__init__.py +++ b/packages/typespec-python/generator/pygen/codegen/__init__.py @@ -164,6 +164,10 @@ def packaging_files_config(self) -> Optional[Dict[str, Any]]: except AttributeError: return packaging_files_config + @property + def package_version(self) -> Optional[str]: + return str(self.options.get("package-version", "")) + class CodeGenerator(Plugin): def __init__(self, *args, **kwargs: Any) -> None: