opencloudtool 0.4.1__cp312-abi3-macosx_11_0_arm64.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.
oct/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .py_api import deploy, destroy
2
+
3
+ __all__ = ["deploy", "destroy"]
Binary file
Binary file
Binary file
Binary file
oct/_internal.abi3.so ADDED
Binary file
oct/py_api.py ADDED
@@ -0,0 +1,66 @@
1
+ import os
2
+
3
+ import logging
4
+ from ._internal import deploy as _rust_deploy
5
+ from ._internal import destroy as _rust_destroy
6
+ from ._internal import init_logging as _rust_init_logging
7
+
8
+ # A flag to ensure we only initialize the logger once per session.
9
+ _logging_initialized = False
10
+
11
+ logger = logging.getLogger(name=__name__)
12
+
13
+
14
+ def init_logging():
15
+ """
16
+ Initializes the Rust logging system to show logs in the console.
17
+
18
+ This is called automatically by other functions like `deploy`,
19
+ so you don't typically need to call it yourself.
20
+ """
21
+ global _logging_initialized
22
+ if not _logging_initialized:
23
+ _rust_init_logging()
24
+ _logging_initialized = True
25
+
26
+
27
+ def deploy(path: str = "."):
28
+ """
29
+ Deploys the application using the Rust core orchestrator.
30
+
31
+ Args:
32
+ path (str): The path to the project directory containing the
33
+ `oct.toml` file. Defaults to the current directory.
34
+ """
35
+
36
+ init_logging()
37
+ project_path = os.path.abspath(path)
38
+ logger.info("[Python] Triggering deployment")
39
+
40
+ try:
41
+ _rust_deploy(project_path)
42
+ logger.info("[Python] Deployment call completed successfully.")
43
+ except (RuntimeError, IOError) as e:
44
+ logger.exception(f"[Python] An error occurred during deployment: {e}")
45
+ raise
46
+
47
+
48
+ def destroy(path: str = "."):
49
+ """
50
+ Destroys the application using the Rust core orchestrator.
51
+
52
+ Args:
53
+ path (str): The path to the project directory containing the
54
+ `oct.toml` file. Defaults to the current directory.
55
+ """
56
+
57
+ init_logging()
58
+ project_path = os.path.abspath(path)
59
+ logger.info("[Python] Triggering destroy")
60
+
61
+ try:
62
+ _rust_destroy(project_path)
63
+ logger.info("[Python] Destroy call completed successfully.")
64
+ except (RuntimeError, IOError) as e:
65
+ logger.exception(f"[Python] An error occurred during destroy process: {e}")
66
+ raise
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: opencloudtool
3
+ Version: 0.4.1
4
+ Requires-Python: >=3.8
5
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
6
+
7
+ # Deploy as Python library
8
+
9
+ This guide explains how to set up the environment and use the `oct` Python library.
10
+
11
+ ## How it works: Python-Rust binding
12
+
13
+ ### The connection between Python and Rust is managed by `maturin` and `PyO3`
14
+
15
+ 1. `maturin` compiles the Rust code in the `oct-py` crate into a native Python module.
16
+ 2. We configure the name of this compiled module in `pyproject.toml` to be `oct._internal`.
17
+ 3. The leading underscore (`_`) is a standard Python convention that signals that `_internal` is a low-level module not meant for direct use.
18
+ 4. Our user-facing Python code in `oct/py_api.py` imports functions from `_internal` and presents them as a clean, stable API.
19
+
20
+ ### 1. Navigate to the Python Directory
21
+
22
+ ```bash
23
+ cd crates/oct-py
24
+ ```
25
+
26
+ ### 2. Create and activate the Virtual environment
27
+
28
+ ```bash
29
+ uv venv
30
+
31
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
32
+ ```
33
+
34
+ ### 3. Install dependencies
35
+
36
+ ```bash
37
+ uv sync --group dev
38
+ ```
39
+
40
+ ### 4. Build the Library
41
+
42
+ ```bash
43
+ maturin develop
44
+ ```
45
+
46
+ ### 5. Run the example
47
+
48
+ ```bash
49
+ cd ../../examples/projects/single-host-python-lib
50
+ ```
51
+
52
+ ### Deploy
53
+
54
+ ```bash
55
+ python deploy.py
56
+ ```
57
+
58
+ ### Destroy
59
+
60
+ ```bash
61
+ python destroy.py
62
+ ```
63
+
@@ -0,0 +1,10 @@
1
+ oct/__init__.py,sha256=cVgWz8MCSsEMOTM-ux2RJfaoajdMWJ3xi0gC0PmjoSM,69
2
+ oct/__pycache__/__init__.cpython-310.pyc,sha256=ADfK-61LEgkv-N5Q7FJe6eOajUMi-W-siUJmLfqeI_U,259
3
+ oct/__pycache__/__init__.cpython-312.pyc,sha256=z-OusomA0T5gb6RlmK9XXZaPNSkegINDKd3mLD6fJ0Q,281
4
+ oct/__pycache__/py_api.cpython-310.pyc,sha256=pTgRDeHXYAZQH_MHVxpl86W-X6Wyfs_WDoEsz06Mlhc,1949
5
+ oct/__pycache__/py_api.cpython-312.pyc,sha256=CqXj9UrQSA6LELP8_18MjmIvmgwSKr14uThmtipDEY4,2753
6
+ oct/_internal.abi3.so,sha256=5NYEINUCB2re2vRE0zsqv0yOfYqZU7M39D6n7lrX0NU,35502944
7
+ oct/py_api.py,sha256=F1_LxrmlfRMMjLqUTdyN3oLH4gngA_Pr6v00TLp7_WM,1924
8
+ opencloudtool-0.4.1.dist-info/METADATA,sha256=SdKoYeLkPu7IRM3tNbCc0e_WzZBDc_PLtVWAaGZbQu8,1323
9
+ opencloudtool-0.4.1.dist-info/WHEEL,sha256=pwIk_YVe3uDmt-QV5nznwGvt6Ys6jyf64oBs53DU5Sk,103
10
+ opencloudtool-0.4.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.9.3)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-abi3-macosx_11_0_arm64