| Name | pytfe JSON |
| Version |
0.1.0
JSON |
| download |
| home_page | None |
| Summary | Official Python SDK for HashiCorp Terraform Cloud / Terraform Enterprise (TFE) API v2 |
| upload_time | 2025-10-28 10:19:07 |
| maintainer | None |
| docs_url | None |
| author | HashiCorp |
| requires_python | >=3.10 |
| license | MPL-2.0 |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# HCP Terraform and Terraform Enterprise **Python** Client (pyTFE)
[](https://pypi.org/project/pytfe/)
[](https://pypi.org/project/pytfe/)
[](https://github.com/hashicorp/python-tfe/actions/workflows/test.yml)
[](./LICENSE)
[](https://github.com/hashicorp/python-tfe/issues)
The official **Python** API client for [HCP Terraform and Terraform Enterprise](https://www.hashicorp.com/products/terraform).
This client targets the [HCP Terraform V2 API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs).
As Terraform Enterprise is the self-hosted distribution of HCP Terraform, this client supports both **HCP Terraform** and **Terraform Enterprise** use cases. In this repository and API, we refer to the platform generically as *Terraform Enterprise* unless a feature is explicitly called out as only supported in one or the other (rare).
## Version Information
We follow Semantic Versioning. During the initial alpha period we use `0.y.z`:
- **Minor** (`0.y.z → 0.(y+1).z`): new, backwards-compatible features and enhancements.
- **Patch** (`0.y.z → 0.y.(z+1)`): bug fixes and performance improvements.
- Occasionally, a function signature change that fixes incorrect behavior may appear in a minor version.
## Example Usage
Construct a new **pyTFE** client, then use the resource services on the client to access different parts of the Terraform Enterprise API. The following example lists all organizations.
### (Recommended) Using explicit config
```python
from pytfe import TFEClient, TFEConfig
config = TFEConfig(
host="https://tfe.local",
token="insert-your-token-here",
retry_server_errors=True,
timeout=30.0,
user_agent="example-app/0.1 pytfe/0.1",
)
client = TFEClient(config)
orgs = client.organizations.list()
for org in orgs.items:
print(org.name)
```
### Using the default config with environment variables
The default configuration reads the `TFE_ADDRESS` and `TFE_TOKEN` environment variables.
1. `TFE_ADDRESS` — URL of an HCP Terraform or Terraform Enterprise instance. Example: `https://tfe.local`
2. `TFE_TOKEN` — An [API token](https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/api-tokens) for the HCP Terraform or Terraform Enterprise instance.
Environment variables are used as a fallback when `host` or `token` are not provided explicitly:
#### Using the default configuration
```python
from pytfe import TFEClient, TFEConfig
# Equivalent to providing no values; falls back to env vars if set.
client = TFEClient(TFEConfig())
orgs = client.organizations.list()
for org in orgs.items:
print(org.name)
```
#### When host or token is empty
```python
from pytfe import TFEClient, TFEConfig
config = TFEConfig(address="", token="")
client = TFEClient(config)
orgs = client.organizations.list()
for org in orgs.items:
print(org.name)
```
## Documentation
- API reference and guides (SDK): **coming soon**
- Terraform Enterprise API: https://developer.hashicorp.com/terraform/enterprise/api-docs
## Examples
See the [`examples/`](./examples) directory for runnable snippets covering common workflows (workspaces, variables, configuration versions, runs/plans/applies, state, agents).
## Running tests
See [`TESTS.md`](./docs/TESTS.md). Typical flow:
```bash
pip install -e .[dev]
make test
```
## Issues and Contributing
See [`CONTRIBUTING.md`](./docs/CONTRIBUTING.md). We welcome issues and pull requests.
## Releases
See [`RELEASES.md`](./docs/RELEASES.md).
## License
This project is licensed under the **MPL-2.0**. See [`LICENSE`](./LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "pytfe",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "HashiCorp",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/af/73/3727ad12f7c573d805924e1eb1153971f2396f7bed424f9a9cac4e6a41e8/pytfe-0.1.0.tar.gz",
"platform": null,
"description": "# HCP Terraform and Terraform Enterprise **Python** Client (pyTFE)\n\n[](https://pypi.org/project/pytfe/)\n[](https://pypi.org/project/pytfe/)\n[](https://github.com/hashicorp/python-tfe/actions/workflows/test.yml)\n[](./LICENSE)\n[](https://github.com/hashicorp/python-tfe/issues)\n\nThe official **Python** API client for [HCP Terraform and Terraform Enterprise](https://www.hashicorp.com/products/terraform).\n\nThis client targets the [HCP Terraform V2 API](https://developer.hashicorp.com/terraform/cloud-docs/api-docs).\nAs Terraform Enterprise is the self-hosted distribution of HCP Terraform, this client supports both **HCP Terraform** and **Terraform Enterprise** use cases. In this repository and API, we refer to the platform generically as *Terraform Enterprise* unless a feature is explicitly called out as only supported in one or the other (rare).\n\n## Version Information\n\nWe follow Semantic Versioning. During the initial alpha period we use `0.y.z`:\n- **Minor** (`0.y.z \u2192 0.(y+1).z`): new, backwards-compatible features and enhancements.\n- **Patch** (`0.y.z \u2192 0.y.(z+1)`): bug fixes and performance improvements.\n- Occasionally, a function signature change that fixes incorrect behavior may appear in a minor version.\n\n## Example Usage\n\nConstruct a new **pyTFE** client, then use the resource services on the client to access different parts of the Terraform Enterprise API. The following example lists all organizations.\n\n### (Recommended) Using explicit config\n\n```python\nfrom pytfe import TFEClient, TFEConfig\n\nconfig = TFEConfig(\n host=\"https://tfe.local\",\n token=\"insert-your-token-here\",\n retry_server_errors=True,\n timeout=30.0,\n user_agent=\"example-app/0.1 pytfe/0.1\",\n)\n\nclient = TFEClient(config)\n\norgs = client.organizations.list()\nfor org in orgs.items:\n print(org.name)\n```\n\n### Using the default config with environment variables\n\nThe default configuration reads the `TFE_ADDRESS` and `TFE_TOKEN` environment variables.\n\n1. `TFE_ADDRESS` \u2014 URL of an HCP Terraform or Terraform Enterprise instance. Example: `https://tfe.local` \n2. `TFE_TOKEN` \u2014 An [API token](https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/api-tokens) for the HCP Terraform or Terraform Enterprise instance.\n\n\nEnvironment variables are used as a fallback when `host` or `token` are not provided explicitly:\n\n#### Using the default configuration\n```python\nfrom pytfe import TFEClient, TFEConfig\n\n# Equivalent to providing no values; falls back to env vars if set.\nclient = TFEClient(TFEConfig())\norgs = client.organizations.list()\nfor org in orgs.items:\n print(org.name)\n```\n\n#### When host or token is empty\n```python\nfrom pytfe import TFEClient, TFEConfig\n\nconfig = TFEConfig(address=\"\", token=\"\")\nclient = TFEClient(config)\n\norgs = client.organizations.list()\nfor org in orgs.items:\n print(org.name)\n```\n\n## Documentation\n\n- API reference and guides (SDK): **coming soon** \n- Terraform Enterprise API: https://developer.hashicorp.com/terraform/enterprise/api-docs\n\n## Examples\n\nSee the [`examples/`](./examples) directory for runnable snippets covering common workflows (workspaces, variables, configuration versions, runs/plans/applies, state, agents).\n\n## Running tests\n\nSee [`TESTS.md`](./docs/TESTS.md). Typical flow:\n\n```bash\npip install -e .[dev]\nmake test\n```\n\n## Issues and Contributing\n\nSee [`CONTRIBUTING.md`](./docs/CONTRIBUTING.md). We welcome issues and pull requests.\n\n## Releases\n\nSee [`RELEASES.md`](./docs/RELEASES.md).\n\n## License\n\nThis project is licensed under the **MPL-2.0**. See [`LICENSE`](./LICENSE).\n",
"bugtrack_url": null,
"license": "MPL-2.0",
"summary": "Official Python SDK for HashiCorp Terraform Cloud / Terraform Enterprise (TFE) API v2",
"version": "0.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/hashicorp/python-tfe/issues",
"Repository": "https://github.com/hashicorp/python-tfe"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "caf90bd5164b0c11caede91297ea46fa2ebc64f8676424ffade5cc52602203ee",
"md5": "5fd12c54b89965644441e348bb490ff4",
"sha256": "7376a92eb6ea03e13ce010e35aa782ca3d8ed788567d575f5b50503c8f02e3e7"
},
"downloads": -1,
"filename": "pytfe-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5fd12c54b89965644441e348bb490ff4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 122323,
"upload_time": "2025-10-28T10:19:06",
"upload_time_iso_8601": "2025-10-28T10:19:06.206580Z",
"url": "https://files.pythonhosted.org/packages/ca/f9/0bd5164b0c11caede91297ea46fa2ebc64f8676424ffade5cc52602203ee/pytfe-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "af733727ad12f7c573d805924e1eb1153971f2396f7bed424f9a9cac4e6a41e8",
"md5": "ddb8f777b671117384344fc06dbd2963",
"sha256": "32b6d568911976a25faf10c928ed05ea9d65ee8870f95878b4a95f5638fbc5d0"
},
"downloads": -1,
"filename": "pytfe-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ddb8f777b671117384344fc06dbd2963",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 84345,
"upload_time": "2025-10-28T10:19:07",
"upload_time_iso_8601": "2025-10-28T10:19:07.946187Z",
"url": "https://files.pythonhosted.org/packages/af/73/3727ad12f7c573d805924e1eb1153971f2396f7bed424f9a9cac4e6a41e8/pytfe-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-28 10:19:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hashicorp",
"github_project": "python-tfe",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytfe"
}