Skip to content

Commit 41c5263

Browse files
Fix Set versioning (#13)
* Fix Set versioning * format --------- Co-authored-by: Rahul Devikar <radevika@microsoft.com>
1 parent 6678329 commit 41c5263

13 files changed

Lines changed: 99 additions & 277 deletions

File tree

  • .github/workflows
  • libraries
    • microsoft-agents-a365-notifications
    • microsoft-agents-a365-observability-core
    • microsoft-agents-a365-observability-extensions-langchain
    • microsoft-agents-a365-observability-extensions-openai
    • microsoft-agents-a365-observability-extensions-semantickernel
    • microsoft-agents-a365-runtime
    • microsoft-agents-a365-tooling-extensions-agentframework
    • microsoft-agents-a365-tooling-extensions-azureaifoundry
    • microsoft-agents-a365-tooling-extensions-openai
    • microsoft-agents-a365-tooling-extensions-semantickernel
    • microsoft-agents-a365-tooling

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ jobs:
115115
- name: Build package
116116
run: |
117117
AGENT365_PYTHON_SDK_PACKAGE_VERSION=${{ needs.version-number.outputs.PACKAGE_VERSION }} uv build --all-packages --wheel
118+
env:
119+
AGENT365_PYTHON_SDK_PACKAGE_VERSION: ${{ needs.version-number.outputs.PACKAGE_VERSION }}
118120

119121
- name: Run unit tests
120122
run: |
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1-
# Copyright (c) Microsoft. All rights reserved.
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
"""
5+
Version utilities for Agent365 SDK packages.
6+
7+
This module is deprecated. Versioning is now handled automatically by
8+
setuptools-git-versioning. See versioning/TARGET-VERSION and
9+
HOW_TO_SET_A_VERSION.md for details.
10+
"""
211

312
from __future__ import annotations
413

514
import os
6-
from datetime import datetime
7-
from zoneinfo import ZoneInfo
815

916

1017
def build_version():
1118
"""
12-
Build version string for Agent365 SDK packages.
19+
DEPRECATED: This function is no longer used.
1320
14-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
15-
Uses UTC.
21+
Version is now automatically calculated by setuptools-git-versioning
22+
based on Git history and tags. See HOW_TO_SET_A_VERSION.md for details.
1623
1724
Returns:
18-
str: Version string in format YYYY.M.D+preview.HHMMSS or environment override
25+
str: Version from AGENT365_PYTHON_SDK_PACKAGE_VERSION environment variable or "0.0.0"
1926
"""
20-
if defined_version := os.getenv("A365_SDK_VERSION"):
21-
return defined_version # For CI/CD to set a specific version.
22-
23-
today = datetime.now(ZoneInfo("UTC"))
27+
import warnings
2428

25-
return (
26-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
29+
warnings.warn(
30+
"build_version() is deprecated. Version is now managed by setuptools-git-versioning.",
31+
DeprecationWarning,
32+
stacklevel=2,
2733
)
34+
return os.environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Copyright (c) Microsoft. All rights reserved.
2-
3-
import os
4-
from datetime import datetime
5-
from zoneinfo import ZoneInfo
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
63

4+
from os import environ
75
from setuptools import setup
86

9-
10-
def build_version():
11-
"""
12-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
13-
Uses UTC.
14-
"""
15-
16-
if defined_version := os.getenv("A365_SDK_VERSION"):
17-
return defined_version # For CI/CD to set a specific version.
18-
19-
today = datetime.now(ZoneInfo("UTC"))
20-
21-
return (
22-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
23-
)
24-
25-
26-
VERSION = build_version()
7+
# Get version from environment variable set by CI/CD
8+
# This will be set by setuptools-git-versioning in the CI pipeline
9+
package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
2710

2811
setup(
29-
version=VERSION,
12+
version=package_version,
3013
)

0 commit comments

Comments
 (0)