Skip to content

Commit cf29da0

Browse files
Merge branch 'hashicorp:main' into feature/org-tokens-api-specs
2 parents 9920ffa + 9536b62 commit cf29da0

12 files changed

Lines changed: 286 additions & 304 deletions

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Unreleased
22

3+
# Released
4+
# v0.1.5
5+
6+
* `pytfe.__version__` added in src/pytfe/init.py via importlib.metadata.version("pytfe"). This will resolve to the version from pyproject.toml.
7+
* Updated comments, sshkey, stateversion and cost-estimate models to have id as mandatory attribute by @isivaselvan [#137](https://github.com/hashicorp/python-tfe/pull/137)
8+
* Updated workspace resource to include additional relationship models include AgentPool, Configuration-version, Run, Variables and State-version by @isivaselvan [#138](https://github.com/hashicorp/python-tfe/pull/138)
9+
10+
## Bug Fixes
11+
* Run.read / Run.create fail with pydantic ValidationError when response has a `cost-estimate` and `comments` relationship.
12+
13+
# v0.1.4
14+
15+
## Enhancements
16+
* Standardize Notification Configuration option models on Pydantic [#132](https://github.com/hashicorp/python-tfe/pull/132)
17+
318
# v0.1.3
419

520
## Enhancements

examples/notification_configuration.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
"""
1111

1212
import os
13-
import sys
14-
15-
# Add the src directory to the Python path so we can import the tfe module
16-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
1713

1814
from pytfe.client import TFEClient
19-
from pytfe.models.notification_configuration import (
15+
from pytfe.models import (
2016
NotificationConfigurationCreateOptions,
2117
NotificationConfigurationListOptions,
2218
NotificationConfigurationSubscribableChoice,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "pytfe"
7-
version = "0.1.3"
7+
version = "0.1.5"
88
description = "Official Python SDK for HashiCorp Terraform Cloud / Terraform Enterprise (TFE) API v2"
99
readme = "README.md"
1010
license = { text = "MPL-2.0" }

src/pytfe/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Copyright IBM Corp. 2025, 2026
22
# SPDX-License-Identifier: MPL-2.0
33

4+
from importlib.metadata import PackageNotFoundError
5+
from importlib.metadata import version as _pkg_version
6+
47
from . import errors, models
58
from .client import TFEClient
69
from .config import TFEConfig
710

8-
__all__ = ["TFEConfig", "TFEClient", "errors", "models"]
11+
try:
12+
__version__ = _pkg_version("pytfe")
13+
except PackageNotFoundError: # running from a source checkout without install
14+
__version__ = "0.0.0+unknown"
15+
16+
__all__ = ["TFEConfig", "TFEClient", "errors", "models", "__version__"]

src/pytfe/models/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@
5959
DataRetentionPolicySetOptions,
6060
)
6161

62+
# ── Notification Configurations ───────────────────────────────────────────────
63+
from .notification_configuration import (
64+
DeliveryResponse,
65+
NotificationConfiguration,
66+
NotificationConfigurationCreateOptions,
67+
NotificationConfigurationList,
68+
NotificationConfigurationListOptions,
69+
NotificationConfigurationSubscribableChoice,
70+
NotificationConfigurationUpdateOptions,
71+
NotificationDestinationType,
72+
NotificationTriggerType,
73+
)
74+
6275
# ── OAuth ─────────────────────────────────────────────────────────────────────
6376
from .oauth_client import (
6477
OAuthClient,
@@ -385,6 +398,16 @@
385398

386399
# ── Public surface ────────────────────────────────────────────────────────────
387400
__all__ = [
401+
# Notification configurations
402+
"DeliveryResponse",
403+
"NotificationConfiguration",
404+
"NotificationConfigurationCreateOptions",
405+
"NotificationConfigurationList",
406+
"NotificationConfigurationListOptions",
407+
"NotificationConfigurationSubscribableChoice",
408+
"NotificationConfigurationUpdateOptions",
409+
"NotificationDestinationType",
410+
"NotificationTriggerType",
388411
# OAuth
389412
"OAuthClient",
390413
"OAuthClientAddProjectsOptions",

src/pytfe/models/comment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class Comment(BaseModel):
1010
model_config = ConfigDict(populate_by_name=True, validate_by_name=True)
1111

1212
id: str
13-
body: str = Field(..., alias="body")
13+
body: str = Field(default="", alias="body")

src/pytfe/models/cost_estimate.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ class CostEstimate(BaseModel):
1313
model_config = ConfigDict(populate_by_name=True, validate_by_name=True)
1414

1515
id: str
16-
delta_monthly_cost: str = Field(..., alias="delta-monthly-cost")
17-
error_message: str = Field(..., alias="error-message")
18-
matched_resources_count: int = Field(..., alias="matched-resources-count")
19-
prior_monthly_cost: str = Field(..., alias="prior-monthly-cost")
20-
proposed_monthly_cost: str = Field(..., alias="proposed-monthly-cost")
21-
resources_count: int = Field(..., alias="resources-count")
22-
status: CostEstimateStatus = Field(..., alias="status")
23-
status_timestamps: CostEstimateStatusTimestamps = Field(
24-
..., alias="status-timestamps"
16+
delta_monthly_cost: str = Field(default="", alias="delta-monthly-cost")
17+
error_message: str = Field(default="", alias="error-message")
18+
matched_resources_count: int = Field(default=0, alias="matched-resources-count")
19+
prior_monthly_cost: str = Field(default="", alias="prior-monthly-cost")
20+
proposed_monthly_cost: str = Field(default="", alias="proposed-monthly-cost")
21+
resources_count: int = Field(default=0, alias="resources-count")
22+
status: CostEstimateStatus | None = Field(default=None, alias="status")
23+
status_timestamps: CostEstimateStatusTimestamps | None = Field(
24+
default=None, alias="status-timestamps"
2525
)
26-
unmatched_resources_count: int = Field(..., alias="unmatched-resources-count")
26+
unmatched_resources_count: int = Field(default=0, alias="unmatched-resources-count")
2727

2828

2929
class CostEstimateStatus(str, Enum):

0 commit comments

Comments
 (0)