Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
"opentelemetry-exporter-otlp >= 1.36.0",
"pydantic >= 2.0.0",
"typing-extensions >= 4.0.0",
"microsoft-agents-a365-runtime >= 0.1.0"
"microsoft-agents-a365-runtime >= 0.1.0.dev0"
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
license = "MIT"
keywords = ["observability", "telemetry", "tracing", "opentelemetry", "agent-framework", "agents", "ai"]
dependencies = [
"microsoft-agents-a365-observability-core >= 0.1.0",
"microsoft-agents-a365-observability-core >= 0.1.0.dev0",
"opentelemetry-api >= 1.36.0",
"opentelemetry-sdk >= 1.36.0",
"opentelemetry-instrumentation >= 0.47b0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
license = {text = "MIT"}
keywords = ["observability", "telemetry", "tracing", "opentelemetry", "langchain", "agents", "ai"]
dependencies = [
"microsoft-agents-a365-observability-core >= 0.1.0",
"microsoft-agents-a365-observability-core >= 0.1.0.dev0",
"langchain >= 0.1.0",
"langchain-core >= 0.1.0",
"opentelemetry-api >= 1.36.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
license = {text = "MIT"}
keywords = ["observability", "telemetry", "tracing", "opentelemetry", "openai", "agents", "ai"]
dependencies = [
"microsoft-agents-a365-observability-core >= 0.1.0",
"microsoft-agents-a365-observability-core >= 0.1.0.dev0",
"openai-agents >= 0.2.6",
"opentelemetry-api >= 1.36.0",
"opentelemetry-sdk >= 1.36.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ classifiers = [
]
license = {text = "MIT"}
keywords = ["observability", "telemetry", "tracing", "opentelemetry", "semantic-kernel", "agents", "ai"]
# Note: Internal package versions (microsoft-agents-a365-*) are automatically set at build time
# The placeholder below will be replaced with >= {current_version} by setup.py
dependencies = [
"microsoft-agents-a365-observability-core >= 0.1.0",
"microsoft-agents-a365-observability-core >= 0.0.0",
Comment thread
rahuldevikar761 marked this conversation as resolved.
"semantic-kernel >= 1.0.0",
"opentelemetry-api >= 1.36.0",
"opentelemetry-sdk >= 1.36.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import sys
from pathlib import Path
from os import environ
from setuptools import setup

# 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")

# Add versioning helper to path
helper_path = Path(__file__).parent.parent.parent / "versioning" / "helper"
Comment thread
rahuldevikar761 marked this conversation as resolved.
sys.path.insert(0, str(helper_path))

from setup_utils import get_dynamic_dependencies

# Use minimum version strategy:
# - Internal packages get: >= current_base_version (e.g., >= 0.1.0)
# - Automatically updates when you build new versions
# - Consumers can upgrade to any higher version
setup(
version=package_version,
install_requires=get_dynamic_dependencies(
use_compatible_release=False, # No upper bound
use_exact_match=False, # Not exact match
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
license = {text = "MIT"}
dependencies = [
"microsoft-agents-a365-tooling >= 0.1.0",
"microsoft-agents-a365-tooling >= 0.1.0.dev0",
"microsoft-agents-hosting-core >= 0.4.0, < 0.6.0",
"agent-framework-azure-ai >= 0.1.0",
"azure-identity >= 1.12.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
license = {text = "MIT"}
dependencies = [
"microsoft-agents-a365-tooling >= 0.1.0",
"microsoft-agents-a365-tooling >= 0.1.0.dev0",
"azure-ai-projects >= 1.0.0",
"azure-ai-agents >= 1.0.0b251001",
"azure-identity >= 1.12.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
license = {text = "MIT"}
dependencies = [
"microsoft-agents-a365-tooling >= 0.1.0",
"microsoft-agents-a365-tooling >= 0.1.0.dev0",
"openai-agents",
"asyncio-throttle",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
license = {text = "MIT"}
dependencies = [
"microsoft-agents-a365-tooling >= 0.1.0",
"microsoft-agents-a365-tooling >= 0.1.0.dev0",
"semantic-kernel >= 1.0.0",
"aiohttp >= 3.8.0",
]
Expand Down
108 changes: 108 additions & 0 deletions versioning/helper/setup_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""
Shared utilities for setup.py files across all Agent365 Python SDK packages.

This module provides helper functions to dynamically set internal package versions
at build time, ensuring all packages in the monorepo use the exact same version.
"""

from os import environ
from typing import List


def get_package_version() -> str:
"""
Get the package version from environment variable.

Returns:
The version string from AGENT365_PYTHON_SDK_PACKAGE_VERSION environment variable,
or "0.0.0" if not set.
"""
return environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")


def get_dynamic_dependencies(
pyproject_path: str = "pyproject.toml",
use_exact_match: bool = False,
use_compatible_release: bool = False,
) -> List[str]:
"""
Read dependencies from pyproject.toml and update internal package versions.

Internal packages (microsoft-agents-a365-*) can use different versioning strategies:

1. Minimum version (default, recommended):
>= base_version
Example: >= 0.1.0
- Maximum flexibility for consumers

2. Compatible release:
>= base_version, < next_major_version
Example: >= 0.1.0, < 0.2.0
- Allows updates within major version

3. Exact match:
== current_version
Comment thread
rahuldevikar761 marked this conversation as resolved.
Example: == 0.1.0.dev5
- Forces exact version match

External packages keep their original version constraints.

Args:
pyproject_path: Path to the pyproject.toml file (default: "pyproject.toml")
use_exact_match: If True, use == for internal packages
use_compatible_release: If True, use >= with < upper bound

Returns:
List of dependency strings with updated internal package versions
"""
package_version = get_package_version()

# Extract base version (remove dev/pre-release suffixes)
base_version = package_version.split(".dev")[0].split("a")[0].split("b")[0].split("rc")[0]
Comment thread
rahuldevikar761 marked this conversation as resolved.
Outdated

try:
import tomllib # Python 3.11+
except ImportError:
import tomli as tomllib # Fallback for older Python

Comment thread
rahuldevikar761 marked this conversation as resolved.
Outdated
with open(pyproject_path, "rb") as f:
pyproject = tomllib.load(f)

Comment thread
rahuldevikar761 marked this conversation as resolved.
Outdated
dependencies = pyproject.get("project", {}).get("dependencies", [])

# Update internal package versions dynamically
updated_dependencies = []
for dep in dependencies:
if dep.startswith("microsoft-agents-a365-"):
# Extract package name (everything before >=, ==, or other operators)
pkg_name = dep.split(">=")[0].split("==")[0].split("<")[0].strip()
Comment thread
rahuldevikar761 marked this conversation as resolved.
Comment thread
rahuldevikar761 marked this conversation as resolved.

if use_exact_match:
# Exact match: == current_version
updated_dependencies.append(f"{pkg_name} == {package_version}")
elif use_compatible_release:
# Compatible release: >= base_version, < next_major
parts = base_version.split(".")
if len(parts) >= 3:
major = int(parts[0])
if major == 0:
# For 0.x.y, increment minor (0.1.0 -> 0.2.0)
minor = int(parts[1])
next_major = f"{major}.{minor + 1}.0"
else:
# For x.y.z where x > 0, increment major (1.2.3 -> 2.0.0)
next_major = f"{major + 1}.0.0"
Comment thread
rahuldevikar761 marked this conversation as resolved.
Outdated
else:
next_major = base_version
updated_dependencies.append(f"{pkg_name} >= {base_version}, < {next_major}")
else:
# Minimum version (default): >= base_version
updated_dependencies.append(f"{pkg_name} >= {base_version}")
Comment thread
rahuldevikar761 marked this conversation as resolved.
else:
# Keep external dependencies as-is
updated_dependencies.append(dep)

return updated_dependencies
Loading