Skip to content

Commit 3a54291

Browse files
committed
Fix Set versioning
1 parent 7a19369 commit 3a54291

13 files changed

Lines changed: 112 additions & 280 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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ jobs:
110110
111111
- name: Build package
112112
run: |
113-
A365_SDK_VERSION=${{ needs.version-number.outputs.PYTHON_PACKAGE_VERSION }} uv build --all-packages --wheel
113+
AGENT365_PYTHON_SDK_PACKAGE_VERSION=${{ needs.version-number.outputs.PACKAGE_VERSION }} uv build --all-packages --wheel
114+
env:
115+
AGENT365_PYTHON_SDK_PACKAGE_VERSION: ${{ needs.version-number.outputs.PACKAGE_VERSION }}
114116

115117
- name: Run unit tests
116118
run: |
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+
Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
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.
13-
14-
Example: 2025.10.3+preview.65532 (PEP 440 compliant; avoids hyphens)
15-
Uses UTC.
19+
DEPRECATED: This function is no longer used.
20+
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"))
24-
25-
return (
26-
f"{today.year}.{today.month}.{today.day}+preview.{today.hour}{today.minute}{today.second}"
27+
import warnings
28+
warnings.warn(
29+
"build_version() is deprecated. Version is now managed by setuptools-git-versioning.",
30+
DeprecationWarning,
31+
stacklevel=2
2732
)
33+
return os.environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
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
)
14+

0 commit comments

Comments
 (0)