Skip to content
Merged
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Unreleased

# Released
# v0.1.5

* `pytfe.__version__` added in src/pytfe/init.py via importlib.metadata.version("pytfe"). This will resolve to the version from pyproject.toml.
* 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)
* 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)

## Bug Fixes
* Run.read / Run.create fail with pydantic ValidationError when response has a `cost-estimate` and `comments` relationship.

# v0.1.4

## Enhancements
* Standardize Notification Configuration option models on Pydantic [#132](https://github.com/hashicorp/python-tfe/pull/132)

# v0.1.3

## Enhancements
Expand Down
6 changes: 1 addition & 5 deletions examples/notification_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@
"""

import os
import sys

# Add the src directory to the Python path so we can import the tfe module
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))

from pytfe.client import TFEClient
from pytfe.models.notification_configuration import (
from pytfe.models import (
NotificationConfigurationCreateOptions,
NotificationConfigurationListOptions,
NotificationConfigurationSubscribableChoice,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "pytfe"
version = "0.1.3"
version = "0.1.5"
description = "Official Python SDK for HashiCorp Terraform Cloud / Terraform Enterprise (TFE) API v2"
readme = "README.md"
license = { text = "MPL-2.0" }
Expand Down
10 changes: 9 additions & 1 deletion src/pytfe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Copyright IBM Corp. 2025, 2026
# SPDX-License-Identifier: MPL-2.0

from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as _pkg_version

from . import errors, models
from .client import TFEClient
from .config import TFEConfig

__all__ = ["TFEConfig", "TFEClient", "errors", "models"]
try:
__version__ = _pkg_version("pytfe")
except PackageNotFoundError: # running from a source checkout without install
__version__ = "0.0.0+unknown"

__all__ = ["TFEConfig", "TFEClient", "errors", "models", "__version__"]
23 changes: 23 additions & 0 deletions src/pytfe/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@
DataRetentionPolicySetOptions,
)

# ── Notification Configurations ───────────────────────────────────────────────
from .notification_configuration import (
DeliveryResponse,
NotificationConfiguration,
NotificationConfigurationCreateOptions,
NotificationConfigurationList,
NotificationConfigurationListOptions,
NotificationConfigurationSubscribableChoice,
NotificationConfigurationUpdateOptions,
NotificationDestinationType,
NotificationTriggerType,
)

# ── OAuth ─────────────────────────────────────────────────────────────────────
from .oauth_client import (
OAuthClient,
Expand Down Expand Up @@ -376,6 +389,16 @@

# ── Public surface ────────────────────────────────────────────────────────────
__all__ = [
# Notification configurations
"DeliveryResponse",
"NotificationConfiguration",
"NotificationConfigurationCreateOptions",
"NotificationConfigurationList",
"NotificationConfigurationListOptions",
"NotificationConfigurationSubscribableChoice",
"NotificationConfigurationUpdateOptions",
"NotificationDestinationType",
"NotificationTriggerType",
# OAuth
"OAuthClient",
"OAuthClientAddProjectsOptions",
Expand Down
2 changes: 1 addition & 1 deletion src/pytfe/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class Comment(BaseModel):
model_config = ConfigDict(populate_by_name=True, validate_by_name=True)

id: str
body: str = Field(..., alias="body")
body: str = Field(default="", alias="body")
20 changes: 10 additions & 10 deletions src/pytfe/models/cost_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ class CostEstimate(BaseModel):
model_config = ConfigDict(populate_by_name=True, validate_by_name=True)

id: str
delta_monthly_cost: str = Field(..., alias="delta-monthly-cost")
error_message: str = Field(..., alias="error-message")
matched_resources_count: int = Field(..., alias="matched-resources-count")
prior_monthly_cost: str = Field(..., alias="prior-monthly-cost")
proposed_monthly_cost: str = Field(..., alias="proposed-monthly-cost")
resources_count: int = Field(..., alias="resources-count")
status: CostEstimateStatus = Field(..., alias="status")
status_timestamps: CostEstimateStatusTimestamps = Field(
..., alias="status-timestamps"
delta_monthly_cost: str = Field(default="", alias="delta-monthly-cost")
error_message: str = Field(default="", alias="error-message")
matched_resources_count: int = Field(default=0, alias="matched-resources-count")
prior_monthly_cost: str = Field(default="", alias="prior-monthly-cost")
proposed_monthly_cost: str = Field(default="", alias="proposed-monthly-cost")
resources_count: int = Field(default=0, alias="resources-count")
status: CostEstimateStatus | None = Field(default=None, alias="status")
status_timestamps: CostEstimateStatusTimestamps | None = Field(
default=None, alias="status-timestamps"
)
unmatched_resources_count: int = Field(..., alias="unmatched-resources-count")
unmatched_resources_count: int = Field(default=0, alias="unmatched-resources-count")


class CostEstimateStatus(str, Enum):
Expand Down
Loading
Loading