xenfra-sdk 0.1.2__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/PKG-INFO +92 -92
  2. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/README.md +91 -91
  3. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/pyproject.toml +37 -37
  4. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/__init__.py +21 -21
  5. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/cli/main.py +226 -226
  6. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/config.py +26 -26
  7. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/db/models.py +24 -28
  8. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/db/session.py +30 -30
  9. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/dependencies.py +39 -39
  10. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/dockerizer.py +87 -87
  11. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/engine.py +411 -388
  12. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/exceptions.py +19 -19
  13. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/mcp_client.py +154 -154
  14. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/models.py +182 -182
  15. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/patterns.json +13 -13
  16. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/privacy.py +153 -153
  17. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/recipes.py +25 -25
  18. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/resources/base.py +3 -3
  19. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/resources/deployments.py +89 -89
  20. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/resources/intelligence.py +95 -95
  21. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/security.py +41 -41
  22. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/templates/Dockerfile.j2 +25 -25
  23. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/templates/cloud-init.sh.j2 +68 -68
  24. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/templates/docker-compose.yml.j2 +33 -33
  25. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/cli/__init__.py +0 -0
  26. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/client.py +0 -0
  27. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/client_with_hooks.py +0 -0
  28. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/db/__init__.py +0 -0
  29. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/resources/__init__.py +0 -0
  30. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/resources/projects.py +0 -0
  31. {xenfra_sdk-0.1.2 → xenfra_sdk-0.1.3}/src/xenfra_sdk/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: xenfra-sdk
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Xenfra SDK: Core engine and utilities for the Xenfra platform.
5
5
  Author: xenfra-cloud
6
6
  Author-email: xenfra-cloud <xenfracloud@gmail.com>
@@ -25,94 +25,94 @@ Requires-Dist: cryptography>=41.0.0
25
25
  Requires-Python: >=3.13
26
26
  Description-Content-Type: text/markdown
27
27
 
