Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions packages/a2aprotocol/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ external = true


[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
6 changes: 4 additions & 2 deletions packages/ai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ dependencies = [
]

[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
6 changes: 4 additions & 2 deletions packages/api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ dependencies = [
Homepage = "https://github.com/microsoft/teams.py/tree/main/packages/api/src/microsoft/teams/api"

[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[dependency-groups]
dev = [
Expand Down
6 changes: 4 additions & 2 deletions packages/apps/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ test = [
]

[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
6 changes: 4 additions & 2 deletions packages/botbuilder/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ Homepage = "https://github.com/microsoft/teams.py/tree/main/packages/botbuilder/


[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
4 changes: 2 additions & 2 deletions packages/cards/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ dev = [
Homepage = "https://github.com/microsoft/teams.py/tree/main/packages/cards/src/microsoft/teams/cards"

[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
4 changes: 2 additions & 2 deletions packages/common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Homepage = "https://github.com/microsoft/teams.py/tree/main/packages/common/src/


[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
6 changes: 4 additions & 2 deletions packages/devtools/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ Homepage = "https://github.com/microsoft/teams.py/tree/main/packages/devtools/sr


[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
6 changes: 4 additions & 2 deletions packages/graph/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ testpaths = ["tests"]
python_paths = ["src"]

[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
6 changes: 4 additions & 2 deletions packages/mcpplugin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ dependencies = [
external = true

[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
6 changes: 4 additions & 2 deletions packages/openai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ dependencies = [
]

[build-system]
requires = ["hatchling", "hatch-nbgv"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "nbgv-fallback"
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams", "src/microsoft"]
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"microsoft-teams-mcpplugin" = { workspace = true }
"microsoft-teams-a2a" = { workspace = true }
"microsoft-teams-botbuilder" = { workspace = true }
"hatch-nbgv" = { path = "tools/hatch-nbgv" }
"hatch-teams-build" = { path = "tools/hatch-teams-build" }

[tool.uv.workspace]
members = ["packages/*", "examples/*"]
Expand All @@ -31,7 +31,7 @@ dev = [
"pytest-cov>=6.0.0",
]
release = [
"hatch-nbgv",
"hatch-teams-build",
]

[tool.ruff]
Expand All @@ -55,6 +55,7 @@ select = ["E", "F", "W", "B", "Q", "I", "ASYNC"]

[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["packages"]

[tool.poe.tasks]
fmt = "ruff format"
Expand Down
1 change: 0 additions & 1 deletion templates/package/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"pypi_package_name": "subpackage-name",
"project_short_description": "project description",
"version": "0.0.1-alpha.1",
"core": true,
"__prompts__": {
"core": "Core package? (I.e. not an external integration?)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "{{cookiecutter.pypi_package_name}}"
version = "{{cookiecutter.version}}"
dynamic = ["version"]
description = "{{cookiecutter.project_short_description}}"
authors = [{ name = "Microsoft", email = "TeamsAISDKFeedback@microsoft.com" }]
readme = "README.md"
Expand All @@ -15,9 +15,14 @@ external = true
{% endif %}

[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]

[tool.hatch.build.targets.wheel]
packages = ["src/microsoft_teams"]

Expand Down
8 changes: 0 additions & 8 deletions tools/hatch-nbgv/src/hatch_nbgv/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions tools/hatch-nbgv/src/hatch_nbgv/hooks.py

This file was deleted.

46 changes: 46 additions & 0 deletions tools/hatch-teams-build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# hatch-teams-build

Hatchling plugin for the Teams Python SDK. Provides two build-time hooks:

## Version Source (`teams-build`)

Wraps [nbgv-python](https://pypi.org/project/nbgv-python/) to resolve package versions from git history via [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning). Falls back to `0.0.0` when the `nbgv` CLI is not installed, so local development works without .NET SDK. Set `NBGV_REQUIRED=1` to make the missing CLI a hard error (used in CI).

```toml
[tool.hatch.version]
source = "teams-build"
```

## Metadata Hook (`teams-build`)

Rewrites bare `microsoft-teams-*` dependencies to include `>=<current_version>` at build time. This ensures published wheels enforce compatible sibling package versions.

```toml
[tool.hatch.metadata.hooks.teams-build]
```

**Example:** if the current nbgv version is `2.0.0a49`, a dependency listed as `microsoft-teams-common` becomes `microsoft-teams-common>=2.0.0a49` in the built wheel metadata.

When nbgv is unavailable (fallback `0.0.0`), the hook skips rewriting entirely — dependencies stay bare, which is correct for local development where UV workspace resolution handles everything.

## Usage

Each package pyproject.toml needs:

```toml
[build-system]
requires = ["hatchling", "hatch-teams-build"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "teams-build"

[tool.hatch.metadata.hooks.teams-build]
```

## Verification

```bash
uv build packages/apps --sdist
# Inspect PKG-INFO — workspace deps should show >=<version>
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "hatch-nbgv"
name = "hatch-teams-build"
version = "0.1.0"
description = "Hatchling version source plugin wrapping nbgv-python with graceful fallback"
description = "Hatchling plugin for Teams SDK: nbgv version source with graceful fallback and workspace dependency versioning"
authors = [{ name = "Microsoft", email = "TeamsAISDKFeedback@microsoft.com" }]
requires-python = ">=3.12"
license = "MIT"
Expand All @@ -12,10 +12,10 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[project.entry-points.hatch]
hatch-nbgv = "hatch_nbgv.hooks"
hatch-teams-build = "hatch_teams_build.hooks"

[tool.hatch.build.targets.wheel]
packages = ["src/hatch_nbgv"]
packages = ["src/hatch_teams_build"]

[tool.hatch.build.targets.sdist]
include = ["src"]
9 changes: 9 additions & 0 deletions tools/hatch-teams-build/src/hatch_teams_build/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
"""

from hatch_teams_build.metadata_hook import TeamsBuildMetadataHook
from hatch_teams_build.version_source import TeamsBuildVersionSource

__all__ = ["TeamsBuildMetadataHook", "TeamsBuildVersionSource"]
19 changes: 19 additions & 0 deletions tools/hatch-teams-build/src/hatch_teams_build/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
"""

from hatchling.plugin import hookimpl

from hatch_teams_build.metadata_hook import TeamsBuildMetadataHook
from hatch_teams_build.version_source import TeamsBuildVersionSource


@hookimpl
def hatch_register_version_source():
return TeamsBuildVersionSource


@hookimpl
def hatch_register_metadata_hook():
return TeamsBuildMetadataHook
Loading
Loading