xenfra 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
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.
- xenfra/__init__.py +0 -1
- xenfra/commands/__init__.py +3 -0
- xenfra/commands/auth.py +186 -0
- xenfra/commands/deployments.py +443 -0
- xenfra/commands/intelligence.py +312 -0
- xenfra/commands/projects.py +163 -0
- xenfra/commands/security_cmd.py +235 -0
- xenfra/main.py +70 -0
- xenfra/utils/__init__.py +3 -0
- xenfra/utils/auth.py +148 -0
- xenfra/utils/codebase.py +86 -0
- xenfra/utils/config.py +278 -0
- xenfra/utils/security.py +350 -0
- xenfra-0.2.4.dist-info/METADATA +115 -0
- xenfra-0.2.4.dist-info/RECORD +17 -0
- xenfra-0.2.4.dist-info/entry_points.txt +3 -0
- xenfra/api/auth.py +0 -51
- xenfra/api/billing.py +0 -80
- xenfra/api/connections.py +0 -163
- xenfra/api/main.py +0 -175
- xenfra/api/webhooks.py +0 -146
- xenfra/cli/main.py +0 -211
- xenfra/config.py +0 -24
- xenfra/db/models.py +0 -51
- xenfra/db/session.py +0 -17
- xenfra/dependencies.py +0 -35
- xenfra/dockerizer.py +0 -89
- xenfra/engine.py +0 -293
- xenfra/mcp_client.py +0 -149
- xenfra/models.py +0 -54
- xenfra/recipes.py +0 -23
- xenfra/security.py +0 -58
- xenfra/templates/Dockerfile.j2 +0 -25
- xenfra/templates/cloud-init.sh.j2 +0 -68
- xenfra/templates/docker-compose.yml.j2 +0 -33
- xenfra/utils.py +0 -69
- xenfra-0.2.2.dist-info/METADATA +0 -95
- xenfra-0.2.2.dist-info/RECORD +0 -25
- xenfra-0.2.2.dist-info/entry_points.txt +0 -3
- {xenfra-0.2.2.dist-info → xenfra-0.2.4.dist-info}/WHEEL +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# docker-compose.yml template
|
|
2
|
-
version: '3.8'
|
|
3
|
-
|
|
4
|
-
services:
|
|
5
|
-
app:
|
|
6
|
-
build: .
|
|
7
|
-
ports:
|
|
8
|
-
- "{{ port | default(8000) }}:{{ port | default(8000) }}"
|
|
9
|
-
volumes:
|
|
10
|
-
- .:/app
|
|
11
|
-
command: {{ command }}
|
|
12
|
-
{% if database == 'postgres' %}
|
|
13
|
-
depends_on:
|
|
14
|
-
- db
|
|
15
|
-
environment:
|
|
16
|
-
- DATABASE_URL=postgresql://{{ db_user | default('user') }}:{{ db_password | default('password') }}@db:5432/{{ db_name | default('appdb') }}
|
|
17
|
-
{% endif %}
|
|
18
|
-
|
|
19
|
-
{% if database == 'postgres' %}
|
|
20
|
-
db:
|
|
21
|
-
image: postgres:15-alpine
|
|
22
|
-
volumes:
|
|
23
|
-
- postgres_data:/var/lib/postgresql/data/
|
|
24
|
-
environment:
|
|
25
|
-
- POSTGRES_USER={{ db_user | default('user') }}
|
|
26
|
-
- POSTGRES_PASSWORD={{ db_password | default('password') }}
|
|
27
|
-
- POSTGRES_DB={{ db_name | default('appdb') }}
|
|
28
|
-
{% endif %}
|
|
29
|
-
|
|
30
|
-
volumes:
|
|
31
|
-
{% if database == 'postgres' %}
|
|
32
|
-
postgres_data:
|
|
33
|
-
{% endif %}
|
xenfra/utils.py
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import tomllib # Python 3.11+
|
|
3
|
-
|
|
4
|
-
def get_project_context():
|
|
5
|
-
"""
|
|
6
|
-
Scans for project configuration.
|
|
7
|
-
Prioritizes: pyproject.toml > requirements.txt
|
|
8
|
-
Prioritizes: uv > poetry > pip
|
|
9
|
-
"""
|
|
10
|
-
options = {}
|
|
11
|
-
|
|
12
|
-
# 1. Check for Lockfiles (Determines the Manager)
|
|
13
|
-
if os.path.exists("uv.lock"):
|
|
14
|
-
options["uv"] = True
|
|
15
|
-
if os.path.exists("poetry.lock"):
|
|
16
|
-
options["poetry"] = True
|
|
17
|
-
|
|
18
|
-
# 2. Extract Dependencies from pyproject.toml (Best source for names)
|
|
19
|
-
if os.path.exists("pyproject.toml"):
|
|
20
|
-
try:
|
|
21
|
-
with open("pyproject.toml", "rb") as f:
|
|
22
|
-
data = tomllib.load(f)
|
|
23
|
-
deps = data.get("project", {}).get("dependencies", [])
|
|
24
|
-
if deps:
|
|
25
|
-
# Clean versions if needed, or just pass them to pip/uv
|
|
26
|
-
options["toml"] = " ".join(deps)
|
|
27
|
-
except Exception:
|
|
28
|
-
pass
|
|
29
|
-
|
|
30
|
-
# 3. Extract Dependencies from requirements.txt (Fallback source)
|
|
31
|
-
if os.path.exists("requirements.txt"):
|
|
32
|
-
try:
|
|
33
|
-
with open("requirements.txt", "r") as f:
|
|
34
|
-
pkgs = [l.strip() for l in f if l.strip() and not l.startswith("#")]
|
|
35
|
-
if pkgs:
|
|
36
|
-
options["pip"] = " ".join(pkgs)
|
|
37
|
-
except:
|
|
38
|
-
pass
|
|
39
|
-
|
|
40
|
-
# --- DECISION LOGIC ---
|
|
41
|
-
context = {"type": "pip", "packages": None, "conflict": False}
|
|
42
|
-
|
|
43
|
-
# A. Determine the Manager (Type)
|
|
44
|
-
if "uv" in options:
|
|
45
|
-
context["type"] = "uv"
|
|
46
|
-
elif "poetry" in options:
|
|
47
|
-
context["type"] = "poetry"
|
|
48
|
-
else:
|
|
49
|
-
context["type"] = "pip"
|
|
50
|
-
|
|
51
|
-
# B. Determine the Packages (Content)
|
|
52
|
-
# We prefer TOML because it's the modern standard usually paired with UV/Poetry
|
|
53
|
-
if "toml" in options:
|
|
54
|
-
context["packages"] = options["toml"]
|
|
55
|
-
elif "pip" in options:
|
|
56
|
-
context["packages"] = options["pip"]
|
|
57
|
-
|
|
58
|
-
# C. Check for "True" Conflicts
|
|
59
|
-
# A conflict is when we have ambiguous package sources (TOML vs Requirements)
|
|
60
|
-
# AND we aren't sure which one the user wants.
|
|
61
|
-
if "toml" in options and "pip" in options:
|
|
62
|
-
# If we have both, we flag it so the UI can ask (or default to TOML)
|
|
63
|
-
context["conflict"] = True
|
|
64
|
-
context["choices"] = {
|
|
65
|
-
"1": {"name": "pyproject.toml", "pkgs": options["toml"]},
|
|
66
|
-
"2": {"name": "requirements.txt", "pkgs": options["pip"]}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return context
|
xenfra-0.2.2.dist-info/METADATA
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: xenfra
|
|
3
|
-
Version: 0.2.2
|
|
4
|
-
Summary: A 'Zen Mode' infrastructure engine for Python developers.
|
|
5
|
-
Author: xenfra-cloud
|
|
6
|
-
Author-email: xenfra-cloud <xenfracloud@gmail.com>
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Classifier: Development Status :: 3 - Alpha
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Topic :: Software Development :: Build Tools
|
|
13
|
-
Classifier: Topic :: System :: Systems Administration
|
|
14
|
-
Requires-Dist: fabric>=3.2.2
|
|
15
|
-
Requires-Dist: python-digitalocean>=1.17.0
|
|
16
|
-
Requires-Dist: python-dotenv>=1.2.1
|
|
17
|
-
Requires-Dist: rich>=14.2.0
|
|
18
|
-
Requires-Dist: fastapi>=0.110.0
|
|
19
|
-
Requires-Dist: uvicorn[standard]>=0.27.1
|
|
20
|
-
Requires-Dist: click>=8.1.7
|
|
21
|
-
Requires-Dist: sqlmodel>=0.0.16
|
|
22
|
-
Requires-Dist: psycopg2-binary>=2.9.9
|
|
23
|
-
Requires-Dist: python-jose[cryptography]>=3.3.0
|
|
24
|
-
Requires-Dist: passlib>=1.7.4
|
|
25
|
-
Requires-Dist: httpx>=0.27.0
|
|
26
|
-
Requires-Dist: pyyaml>=6.0.1
|
|
27
|
-
Requires-Dist: python-multipart>=0.0.21
|
|
28
|
-
Requires-Dist: bcrypt==4.0.1
|
|
29
|
-
Requires-Dist: jinja2>=3.1.3
|
|
30
|
-
Requires-Dist: pytest>=9.0.2
|
|
31
|
-
Requires-Dist: pytest>=8.0.0 ; extra == 'test'
|
|
32
|
-
Requires-Dist: pytest-mock>=3.12.0 ; extra == 'test'
|
|
33
|
-
Requires-Python: >=3.13
|
|
34
|
-
Project-URL: Homepage, https://github.com/xenfra-cloud/xenfra
|
|
35
|
-
Project-URL: Issues, https://github.com/xenfra-cloud/xenfra/issues
|
|
36
|
-
Provides-Extra: test
|
|
37
|
-
Description-Content-Type: text/markdown
|
|
38
|
-
|
|
39
|
-
# 🧘 Xenfra: Infrastructure in Zen Mode
|
|
40
|
-
|
|
41
|
-
**Xenfra** is a modular infrastructure engine for Python developers that automates the deployment of applications to DigitalOcean. It is designed as a library first, with a beautiful and interactive CLI as the default frontend.
|
|
42
|
-
|
|
43
|
-
It handles the complexity of server provisioning, context-aware configuration, Dockerization, and automatic HTTPS, allowing you to focus on your code.
|
|
44
|
-
|
|
45
|
-
## ✨ Core Philosophy
|
|
46
|
-
|
|
47
|
-
* **Engine as the Brain**: `xenfra.engine` is the core library. It owns the DigitalOcean API, the SSH "Auto-Heal" retry loops, and the Dockerizer services. It is stateful, robust, and can be imported into any Python project.
|
|
48
|
-
* **Clients as the Face**: Frontends like the default CLI (`xenfra.cli`) are thin, stateless clients responsible only for user interaction.
|
|
49
|
-
* **Zen Mode**: If a server setup fails due to common issues like a locked package manager, the Engine automatically fixes it without exposing raw errors to the user.
|
|
50
|
-
|
|
51
|
-
## 🚀 Quickstart
|
|
52
|
-
|
|
53
|
-
Using the Xenfra CLI involves a simple workflow: **Configure**, **Initialize**, and then **Deploy & Manage**.
|
|
54
|
-
|
|
55
|
-
### 1. Configure
|
|
56
|
-
|
|
57
|
-
Xenfra needs your DigitalOcean API token to manage infrastructure on your behalf. Export it as an environment variable:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
export DIGITAL_OCEAN_TOKEN="dop_v1_your_secret_token_here"
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 2. Initialize
|
|
64
|
-
|
|
65
|
-
Navigate to your project's root directory and run the `init` command. This command scans your project, asks a few questions, and creates a `xenfra.yaml` configuration file.
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
xenfra init
|
|
69
|
-
```
|
|
70
|
-
You should review the generated `xenfra.yaml` and commit it to your repository.
|
|
71
|
-
|
|
72
|
-
### 3. Deploy & Manage
|
|
73
|
-
|
|
74
|
-
Once your project is initialized, you can use the following commands to manage your application:
|
|
75
|
-
|
|
76
|
-
* **`xenfra deploy`**: Deploys your application based on the settings in `xenfra.yaml`.
|
|
77
|
-
* **`xenfra list`**: Instantly lists all your deployed projects from a local cache.
|
|
78
|
-
* Use `xenfra list --refresh` to force a sync with your cloud provider.
|
|
79
|
-
* **`xenfra logs`**: Streams real-time logs from a selected project.
|
|
80
|
-
* **`xenfra destroy`**: Decommissions and deletes a deployed project.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
## 📦 Supported Frameworks & Features
|
|
84
|
-
|
|
85
|
-
* **Smart Context Detection**: Automatically detects your package manager (`uv` or `pip`).
|
|
86
|
-
* **Automatic Dockerization**: If a web framework is detected (`FastAPI`, `Flask`), Xenfra will:
|
|
87
|
-
* Generate a `Dockerfile`, `docker-compose.yml`, and `Caddyfile`.
|
|
88
|
-
* Deploy your application as a container.
|
|
89
|
-
* Configure **Caddy** as a reverse proxy with **automatic HTTPS**.
|
|
90
|
-
|
|
91
|
-
## 🤝 Contributing
|
|
92
|
-
|
|
93
|
-
Contributions are welcome! Please check our `CONTRIBUTING.md` for more details.
|
|
94
|
-
|
|
95
|
-
## 📄 Created by DevHusnainAi
|
xenfra-0.2.2.dist-info/RECORD
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
xenfra/__init__.py,sha256=ja0-Vc9T61EXZnPeX84Fi-UOjoGAWu5r90_1t-0WjVw,46
|
|
2
|
-
xenfra/api/auth.py,sha256=WxepMKeF8Xnf9imqYip_EyGT0xFXgKoAhFIYx7uqWvA,1848
|
|
3
|
-
xenfra/api/billing.py,sha256=hoviKgpzjMoWcz0KW7I5HUhwLKPlRov5-3TIqzbdpAs,2871
|
|
4
|
-
xenfra/api/connections.py,sha256=IQfOA9jZV6Gcz0_E69Sgp3poAMQKwGwn19GV84Sn61I,7328
|
|
5
|
-
xenfra/api/main.py,sha256=psdVAOKsSM9vMmTSdZBuGceJNG50mqtJFbfa3UrTpmo,6392
|
|
6
|
-
xenfra/api/webhooks.py,sha256=Ek--AVzzKxvukway-vLt_wprBMaQjuWy7q35BbUKeiA,6367
|
|
7
|
-
xenfra/cli/main.py,sha256=1RiznGbrlaSDw37nD8i7wrpXMQsHnNuqk1YOYzxWdII,7841
|
|
8
|
-
xenfra/config.py,sha256=g7ahyI4kbYITRcliCbzXCRfKJ3uh8E2VMjmpR-n51s8,621
|
|
9
|
-
xenfra/db/models.py,sha256=nRqbG9cbcX8LWz2Jr4inKysAq47yALcxNl3_UYEpSoQ,1305
|
|
10
|
-
xenfra/db/session.py,sha256=Q03RIiPlYBtPD-qVHlTqQtacnOPTZnOy6_f9p6lABPU,510
|
|
11
|
-
xenfra/dependencies.py,sha256=pQ7bFNZHC24chMxRa_69mu2fIqcoc8DG9MD1POSGgjA,1211
|
|
12
|
-
xenfra/dockerizer.py,sha256=5qzgqw2MZrBwI4IFzXPJZ6k3F3IRdFnX-KGIpv5cjXc,3126
|
|
13
|
-
xenfra/engine.py,sha256=G-rSwz_Z79UpJFh7uGWLCmWHk2MKf1b_koMHsrUGf5g,13127
|
|
14
|
-
xenfra/mcp_client.py,sha256=IxkTC3NPHvPJn-2dl5BUHQ3d-A9MBiKP9fIftzhmCuA,5756
|
|
15
|
-
xenfra/models.py,sha256=9Dvr1_kb29LJIR0a-uwx_tsCWt3GZeko6FKQtYY8F4g,1852
|
|
16
|
-
xenfra/recipes.py,sha256=q5ilpDzGuUM6GyvlW97pOpPS9nzQAJGI4pgzSU_URik,862
|
|
17
|
-
xenfra/security.py,sha256=w7aIFnHDHOH2zDjYD_LnJnSE01NeGeoAh_V8hC1HipY,2003
|
|
18
|
-
xenfra/templates/Dockerfile.j2,sha256=apWts895OOoUYwj_fOa6OiylFB5m8zFEYvJ1Nki32YM,664
|
|
19
|
-
xenfra/templates/cloud-init.sh.j2,sha256=QCWG8hL1V05bAQ7BQ70QfuhIvS4tnsL8ZTCVtyi9F0A,2222
|
|
20
|
-
xenfra/templates/docker-compose.yml.j2,sha256=zKUT2cd_FrxXvRxE-vAAjuQk3-nLNQjRe-StkhAWRQA,860
|
|
21
|
-
xenfra/utils.py,sha256=aGXjJm-pwVCHuCn5UBdrxRcYvM8aJwHQ1kihl7gcxiM,2387
|
|
22
|
-
xenfra-0.2.2.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
|
|
23
|
-
xenfra-0.2.2.dist-info/entry_points.txt,sha256=O6JNPm-inoMzmW29WPYl6jHHlWCrcs8ShHEo-CXvERs,49
|
|
24
|
-
xenfra-0.2.2.dist-info/METADATA,sha256=7fVMh4Z3PjfMsNsJXpovljrtZ6NZ4wWhpwvhKRZPWKo,4128
|
|
25
|
-
xenfra-0.2.2.dist-info/RECORD,,
|
|
File without changes
|