diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 455f481c..26046f64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,6 +115,8 @@ jobs: - name: Build package run: | AGENT365_PYTHON_SDK_PACKAGE_VERSION=${{ needs.version-number.outputs.PACKAGE_VERSION }} uv build --all-packages --wheel + env: + AGENT365_PYTHON_SDK_PACKAGE_VERSION: ${{ needs.version-number.outputs.PACKAGE_VERSION }} - name: Run unit tests run: | diff --git a/libraries/microsoft-agents-a365-notifications/setup.py b/libraries/microsoft-agents-a365-notifications/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-notifications/setup.py +++ b/libraries/microsoft-agents-a365-notifications/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-observability-core/setup.py b/libraries/microsoft-agents-a365-observability-core/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-observability-core/setup.py +++ b/libraries/microsoft-agents-a365-observability-core/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-observability-extensions-langchain/setup.py b/libraries/microsoft-agents-a365-observability-extensions-langchain/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-observability-extensions-langchain/setup.py +++ b/libraries/microsoft-agents-a365-observability-extensions-langchain/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-observability-extensions-openai/setup.py b/libraries/microsoft-agents-a365-observability-extensions-openai/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-observability-extensions-openai/setup.py +++ b/libraries/microsoft-agents-a365-observability-extensions-openai/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-observability-extensions-semantickernel/setup.py b/libraries/microsoft-agents-a365-observability-extensions-semantickernel/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-observability-extensions-semantickernel/setup.py +++ b/libraries/microsoft-agents-a365-observability-extensions-semantickernel/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/version_utils.py b/libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/version_utils.py index 59ceaa7c..7a471b38 100644 --- a/libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/version_utils.py +++ b/libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/version_utils.py @@ -1,27 +1,34 @@ -# Copyright (c) Microsoft. All rights reserved. +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +""" +Version utilities for Agent365 SDK packages. + +This module is deprecated. Versioning is now handled automatically by +setuptools-git-versioning. See versioning/TARGET-VERSION and +HOW_TO_SET_A_VERSION.md for details. +""" from __future__ import annotations import os -from datetime import datetime -from zoneinfo import ZoneInfo def build_version(): """ - Build version string for Agent365 SDK packages. + DEPRECATED: This function is no longer used. - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. + Version is now automatically calculated by setuptools-git-versioning + based on Git history and tags. See HOW_TO_SET_A_VERSION.md for details. Returns: - str: Version string in format YYYY.M.D+preview.HHMMSS or environment override + str: Version from AGENT365_PYTHON_SDK_PACKAGE_VERSION environment variable or "0.0.0" """ - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) + import warnings - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" + warnings.warn( + "build_version() is deprecated. Version is now managed by setuptools-git-versioning.", + DeprecationWarning, + stacklevel=2, ) + return os.environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") diff --git a/libraries/microsoft-agents-a365-runtime/setup.py b/libraries/microsoft-agents-a365-runtime/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-runtime/setup.py +++ b/libraries/microsoft-agents-a365-runtime/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-tooling-extensions-agentframework/setup.py b/libraries/microsoft-agents-a365-tooling-extensions-agentframework/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-agentframework/setup.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-agentframework/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/setup.py b/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/setup.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-tooling-extensions-openai/setup.py b/libraries/microsoft-agents-a365-tooling-extensions-openai/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-openai/setup.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-openai/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/setup.py b/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/setup.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, ) diff --git a/libraries/microsoft-agents-a365-tooling/setup.py b/libraries/microsoft-agents-a365-tooling/setup.py index 885895ea..a04ba9a5 100644 --- a/libraries/microsoft-agents-a365-tooling/setup.py +++ b/libraries/microsoft-agents-a365-tooling/setup.py @@ -1,30 +1,13 @@ -# Copyright (c) Microsoft. All rights reserved. - -import os -from datetime import datetime -from zoneinfo import ZoneInfo +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +from os import environ from setuptools import setup - -def build_version(): - """ - Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens) - Uses UTC. - """ - - if defined_version := os.getenv("A365_SDK_VERSION"): - return defined_version # For CI/CD to set a specific version. - - today = datetime.now(ZoneInfo("UTC")) - - return ( - f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}" - ) - - -VERSION = build_version() +# Get version from environment variable set by CI/CD +# This will be set by setuptools-git-versioning in the CI pipeline +package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0") setup( - version=VERSION, + version=package_version, )