Skip to content

Getting package version from file when building packages#261

Merged
rodrigobr-msft merged 4 commits intomainfrom
users/robrandao/package-version
Nov 26, 2025
Merged

Getting package version from file when building packages#261
rodrigobr-msft merged 4 commits intomainfrom
users/robrandao/package-version

Conversation

@rodrigobr-msft
Copy link
Contributor

@rodrigobr-msft rodrigobr-msft commented Nov 26, 2025

This pull request updates the versioning mechanism for all Python libraries in the libraries/ directory. Instead of relying solely on an environment variable for the package version, the build process now writes the version to a VERSION.txt file in each library, and the setup.py scripts are updated to read the version from this file if it exists. This ensures consistent and explicit versioning across all packages during the build process.

Build process changes:

  • The CI pipeline (.azdo/ci-pr.yaml) now writes the current package version to a VERSION.txt file in each library directory before building the packages.

Library setup changes (applied to all libraries):

  • Each setup.py script is updated to first attempt to read the package version from a VERSION.txt file; if the file does not exist, it falls back to the PackageVersion environment variable. This change is applied to the following libraries:
    • microsoft-agents-activity
    • microsoft-agents-authentication-msal
    • microsoft-agents-copilotstudio-client
    • microsoft-agents-hosting-aiohttp
    • microsoft-agents-hosting-core
    • microsoft-agents-hosting-fastapi
    • microsoft-agents-hosting-teams
    • microsoft-agents-storage-blob
    • microsoft-agents-storage-cosmos

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a version management system that reads package version from VERSION.txt files with a fallback to environment variables. The changes enable more flexible versioning during build processes by allowing version information to be persisted in files rather than relying solely on environment variables.

Key Changes:

  • Updated setup.py files across all library packages to read version from VERSION.txt file first, then fall back to the PackageVersion environment variable
  • Added setuptools-scm dependency to the microsoft-agents-activity package's build requirements
  • Modified CI/CD pipeline to write version information to VERSION.txt files before building packages

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
libraries/microsoft-agents-storage-cosmos/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-storage-blob/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-hosting-fastapi/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-hosting-core/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-hosting-aiohttp/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-copilotstudio-client/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-authentication-msal/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-activity/setup.py Added version file reading logic with environment variable fallback
libraries/microsoft-agents-activity/pyproject.toml Added setuptools-scm dependency to build system requirements
.azdo/ci-pr.yaml Added script to write PackageVersion to VERSION.txt files before package building
Comments suppressed due to low confidence (8)

libraries/microsoft-agents-hosting-core/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

libraries/microsoft-agents-activity/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

libraries/microsoft-agents-storage-blob/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

libraries/microsoft-agents-storage-cosmos/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

libraries/microsoft-agents-copilotstudio-client/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

libraries/microsoft-agents-hosting-fastapi/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

libraries/microsoft-agents-authentication-msal/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

libraries/microsoft-agents-hosting-aiohttp/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rodrigobr-msft rodrigobr-msft marked this pull request as ready for review November 26, 2025 22:33
@rodrigobr-msft rodrigobr-msft requested a review from a team as a code owner November 26, 2025 22:33
Copilot AI review requested due to automatic review settings November 26, 2025 22:33
@rodrigobr-msft rodrigobr-msft changed the title Writing version to file and reading it when building Getting package version from file when building packages Nov 26, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (1)

libraries/microsoft-agents-activity/setup.py:5

  • This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
    This assignment to 'package_version' is unnecessary as it is redefined before this value is used.
package_version = "0.0.0"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rodrigobr-msft rodrigobr-msft merged commit de0083f into main Nov 26, 2025
10 checks passed
@rodrigobr-msft rodrigobr-msft deleted the users/robrandao/package-version branch November 26, 2025 23:14
rodrigobr-msft added a commit that referenced this pull request Dec 1, 2025
* Writing version to file and reading it when building

* Fixing issue

* Removed unnecessary declaration

* Specifying encoding
rodrigobr-msft added a commit that referenced this pull request Dec 1, 2025
* Getting package version from file when building packages (#261)

* Writing version to file and reading it when building

* Fixing issue

* Removed unnecessary declaration

* Specifying encoding

* Adding MANIFEST.in file to include package version files in builds (#263)

* Writing version to file and reading it when building

* Fixing issue

* Removed unnecessary declaration

* Specifying encoding

* Adding MANIFEST.in files to include VERSION.txt

* Fixing _sign_in_state serialization/deserialization (#264)

* Fixing _sign_in_state (de)serialization

* Reformatting

---------

Co-authored-by: Chris Mullins <cleemullins@users.noreply.github.com>

---------

Co-authored-by: Chris Mullins <cleemullins@users.noreply.github.com>
Copilot AI mentioned this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source distribution build fails due to missing PackageVersion environment variable

2 participants

Comments