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: