diff --git a/.azdo/ci-pr.yaml b/.azdo/ci-pr.yaml index f1b1f10a..01189e5c 100644 --- a/.azdo/ci-pr.yaml +++ b/.azdo/ci-pr.yaml @@ -14,6 +14,10 @@ strategy: Python_3.11: PYTHON_VERSION: '3.11' +variables: + - name: PackageVersion + value: '' + steps: - task: UsePythonVersion@0 inputs: @@ -22,7 +26,7 @@ steps: - script: | python -m pip install --upgrade pip - python -m pip install flake8 pytest black pytest-asyncio build + python -m pip install flake8 pytest black pytest-asyncio build setuptools-git-versioning if [ -f requirements.txt ]; then pip install -r requirements.txt; fi displayName: 'Install dependencies' @@ -34,6 +38,13 @@ steps: flake8 . --count --exit-zero --show-source --statistics displayName: 'Lint with flake8' +- script: | + PACKAGE_VERSION=$(pwsh -File replace-version.ps1) + echo "##vso[task.setvariable variable=PackageVersion]$PACKAGE_VERSION" + echo "Package version set to: $PACKAGE_VERSION" + displayName: 'Set package version' + condition: eq(variables['PackageVersion'], '') + - script: | mkdir -p dist for dir in libraries/*; do @@ -41,7 +52,9 @@ steps: (cd "$dir" && python -m build --outdir ../../dist) fi done - displayName: 'Build packages' + env: + PackageVersion: $(PackageVersion) + displayName: 'Set Version and Build packages' - script: | python -m pip install ./dist/microsoft_agents_activity*.whl diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 93898f71..f50d8d14 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -30,7 +30,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest black pytest-asyncio build + python -m pip install flake8 pytest black pytest-asyncio build setuptools-git-versioning if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Check format with black run: | @@ -40,6 +40,12 @@ jobs: run: | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --show-source --statistics + - name: Set package version + run: | + cd ./versioning + version=$(setuptools-git-versioning) + echo "PackageVersion=$version" >> $GITHUB_ENV + echo "Package version set to: $version" - name: Build packages run: | mkdir -p dist diff --git a/libraries/microsoft-agents-activity/pyproject.toml b/libraries/microsoft-agents-activity/pyproject.toml index e5bc74e5..2369332e 100644 --- a/libraries/microsoft-agents-activity/pyproject.toml +++ b/libraries/microsoft-agents-activity/pyproject.toml @@ -1,11 +1,11 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=64"] build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-activity" -version = "0.0.0a1" -description = "Activity schema library for Microsoft Agents" +dynamic = ["version"] +description = "A protocol library for Microsoft Agents" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" classifiers = [ diff --git a/libraries/microsoft-agents-activity/setup.py b/libraries/microsoft-agents-activity/setup.py new file mode 100644 index 00000000..9b6de9af --- /dev/null +++ b/libraries/microsoft-agents-activity/setup.py @@ -0,0 +1,8 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, +) diff --git a/libraries/microsoft-agents-authentication-msal/pyproject.toml b/libraries/microsoft-agents-authentication-msal/pyproject.toml index e04f099b..40bf4054 100644 --- a/libraries/microsoft-agents-authentication-msal/pyproject.toml +++ b/libraries/microsoft-agents-authentication-msal/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=64"] build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-authentication-msal" -version = "0.0.0a1" +dynamic = ["version", "dependencies"] description = "A msal-based authentication library for Microsoft Agents" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" @@ -13,12 +13,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = [ - "microsoft-agents-hosting-core", - "msal>=1.31.1", - "requests>=2.32.3", - "cryptography>=44.0.0", -] [project.urls] "Homepage" = "https://github.com/microsoft/Agents" diff --git a/libraries/microsoft-agents-authentication-msal/setup.py b/libraries/microsoft-agents-authentication-msal/setup.py new file mode 100644 index 00000000..67315bcf --- /dev/null +++ b/libraries/microsoft-agents-authentication-msal/setup.py @@ -0,0 +1,14 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, + install_requires=[ + f"microsoft-agents-hosting-core=={package_version}", + "msal>=1.31.1", + "requests>=2.32.3", + "cryptography>=44.0.0", + ], +) diff --git a/libraries/microsoft-agents-copilotstudio-client/pyproject.toml b/libraries/microsoft-agents-copilotstudio-client/pyproject.toml index acf4ae81..4f08f714 100644 --- a/libraries/microsoft-agents-copilotstudio-client/pyproject.toml +++ b/libraries/microsoft-agents-copilotstudio-client/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-copilotstudio-client" -version = "0.0.0a1" +dynamic = ["version", "dependencies"] description = "A client library for Microsoft Agents" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" @@ -13,9 +13,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = [ - "microsoft-agents-hosting-core", -] [project.urls] "Homepage" = "https://github.com/microsoft/Agents" diff --git a/libraries/microsoft-agents-copilotstudio-client/setup.py b/libraries/microsoft-agents-copilotstudio-client/setup.py new file mode 100644 index 00000000..41a7da0d --- /dev/null +++ b/libraries/microsoft-agents-copilotstudio-client/setup.py @@ -0,0 +1,11 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, + install_requires=[ + f"microsoft-agents-hosting-core=={package_version}", + ], +) diff --git a/libraries/microsoft-agents-hosting-aiohttp/pyproject.toml b/libraries/microsoft-agents-hosting-aiohttp/pyproject.toml index f443b7c8..7b93ca9e 100644 --- a/libraries/microsoft-agents-hosting-aiohttp/pyproject.toml +++ b/libraries/microsoft-agents-hosting-aiohttp/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-hosting-aiohttp" -version = "0.0.0a1" +dynamic = ["version", "dependencies"] description = "Integration library for Microsoft Agents with aiohttp" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" @@ -13,10 +13,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = [ - "microsoft-agents-hosting-core", - "aiohttp>=3.11.11", -] [project.urls] "Homepage" = "https://github.com/microsoft/Agents" diff --git a/libraries/microsoft-agents-hosting-aiohttp/setup.py b/libraries/microsoft-agents-hosting-aiohttp/setup.py new file mode 100644 index 00000000..426735ba --- /dev/null +++ b/libraries/microsoft-agents-hosting-aiohttp/setup.py @@ -0,0 +1,12 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, + install_requires=[ + f"microsoft-agents-hosting-core=={package_version}", + "aiohttp>=3.11.11", + ], +) diff --git a/libraries/microsoft-agents-hosting-core/pyproject.toml b/libraries/microsoft-agents-hosting-core/pyproject.toml index d98fc2f3..ba13b835 100644 --- a/libraries/microsoft-agents-hosting-core/pyproject.toml +++ b/libraries/microsoft-agents-hosting-core/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-hosting-core" -version = "0.0.0a1" +dynamic = ["version", "dependencies"] description = "Core library for Microsoft Agents" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" @@ -13,13 +13,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = [ - "pyjwt>=2.10.1", - "isodate>=0.6.1", - "azure-core>=1.30.0", - "microsoft-agents-activity", - "python-dotenv>=1.1.1", -] [project.urls] "Homepage" = "https://github.com/microsoft/Agents" diff --git a/libraries/microsoft-agents-hosting-core/setup.py b/libraries/microsoft-agents-hosting-core/setup.py new file mode 100644 index 00000000..e7604116 --- /dev/null +++ b/libraries/microsoft-agents-hosting-core/setup.py @@ -0,0 +1,15 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, + install_requires=[ + f"microsoft-agents-activity=={package_version}", + "pyjwt>=2.10.1", + "isodate>=0.6.1", + "azure-core>=1.30.0", + "python-dotenv>=1.1.1", + ], +) diff --git a/libraries/microsoft-agents-hosting-teams/pyproject.toml b/libraries/microsoft-agents-hosting-teams/pyproject.toml index 49b00df0..5009cf7b 100644 --- a/libraries/microsoft-agents-hosting-teams/pyproject.toml +++ b/libraries/microsoft-agents-hosting-teams/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-hosting-teams" -version = "0.0.0a1" +dynamic = ["version", "dependencies"] description = "Integration library for Microsoft Agents with Teams" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" @@ -13,10 +13,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = [ - "microsoft-agents-hosting-core", - "aiohttp>=3.11.11", -] [project.urls] "Homepage" = "https://github.com/microsoft/Agents" diff --git a/libraries/microsoft-agents-hosting-teams/setup.py b/libraries/microsoft-agents-hosting-teams/setup.py new file mode 100644 index 00000000..426735ba --- /dev/null +++ b/libraries/microsoft-agents-hosting-teams/setup.py @@ -0,0 +1,12 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, + install_requires=[ + f"microsoft-agents-hosting-core=={package_version}", + "aiohttp>=3.11.11", + ], +) diff --git a/libraries/microsoft-agents-storage-blob/pyproject.toml b/libraries/microsoft-agents-storage-blob/pyproject.toml index 93d88e14..efac60ec 100644 --- a/libraries/microsoft-agents-storage-blob/pyproject.toml +++ b/libraries/microsoft-agents-storage-blob/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-storage-blob" -version = "0.0.0a1" +dynamic = ["version", "dependencies"] description = "A blob storage library for Microsoft Agents" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" @@ -13,11 +13,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = [ - "microsoft-agents-hosting-core", - "azure-core", - "azure-storage-blob", -] [project.urls] "Homepage" = "https://github.com/microsoft/Agents" diff --git a/libraries/microsoft-agents-storage-blob/setup.py b/libraries/microsoft-agents-storage-blob/setup.py new file mode 100644 index 00000000..d38c25bb --- /dev/null +++ b/libraries/microsoft-agents-storage-blob/setup.py @@ -0,0 +1,13 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, + install_requires=[ + f"microsoft-agents-hosting-core=={package_version}", + "azure-core", + "azure-storage-blob", + ], +) diff --git a/libraries/microsoft-agents-storage-cosmos/pyproject.toml b/libraries/microsoft-agents-storage-cosmos/pyproject.toml index 611d6e46..59d22815 100644 --- a/libraries/microsoft-agents-storage-cosmos/pyproject.toml +++ b/libraries/microsoft-agents-storage-cosmos/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "microsoft-agents-storage-cosmos" -version = "0.0.0a1" +dynamic = ["version", "dependencies"] description = "A Cosmos DB storage library for Microsoft Agents" authors = [{name = "Microsoft Corporation"}] requires-python = ">=3.9" @@ -13,11 +13,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = [ - "microsoft-agents-hosting-core", - "azure-core", - "azure-cosmos", -] [project.urls] "Homepage" = "https://github.com/microsoft/Agents" diff --git a/libraries/microsoft-agents-storage-cosmos/setup.py b/libraries/microsoft-agents-storage-cosmos/setup.py new file mode 100644 index 00000000..8f09a0d2 --- /dev/null +++ b/libraries/microsoft-agents-storage-cosmos/setup.py @@ -0,0 +1,13 @@ +from os import environ +from setuptools import setup + +package_version = environ.get("PackageVersion", "0.0.0") + +setup( + version=package_version, + install_requires=[ + f"microsoft-agents-hosting-core=={package_version}", + "azure-core", + "azure-cosmos", + ], +) diff --git a/replace-version.ps1 b/replace-version.ps1 new file mode 100644 index 00000000..fd4f0f70 --- /dev/null +++ b/replace-version.ps1 @@ -0,0 +1,3 @@ +cd ./versioning +$ActualVersion = & { setuptools-git-versioning } +Write-Output $ActualVersion \ No newline at end of file diff --git a/versioning/TARGET-VERSION b/versioning/TARGET-VERSION new file mode 100644 index 00000000..98bb2cd0 --- /dev/null +++ b/versioning/TARGET-VERSION @@ -0,0 +1 @@ +0.1. \ No newline at end of file diff --git a/versioning/helper/__init__.py b/versioning/helper/__init__.py new file mode 100644 index 00000000..b08ea678 --- /dev/null +++ b/versioning/helper/__init__.py @@ -0,0 +1,3 @@ +from .versioning import get_version + +__all__ = ["get_version"] \ No newline at end of file diff --git a/versioning/helper/versioning.py b/versioning/helper/versioning.py new file mode 100644 index 00000000..f2f25aa1 --- /dev/null +++ b/versioning/helper/versioning.py @@ -0,0 +1,2 @@ +def get_version(): + return "0.0.0a1" \ No newline at end of file diff --git a/versioning/pyproject.toml b/versioning/pyproject.toml new file mode 100644 index 00000000..b14bf015 --- /dev/null +++ b/versioning/pyproject.toml @@ -0,0 +1,17 @@ +[build-system] +requires = ["setuptools>=41", "wheel", "setuptools-git-versioning>=2.0,<3", ] +build-backend = "setuptools.build_meta" + +[tool.setuptools-git-versioning] +enabled = true +version_file = "TARGET-VERSION" +count_commits_from_version_file = true +dev_template = "{tag}{ccount}" +dirty_template = "{tag}{ccount}" + +[project] +name = "helper" +dynamic = ["version"] +description = "Helper project to calculate version" +authors = [{name = "Microsoft Corporation"}] +requires-python = ">=3.9"