28
- # Xenfra Python SDK
29
-
30
- The official, open-source Python SDK for interacting with the Xenfra API.
31
-
32
- This SDK provides a simple and Pythonic interface for developers and AI Agents to programmatically manage infrastructure, deployments, and other platform resources.
33
-
34
- ## Installation
35
-
36
- ```bash
37
- pip install xenfra-sdk
38
- ```
39
-
40
- ## Basic Usage
41
-
42
- Initialize the client with your API token (or ensure the `XENFRA_TOKEN` environment variable is set).
43
-
44
- ```python
45
- import os
46
- from xenfra_sdk import XenfraClient
47
- from xenfra_sdk.exceptions import XenfraAPIError
48
-
49
- client = XenfraClient(token=os.getenv("XENFRA_TOKEN"))
50
-
51
- try:
52
- projects = client.projects.list()
53
- for p in projects:
54
- print(f"Found project: {p.name} (Status: {p.status})")
55
- except XenfraAPIError as e:
56
- print(f"API Error: {e.detail}")
57
- ```
58
-
59
- ## Usage for Agentic Workflows
60
-
61
- The Xenfra SDK is designed to be used as a "tool" by AI Agents (e.g., OpenAI Assistants). The Pydantic models are compatible with function-calling schemas, allowing an agent to easily call these methods.
62
-
63
- Here is a conceptual example of how an agent might use the SDK to fulfill a user's request.
64
-
65
- ```python
66
- # This is a conceptual representation of an agent's internal logic.
67
- # The agent would be configured with functions that call these SDK methods.
68
-
69
- def list_all_projects():
70
- """Lists all available projects in the Xenfra account."""
71
- return client.projects.list()
72
-
73
- def create_new_deployment(project_name: str, git_repo: str, branch: str = "main"):
74
- """
75
- Creates a new deployment for a project.
76
-
77
- Args:
78
- project_name: The name for the new deployment.
79
- git_repo: The URL of the git repository to deploy.
80
- branch: The branch to deploy (defaults to 'main').
81
- """
82
- return client.deployments.create(
83
- project_name=project_name,
84
- git_repo=git_repo,
85
- branch=branch,
86
- framework="fastapi" # Framework detection would be part of a more complex agent
87
- )
88
-
89
- # --- Agent Execution Flow ---
90
-
91
- # User prompt: "Deploy my new app from github.com/user/my-app"
92
-
93
- # 1. Agent decides which tool to use: `create_new_deployment`
94
- # 2. Agent extracts parameters:
95
- # - project_name = "my-app" (inferred)
96
- # - git_repo = "https://github.com/user/my-app"
97
- # 3. Agent calls the tool:
98
- # create_new_deployment(
99
- # project_name="my-app",
100
- # git_repo="https://github.com/user/my-app"
101
- # )
102
- ```
103
-
104
- ## Error Handling
105
-
106
- The SDK uses custom exceptions for clear error handling. All API-related errors will raise a `XenfraAPIError`, which contains the `status_code` and a `detail` message from the API response.
107
-
108
- ```python
109
- from xenfra_sdk.exceptions import XenfraAPIError, AuthenticationError
110
-
111
- try:
112
- # Make an API call
113
- ...
114
- except AuthenticationError as e:
115
- print("Authentication failed. Please check your token.")
116
- except XenfraAPIError as e:
117
- print(f"An API error occurred with status {e.status_code}: {e.detail}")
118
- ```
28
+ # Xenfra Python SDK
29
+
30
+ The official, open-source Python SDK for interacting with the Xenfra API.
31
+
32
+ This SDK provides a simple and Pythonic interface for developers and AI Agents to programmatically manage infrastructure, deployments, and other platform resources.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install xenfra-sdk
38
+ ```
39
+
40
+ ## Basic Usage
41
+
42
+ Initialize the client with your API token (or ensure the `XENFRA_TOKEN` environment variable is set).
43
+
44
+ ```python
45
+ import os
46
+ from xenfra_sdk import XenfraClient
47
+ from xenfra_sdk.exceptions import XenfraAPIError
48
+
49
+ client = XenfraClient(token=os.getenv("XENFRA_TOKEN"))
50
+
51
+ try:
52
+ projects = client.projects.list()
53
+ for p in projects:
54
+ print(f"Found project: {p.name} (Status: {p.status})")
55
+ except XenfraAPIError as e:
56
+ print(f"API Error: {e.detail}")
57
+ ```
58
+
59
+ ## Usage for Agentic Workflows
60
+
61
+ The Xenfra SDK is designed to be used as a "tool" by AI Agents (e.g., OpenAI Assistants). The Pydantic models are compatible with function-calling schemas, allowing an agent to easily call these methods.
62
+
63
+ Here is a conceptual example of how an agent might use the SDK to fulfill a user's request.
64
+
65
+ ```python
66
+ # This is a conceptual representation of an agent's internal logic.
67
+ # The agent would be configured with functions that call these SDK methods.
68
+
69
+ def list_all_projects():
70
+ """Lists all available projects in the Xenfra account."""
71
+ return client.projects.list()
72
+
73
+ def create_new_deployment(project_name: str, git_repo: str, branch: str = "main"):
74
+ """
75
+ Creates a new deployment for a project.
76
+
77
+ Args:
78
+ project_name: The name for the new deployment.
79
+ git_repo: The URL of the git repository to deploy.
80
+ branch: The branch to deploy (defaults to 'main').
81
+ """
82
+ return client.deployments.create(
83
+ project_name=project_name,
84
+ git_repo=git_repo,
85
+ branch=branch,
86
+ framework="fastapi" # Framework detection would be part of a more complex agent
87
+ )
88
+
89
+ # --- Agent Execution Flow ---
90
+
91
+ # User prompt: "Deploy my new app from github.com/user/my-app"
92
+
93
+ # 1. Agent decides which tool to use: `create_new_deployment`
94
+ # 2. Agent extracts parameters:
95
+ # - project_name = "my-app" (inferred)
96
+ # - git_repo = "https://github.com/user/my-app"
97
+ # 3. Agent calls the tool:
98
+ # create_new_deployment(
99
+ # project_name="my-app",
100
+ # git_repo="https://github.com/user/my-app"
101
+ # )
102
+ ```
103
+
104
+ ## Error Handling
105
+
106
+ The SDK uses custom exceptions for clear error handling. All API-related errors will raise a `XenfraAPIError`, which contains the `status_code` and a `detail` message from the API response.
107
+
108
+ ```python
109
+ from xenfra_sdk.exceptions import XenfraAPIError, AuthenticationError
110
+
111
+ try:
112
+ # Make an API call
113
+ ...
114
+ except AuthenticationError as e:
115
+ print("Authentication failed. Please check your token.")
116
+ except XenfraAPIError as e:
117
+ print(f"An API error occurred with status {e.status_code}: {e.detail}")
118
+ ```
@@ -1,91 +1,91 @@
1
- # Xenfra Python SDK
2
-
3
- The official, open-source Python SDK for interacting with the Xenfra API.
4
-
5
- This SDK provides a simple and Pythonic interface for developers and AI Agents to programmatically manage infrastructure, deployments, and other platform resources.
6
-
7
- ## Installation
8
-
9
- ```bash
10
- pip install xenfra-sdk
11
- ```
12
-
13
- ## Basic Usage
14
-
15
- Initialize the client with your API token (or ensure the `XENFRA_TOKEN` environment variable is set).
16
-
17
- ```python
18
- import os
19
- from xenfra_sdk import XenfraClient
20
- from xenfra_sdk.exceptions import XenfraAPIError
21
-
22
- client = XenfraClient(token=os.getenv("XENFRA_TOKEN"))
23
-
24
- try:
25
- projects = client.projects.list()
26
- for p in projects:
27
- print(f"Found project: {p.name} (Status: {p.status})")
28
- except XenfraAPIError as e:
29
- print(f"API Error: {e.detail}")
30
- ```
31
-
32
- ## Usage for Agentic Workflows
33
-
34
- The Xenfra SDK is designed to be used as a "tool" by AI Agents (e.g., OpenAI Assistants). The Pydantic models are compatible with function-calling schemas, allowing an agent to easily call these methods.
35
-
36
- Here is a conceptual example of how an agent might use the SDK to fulfill a user's request.
37
-
38
- ```python
39
- # This is a conceptual representation of an agent's internal logic.
40
- # The agent would be configured with functions that call these SDK methods.
41
-
42
- def list_all_projects():
43
- """Lists all available projects in the Xenfra account."""
44
- return client.projects.list()
45
-
46
- def create_new_deployment(project_name: str, git_repo: str, branch: str = "main"):
47
- """
48
- Creates a new deployment for a project.
49
-
50
- Args:
51
- project_name: The name for the new deployment.
52
- git_repo: The URL of the git repository to deploy.
53
- branch: The branch to deploy (defaults to 'main').
54
- """
55
- return client.deployments.create(
56
- project_name=project_name,
57
- git_repo=git_repo,
58
- branch=branch,
59
- framework="fastapi" # Framework detection would be part of a more complex agent
60
- )
61
-
62
- # --- Agent Execution Flow ---
63
-
64
- # User prompt: "Deploy my new app from github.com/user/my-app"
65
-
66
- # 1. Agent decides which tool to use: `create_new_deployment`
67
- # 2. Agent extracts parameters:
68
- # - project_name = "my-app" (inferred)
69
- # - git_repo = "https://github.com/user/my-app"
70
- # 3. Agent calls the tool:
71
- # create_new_deployment(
72
- # project_name="my-app",
73
- # git_repo="https://github.com/user/my-app"
74
- # )
75
- ```
76
-
77
- ## Error Handling
78
-
79
- The SDK uses custom exceptions for clear error handling. All API-related errors will raise a `XenfraAPIError`, which contains the `status_code` and a `detail` message from the API response.
80
-
81
- ```python
82
- from xenfra_sdk.exceptions import XenfraAPIError, AuthenticationError
83
-
84
- try:
85
- # Make an API call
86
- ...
87
- except AuthenticationError as e:
88
- print("Authentication failed. Please check your token.")
89
- except XenfraAPIError as e:
90
- print(f"An API error occurred with status {e.status_code}: {e.detail}")
91
- ```
1
+ # Xenfra Python SDK
2
+
3
+ The official, open-source Python SDK for interacting with the Xenfra API.
4
+
5
+ This SDK provides a simple and Pythonic interface for developers and AI Agents to programmatically manage infrastructure, deployments, and other platform resources.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install xenfra-sdk
11
+ ```
12
+
13
+ ## Basic Usage
14
+
15
+ Initialize the client with your API token (or ensure the `XENFRA_TOKEN` environment variable is set).
16
+
17
+ ```python
18
+ import os
19
+ from xenfra_sdk import XenfraClient
20
+ from xenfra_sdk.exceptions import XenfraAPIError
21
+
22
+ client = XenfraClient(token=os.getenv("XENFRA_TOKEN"))
23
+
24
+ try:
25
+ projects = client.projects.list()
26
+ for p in projects:
27
+ print(f"Found project: {p.name} (Status: {p.status})")
28
+ except XenfraAPIError as e:
29
+ print(f"API Error: {e.detail}")
30
+ ```
31
+
32
+ ## Usage for Agentic Workflows
33
+
34
+ The Xenfra SDK is designed to be used as a "tool" by AI Agents (e.g., OpenAI Assistants). The Pydantic models are compatible with function-calling schemas, allowing an agent to easily call these methods.
35
+
36
+ Here is a conceptual example of how an agent might use the SDK to fulfill a user's request.
37
+
38
+ ```python
39
+ # This is a conceptual representation of an agent's internal logic.
40
+ # The agent would be configured with functions that call these SDK methods.
41
+
42
+ def list_all_projects():
43
+ """Lists all available projects in the Xenfra account."""
44
+ return client.projects.list()
45
+
46
+ def create_new_deployment(project_name: str, git_repo: str, branch: str = "main"):
47
+ """
48
+ Creates a new deployment for a project.
49
+
50
+ Args:
51
+ project_name: The name for the new deployment.
52
+ git_repo: The URL of the git repository to deploy.
53
+ branch: The branch to deploy (defaults to 'main').
54
+ """
55
+ return client.deployments.create(
56
+ project_name=project_name,
57
+ git_repo=git_repo,
58
+ branch=branch,
59
+ framework="fastapi" # Framework detection would be part of a more complex agent
60
+ )
61
+
62
+ # --- Agent Execution Flow ---
63
+
64
+ # User prompt: "Deploy my new app from github.com/user/my-app"
65
+
66
+ # 1. Agent decides which tool to use: `create_new_deployment`
67
+ # 2. Agent extracts parameters:
68
+ # - project_name = "my-app" (inferred)
69
+ # - git_repo = "https://github.com/user/my-app"
70
+ # 3. Agent calls the tool:
71
+ # create_new_deployment(
72
+ # project_name="my-app",
73
+ # git_repo="https://github.com/user/my-app"
74
+ # )
75
+ ```
76
+
77
+ ## Error Handling
78
+
79
+ The SDK uses custom exceptions for clear error handling. All API-related errors will raise a `XenfraAPIError`, which contains the `status_code` and a `detail` message from the API response.
80
+
81
+ ```python
82
+ from xenfra_sdk.exceptions import XenfraAPIError, AuthenticationError
83
+
84
+ try:
85
+ # Make an API call
86
+ ...
87
+ except AuthenticationError as e:
88
+ print("Authentication failed. Please check your token.")
89
+ except XenfraAPIError as e:
90
+ print(f"An API error occurred with status {e.status_code}: {e.detail}")
91
+ ```
@@ -1,37 +1,37 @@
1
- [project]
2
- name = "xenfra-sdk"
3
- version = "0.1.2"
4
- description = "Xenfra SDK: Core engine and utilities for the Xenfra platform."
5
- readme = "README.md"
6
- authors = [
7
- { name = "xenfra-cloud", email = "xenfracloud@gmail.com" }
8
- ]
9
-
10
- classifiers = [
11
- "Programming Language :: Python :: 3",
12
- "License :: OSI Approved :: MIT License",
13
- "Operating System :: OS Independent",
14
- "Development Status :: 3 - Alpha",
15
- "Intended Audience :: Developers",
16
- "Topic :: Software Development :: Build Tools",
17
- "Topic :: System :: Systems Administration",
18
- ]
19
-
20
- dependencies = [
21
- "fabric>=3.2.2",
22
- "python-digitalocean>=1.17.0",
23
- "python-dotenv>=1.2.1",
24
- "rich>=14.2.0",
25
- "sqlmodel>=0.0.16",
26
- "PyYAML>=6.0.1",
27
- "httpx>=0.27.0",
28
- "Jinja2>=3.1.3",
29
- "python-jose[cryptography]>=3.3.0",
30
- "passlib>=1.7.4",
31
- "cryptography>=41.0.0",
32
- ]
33
- requires-python = ">=3.13"
34
-
35
- [build-system]
36
- requires = ["uv_build>=0.9.18,<0.10.0"]
37
- build-backend = "uv_build"
1
+ [project]
2
+ name = "xenfra-sdk"
3
+ version = "0.1.3"
4
+ description = "Xenfra SDK: Core engine and utilities for the Xenfra platform."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "xenfra-cloud", email = "xenfracloud@gmail.com" }
8
+ ]
9
+
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Developers",
16
+ "Topic :: Software Development :: Build Tools",
17
+ "Topic :: System :: Systems Administration",
18
+ ]
19
+
20
+ dependencies = [
21
+ "fabric>=3.2.2",
22
+ "python-digitalocean>=1.17.0",
23
+ "python-dotenv>=1.2.1",
24
+ "rich>=14.2.0",
25
+ "sqlmodel>=0.0.16",
26
+ "PyYAML>=6.0.1",
27
+ "httpx>=0.27.0",
28
+ "Jinja2>=3.1.3",
29
+ "python-jose[cryptography]>=3.3.0",
30
+ "passlib>=1.7.4",
31
+ "cryptography>=41.0.0",
32
+ ]
33
+ requires-python = ">=3.13"
34
+
35
+ [build-system]
36
+ requires = ["uv_build>=0.9.18,<0.10.0"]
37
+ build-backend = "uv_build"
@@ -1,21 +1,21 @@
1
- # This file makes src/xenfra_sdk a Python package.
2
-
3
- from .client import XenfraClient
4
- from .exceptions import AuthenticationError, XenfraAPIError, XenfraError
5
- from .models import (
6
- CodebaseAnalysisResponse,
7
- DiagnosisResponse,
8
- PatchObject,
9
- ProjectRead,
10
- )
11
-
12
- __all__ = [
13
- "XenfraClient",
14
- "XenfraError",
15
- "AuthenticationError",
16
- "XenfraAPIError",
17
- "DiagnosisResponse",
18
- "CodebaseAnalysisResponse",
19
- "PatchObject",
20
- "ProjectRead",
21
- ]
1
+ # This file makes src/xenfra_sdk a Python package.
2
+
3
+ from .client import XenfraClient
4
+ from .exceptions import AuthenticationError, XenfraAPIError, XenfraError
5
+ from .models import (
6
+ CodebaseAnalysisResponse,
7
+ DiagnosisResponse,
8
+ PatchObject,
9
+ ProjectRead,
10
+ )
11
+
12
+ __all__ = [
13
+ "XenfraClient",
14
+ "XenfraError",
15
+ "AuthenticationError",
16
+ "XenfraAPIError",
17
+ "DiagnosisResponse",
18
+ "CodebaseAnalysisResponse",
19
+ "PatchObject",
20
+ "ProjectRead",
21
+ ]