alphai 0.2.1__py3-none-any.whl → 0.3.0__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.
- alphai/__init__.py +3 -3
- alphai/client.py +19 -19
- alphai/docker.py +6 -5
- alphai/jupyter_manager.py +1 -0
- alphai-0.3.0.dist-info/METADATA +148 -0
- {alphai-0.2.1.dist-info → alphai-0.3.0.dist-info}/RECORD +9 -9
- {alphai-0.2.1.dist-info → alphai-0.3.0.dist-info}/WHEEL +1 -1
- alphai-0.2.1.dist-info/METADATA +0 -395
- {alphai-0.2.1.dist-info → alphai-0.3.0.dist-info}/entry_points.txt +0 -0
- {alphai-0.2.1.dist-info → alphai-0.3.0.dist-info}/top_level.txt +0 -0
alphai/__init__.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""alphai - A CLI tool and Python package for the runalph.ai platform."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.
|
|
4
|
-
__author__ = "
|
|
5
|
-
__email__ = "
|
|
3
|
+
__version__ = "0.3.0"
|
|
4
|
+
__author__ = "Alph"
|
|
5
|
+
__email__ = "info@runalph.ai"
|
|
6
6
|
|
|
7
7
|
from .client import AlphAIClient
|
|
8
8
|
from .config import Config
|
alphai/client.py
CHANGED
|
@@ -95,10 +95,10 @@ class AlphAIClient:
|
|
|
95
95
|
def create_organization(self, name: str, description: Optional[str] = None) -> Optional[Dict[str, Any]]:
|
|
96
96
|
"""Create a new organization."""
|
|
97
97
|
try:
|
|
98
|
-
response = self.sdk.orgs.create(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
response = self.sdk.orgs.create(
|
|
99
|
+
name=name,
|
|
100
|
+
description=description or ""
|
|
101
|
+
)
|
|
102
102
|
if response.result.status == "success":
|
|
103
103
|
self.console.print(f"[green]✓ Organization '{name}' created successfully[/green]")
|
|
104
104
|
return response.result.organization
|
|
@@ -257,12 +257,12 @@ class AlphAIClient:
|
|
|
257
257
|
) -> Optional[Dict[str, Any]]:
|
|
258
258
|
"""Create a new tunnel and return the tunnel data including token."""
|
|
259
259
|
try:
|
|
260
|
-
response = self.sdk.tunnels.create(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
response = self.sdk.tunnels.create(
|
|
261
|
+
org_slug=org_slug,
|
|
262
|
+
project_name=project_name,
|
|
263
|
+
app_port=app_port,
|
|
264
|
+
jupyter_port=jupyter_port
|
|
265
|
+
)
|
|
266
266
|
|
|
267
267
|
if response.result.status == "success":
|
|
268
268
|
tunnel_data = response.result.data
|
|
@@ -310,15 +310,15 @@ class AlphAIClient:
|
|
|
310
310
|
) -> Optional[Dict[str, Any]]:
|
|
311
311
|
"""Create a new project."""
|
|
312
312
|
try:
|
|
313
|
-
response = self.sdk.projects.create(
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
313
|
+
response = self.sdk.projects.create(
|
|
314
|
+
name=name,
|
|
315
|
+
organization_id=organization_id,
|
|
316
|
+
port=port,
|
|
317
|
+
url=url,
|
|
318
|
+
port_forward_url=port_forward_url,
|
|
319
|
+
token=token,
|
|
320
|
+
server_request="external",
|
|
321
|
+
)
|
|
322
322
|
|
|
323
323
|
if response.result.status == "success":
|
|
324
324
|
project_data = response.result.project # Use 'project' instead of 'data'
|
alphai/docker.py
CHANGED
|
@@ -591,13 +591,13 @@ class DockerManager:
|
|
|
591
591
|
# Improved Jupyter startup commands with better compatibility
|
|
592
592
|
jupyter_commands = [
|
|
593
593
|
# Jupyter Lab (modern preferred)
|
|
594
|
-
f"jupyter lab --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --ServerApp.token={jupyter_token} --ServerApp.allow_origin='*' --ServerApp.base_url=/ --ServerApp.terminado_settings='{{\"shell_command\":[\"/bin/bash\"]}}'",
|
|
594
|
+
f"jupyter lab --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --ServerApp.token={jupyter_token} --ServerApp.allow_origin='*' --ServerApp.base_url=/ --ServerApp.terminado_settings='{{\"shell_command\":[\"/bin/bash\"]}}' --ContentsManager.allow_hidden=True",
|
|
595
595
|
# Jupyter Lab with python -m (fallback)
|
|
596
|
-
f"python -m jupyter lab --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --ServerApp.token={jupyter_token} --ServerApp.allow_origin='*'",
|
|
596
|
+
f"python -m jupyter lab --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --ServerApp.token={jupyter_token} --ServerApp.allow_origin='*' --ContentsManager.allow_hidden=True",
|
|
597
597
|
# Jupyter Notebook (legacy compatibility)
|
|
598
|
-
f"jupyter notebook --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --NotebookApp.token={jupyter_token} --NotebookApp.allow_origin='*'",
|
|
598
|
+
f"jupyter notebook --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --NotebookApp.token={jupyter_token} --NotebookApp.allow_origin='*' --ContentsManager.allow_hidden=True",
|
|
599
599
|
# Jupyter Notebook with python -m
|
|
600
|
-
f"python -m jupyter notebook --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --NotebookApp.token={jupyter_token} --NotebookApp.allow_origin='*'"
|
|
600
|
+
f"python -m jupyter notebook --ip=0.0.0.0 --port={jupyter_port} --no-browser --allow-root --NotebookApp.token={jupyter_token} --NotebookApp.allow_origin='*' --ContentsManager.allow_hidden=True"
|
|
601
601
|
]
|
|
602
602
|
|
|
603
603
|
for i, cmd in enumerate(jupyter_commands):
|
|
@@ -669,7 +669,8 @@ class DockerManager:
|
|
|
669
669
|
f"jupyter lab --ip=0.0.0.0 --port={jupyter_port} "
|
|
670
670
|
f"--no-browser --allow-root --token={jupyter_token} "
|
|
671
671
|
f"--NotebookApp.allow_origin='*' "
|
|
672
|
-
f"--ServerApp.terminado_settings='{{\"shell_command\":[\"/bin/bash\"]}}'"
|
|
672
|
+
f"--ServerApp.terminado_settings='{{\"shell_command\":[\"/bin/bash\"]}}' "
|
|
673
|
+
f"--ContentsManager.allow_hidden=True"
|
|
673
674
|
)
|
|
674
675
|
|
|
675
676
|
def generate_jupyter_token(self) -> str:
|
alphai/jupyter_manager.py
CHANGED
|
@@ -74,6 +74,7 @@ class JupyterManager:
|
|
|
74
74
|
f'--port={port}',
|
|
75
75
|
'--no-browser', # We'll open browser to cloud URL instead
|
|
76
76
|
'--ServerApp.allow_origin=*',
|
|
77
|
+
'--ContentsManager.allow_hidden=True', # Allow access to dotfiles like .env
|
|
77
78
|
]
|
|
78
79
|
|
|
79
80
|
# Add token (different format for lab vs notebook)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: alphai
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A CLI tool and Python package for the runalph.ai platform
|
|
5
|
+
Author-email: Andrew Chang <andrew@runalph.ai>
|
|
6
|
+
Project-URL: Homepage, https://runalph.ai
|
|
7
|
+
Project-URL: Documentation, https://docs.runalph.ai
|
|
8
|
+
Project-URL: Repository, https://github.com/alph-ai/alphai
|
|
9
|
+
Project-URL: Issues, https://github.com/alph-ai/alphai/issues
|
|
10
|
+
Keywords: cli,api,data-science,alph
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: click>=8.1.0
|
|
21
|
+
Requires-Dist: rich>=13.0.0
|
|
22
|
+
Requires-Dist: alph-sdk>=0.7.0
|
|
23
|
+
Requires-Dist: httpx>=0.25.0
|
|
24
|
+
Requires-Dist: pydantic>=2.0.0
|
|
25
|
+
Requires-Dist: questionary>=2.1.0
|
|
26
|
+
Requires-Dist: jupyterlab>=4.5.1
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
33
|
+
|
|
34
|
+
# alphai
|
|
35
|
+
|
|
36
|
+
A CLI tool and Python package for the [runalph.ai](https://runalph.ai) platform.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install alphai
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
1. **Authenticate** with your runalph.ai account:
|
|
47
|
+
```bash
|
|
48
|
+
alphai login
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. **Start JupyterLab** connected to Alph:
|
|
52
|
+
```bash
|
|
53
|
+
alphai jupyter lab
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This will prompt you to select an organization and project, then start JupyterLab locally with cloud sync.
|
|
57
|
+
|
|
58
|
+
3. **Manage notebooks**:
|
|
59
|
+
```bash
|
|
60
|
+
alphai nb
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Opens an interactive browser to view, upload, download, and manage your notebooks.
|
|
64
|
+
|
|
65
|
+
## Commands
|
|
66
|
+
|
|
67
|
+
### Authentication
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
alphai login # Browser-based login (recommended)
|
|
71
|
+
alphai login --token TOK # Login with a token from runalph.ai/account/tokens
|
|
72
|
+
alphai login --force # Force re-authentication
|
|
73
|
+
alphai logout # Clear credentials
|
|
74
|
+
alphai status # Show auth status and config
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Jupyter
|
|
78
|
+
|
|
79
|
+
Start JupyterLab or Jupyter Notebook locally, connected to your Alph workspace:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
alphai jupyter lab # Interactive org/project selection
|
|
83
|
+
alphai jupyter lab --org my-org --project my-project
|
|
84
|
+
alphai jupyter lab --port 9999 # Custom port
|
|
85
|
+
alphai jupyter lab --local-only # Skip cloud connection
|
|
86
|
+
alphai jupyter lab --quiet # Suppress Jupyter logs
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
alphai jupyter notebook # Classic notebook interface
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Notebooks
|
|
94
|
+
|
|
95
|
+
Manage notebooks from the command line:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
alphai nb # Interactive browser
|
|
99
|
+
alphai nb list # List notebooks
|
|
100
|
+
alphai nb list --org my-org # List in specific org
|
|
101
|
+
alphai nb view <notebook-id> # View in terminal
|
|
102
|
+
alphai nb info <notebook-id> # Show notebook info
|
|
103
|
+
alphai nb upload analysis.ipynb --org my-org
|
|
104
|
+
alphai nb download <notebook-id>
|
|
105
|
+
alphai nb publish <notebook-id> # Make public
|
|
106
|
+
alphai nb unpublish <notebook-id> # Make private
|
|
107
|
+
alphai nb delete <notebook-id>
|
|
108
|
+
alphai nb search "machine learning"
|
|
109
|
+
alphai nb fork <notebook-id> --org my-org
|
|
110
|
+
alphai nb tags <notebook-id> --add "python,ml"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Organizations & Projects
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
alphai orgs list # List your organizations
|
|
117
|
+
alphai orgs select <org-id> # Set current org context
|
|
118
|
+
|
|
119
|
+
alphai projects list # List projects
|
|
120
|
+
alphai projects select <id> # Set current project context
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Configuration
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
alphai config show # View current config
|
|
127
|
+
alphai config set key value # Set a config value
|
|
128
|
+
alphai config reset # Reset to defaults
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Environment Variables
|
|
132
|
+
|
|
133
|
+
- `ALPHAI_BEARER_TOKEN`: Bearer token for authentication
|
|
134
|
+
- `ALPHAI_API_URL`: Custom API base URL
|
|
135
|
+
- `ALPHAI_DEBUG`: Enable debug mode
|
|
136
|
+
|
|
137
|
+
## Global Options
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
alphai --debug <command> # Enable debug logging
|
|
141
|
+
alphai --version # Show version
|
|
142
|
+
alphai --help # Show help
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Learn More
|
|
146
|
+
|
|
147
|
+
- Documentation: [docs.runalph.ai](https://docs.runalph.ai)
|
|
148
|
+
- Website: [runalph.ai](https://runalph.ai)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
alphai/__init__.py,sha256=
|
|
1
|
+
alphai/__init__.py,sha256=CiFiQKpGlqtwOFv4eABFUYaV6dhEtLYph5Qw9vgAioM,1030
|
|
2
2
|
alphai/auth.py,sha256=rmMlikW9M0wVlNb8FXixrvcemPLaKXFO3Ocaiijjge8,15589
|
|
3
3
|
alphai/cleanup.py,sha256=JEgysHuvK0sR1X4M5u0mBdKB8Kz1KIyF7fhW0i4uU0Q,12250
|
|
4
4
|
alphai/cli.py,sha256=HTSqjDOJPAGj4WqsCFavjUEGqx4rzQ_a6CahhfRyU04,4660
|
|
5
|
-
alphai/client.py,sha256=
|
|
5
|
+
alphai/client.py,sha256=9DuBydlwwd6jUhgZhiEh8X-2fkn8IgfTH0yylzDSVeQ,18821
|
|
6
6
|
alphai/config.py,sha256=b6494qVN_lN2Xuy64W7Ceo5fAnP5f97Z2wH5-lIHMQQ,3449
|
|
7
|
-
alphai/docker.py,sha256=
|
|
7
|
+
alphai/docker.py,sha256=2fVW-LyIs5PYzA7oJCR-FAtgXL4TmenCjp4boy2qYFE,32583
|
|
8
8
|
alphai/exceptions.py,sha256=ShSHxwc7WnsMu2ugRUxNgF4C9bipKu0_PvfoK7591dE,3401
|
|
9
|
-
alphai/jupyter_manager.py,sha256
|
|
9
|
+
alphai/jupyter_manager.py,sha256=-02X4MzqKoWLPfSiHEk1cDe3RITvO5OGwXI61KbLEu8,23801
|
|
10
10
|
alphai/notebook_renderer.py,sha256=RFaoUnicMYfTUJOd2dUQjab-ZBpomyK5RbpbjiGBBjU,18393
|
|
11
11
|
alphai/utils.py,sha256=-zqDCRBS_D20xGzRCN-BVuwyt1jmF2-A6Y4_arOTvUE,7651
|
|
12
12
|
alphai/commands/__init__.py,sha256=8ZFsPVBcT4KqgVv7xLI_uiv_Sb2FGDyStFF5Gcsjnd4,528
|
|
@@ -16,8 +16,8 @@ alphai/commands/jupyter.py,sha256=UzKZvloB0J4iwri59PZ_EK_imXjKVDGvG4hyAUJ24Pk,13
|
|
|
16
16
|
alphai/commands/notebooks.py,sha256=vZK5EX-8wmvlFUwe66FjAWq1bQgDvOnV4OkvrT-vbjk,43195
|
|
17
17
|
alphai/commands/orgs.py,sha256=qhcuXXTCfwxspe3SAgpaITyyqPye2747jPNz91ysHv4,735
|
|
18
18
|
alphai/commands/projects.py,sha256=-udwF_cew5DUR9m_BhHjjm2cFEJb1HBtWeiKdzrNPlQ,988
|
|
19
|
-
alphai-0.
|
|
20
|
-
alphai-0.
|
|
21
|
-
alphai-0.
|
|
22
|
-
alphai-0.
|
|
23
|
-
alphai-0.
|
|
19
|
+
alphai-0.3.0.dist-info/METADATA,sha256=QieUCoQXmjbko_uLFYBd3ovXMrJ4Y-vcfaeAUJfegKM,4385
|
|
20
|
+
alphai-0.3.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
21
|
+
alphai-0.3.0.dist-info/entry_points.txt,sha256=ITOwv5erK-gjYw47KsOoENHvIAUW_ynEsEMLZ7GHZwA,43
|
|
22
|
+
alphai-0.3.0.dist-info/top_level.txt,sha256=dFmybyT4Kzcgpsccun8RnBxkm9lK0Y0TPfaVe2FyxNY,7
|
|
23
|
+
alphai-0.3.0.dist-info/RECORD,,
|
alphai-0.2.1.dist-info/METADATA
DELETED
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: alphai
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: A CLI tool and Python package for the runalph.ai platform
|
|
5
|
-
Author-email: Andrew Chang <andrew@runalph.ai>
|
|
6
|
-
Project-URL: Homepage, https://runalph.ai
|
|
7
|
-
Project-URL: Documentation, https://docs.runalph.ai
|
|
8
|
-
Project-URL: Repository, https://github.com/alph-ai/alphai
|
|
9
|
-
Project-URL: Issues, https://github.com/alph-ai/alphai/issues
|
|
10
|
-
Keywords: cli,api,data-science,alph
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
-
Requires-Python: >=3.10
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
Requires-Dist: click>=8.1.0
|
|
21
|
-
Requires-Dist: rich>=13.0.0
|
|
22
|
-
Requires-Dist: alph-sdk>=0.5.0
|
|
23
|
-
Requires-Dist: httpx>=0.25.0
|
|
24
|
-
Requires-Dist: pydantic>=2.0.0
|
|
25
|
-
Requires-Dist: questionary>=2.1.0
|
|
26
|
-
Requires-Dist: jupyterlab>=4.5.1
|
|
27
|
-
Provides-Extra: dev
|
|
28
|
-
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
29
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
30
|
-
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
31
|
-
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
32
|
-
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
33
|
-
|
|
34
|
-
# alphai
|
|
35
|
-
|
|
36
|
-
A beautiful and powerful CLI tool and Python package for the runalph.ai platform, built with Click and Rich.
|
|
37
|
-
|
|
38
|
-
Depends on the `alph-sdk` Python SDK for seamless API integration.
|
|
39
|
-
|
|
40
|
-
## Installation
|
|
41
|
-
|
|
42
|
-
The CLI is automatically installed when you install the Python package:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
pip install alphai
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Quick Start
|
|
49
|
-
|
|
50
|
-
1. **Authenticate** with your runalph.ai account:
|
|
51
|
-
```bash
|
|
52
|
-
alphai login
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
2. **View your status**:
|
|
56
|
-
```bash
|
|
57
|
-
alphai status
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
3. **List organizations**:
|
|
61
|
-
```bash
|
|
62
|
-
alphai orgs list
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
4. **List projects**:
|
|
66
|
-
```bash
|
|
67
|
-
alphai projects list
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
5. **Run a Docker container**:
|
|
71
|
-
```bash
|
|
72
|
-
alphai run --image quay.io/jupyter/base-notebook:latest
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Commands
|
|
76
|
-
|
|
77
|
-
### Authentication
|
|
78
|
-
|
|
79
|
-
#### `alphai login`
|
|
80
|
-
Authenticate with the runalph.ai API using browser-based authentication or a bearer token.
|
|
81
|
-
|
|
82
|
-
**Smart authentication checking**: The login command automatically checks if you're already authenticated and validates your existing credentials. If you're already logged in with a valid token, it will skip the login process.
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Interactive login (browser-based, recommended)
|
|
86
|
-
alphai login
|
|
87
|
-
|
|
88
|
-
# Browser-based login (explicit)
|
|
89
|
-
alphai login --browser
|
|
90
|
-
|
|
91
|
-
# Login with token directly
|
|
92
|
-
alphai login --token YOUR_BEARER_TOKEN
|
|
93
|
-
|
|
94
|
-
# Force re-authentication even if already logged in
|
|
95
|
-
alphai login --force
|
|
96
|
-
|
|
97
|
-
# Login with custom API URL
|
|
98
|
-
alphai login --api-url https://runalph.ai/api --token YOUR_TOKEN
|
|
99
|
-
|
|
100
|
-
# Force browser login even if already authenticated
|
|
101
|
-
alphai login --browser --force
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Authentication methods:**
|
|
105
|
-
1. **Browser login (recommended)**: Opens your browser for secure OAuth authentication
|
|
106
|
-
2. **Token login**: Manually enter a bearer token from https://runalph.ai/account/tokens
|
|
107
|
-
|
|
108
|
-
**Options:**
|
|
109
|
-
- `--token`: Provide a bearer token directly (bypasses authentication check)
|
|
110
|
-
- `--browser`: Use browser-based authentication explicitly
|
|
111
|
-
- `--force`: Force re-authentication even if already logged in
|
|
112
|
-
- `--api-url`: Set a custom API base URL
|
|
113
|
-
|
|
114
|
-
You can also set the `ALPHAI_BEARER_TOKEN` environment variable to authenticate automatically.
|
|
115
|
-
|
|
116
|
-
#### `alphai logout`
|
|
117
|
-
Log out and clear authentication credentials.
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
alphai logout
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
#### `alphai status`
|
|
124
|
-
Show current configuration and authentication status.
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
alphai status
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Organizations
|
|
131
|
-
|
|
132
|
-
#### `alphai orgs list`
|
|
133
|
-
List all organizations you have access to.
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
alphai orgs list
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
#### `alphai orgs create`
|
|
140
|
-
Create a new organization.
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
# Create with name only
|
|
144
|
-
alphai orgs create --name "My Organization"
|
|
145
|
-
|
|
146
|
-
# Create with name and description
|
|
147
|
-
alphai orgs create --name "My Org" --description "A sample organization"
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### `alphai orgs select`
|
|
151
|
-
Select an organization as your current context.
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
alphai orgs select ORG_ID
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Projects
|
|
158
|
-
|
|
159
|
-
#### `alphai projects list`
|
|
160
|
-
List all projects, optionally filtered by organization.
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# List all projects
|
|
164
|
-
alphai projects list
|
|
165
|
-
|
|
166
|
-
# List projects in a specific organization
|
|
167
|
-
alphai projects list --org ORG_ID
|
|
168
|
-
|
|
169
|
-
# List projects in current organization context
|
|
170
|
-
alphai orgs select ORG_ID
|
|
171
|
-
alphai projects list
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
#### `alphai projects select`
|
|
175
|
-
Select a project as your current context.
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
alphai projects select PROJECT_ID
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Docker Container Management
|
|
182
|
-
|
|
183
|
-
#### `alphai run`
|
|
184
|
-
Launch and manage local Docker containers with beautiful progress indicators.
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
# Basic usage - run Jupyter notebook
|
|
188
|
-
alphai run --image quay.io/jupyter/base-notebook:latest
|
|
189
|
-
|
|
190
|
-
# Custom ports
|
|
191
|
-
alphai run --image quay.io/jupyter/base-notebook:latest --app-port 3000 --jupyter-port 9999
|
|
192
|
-
|
|
193
|
-
# Run in background (detached)
|
|
194
|
-
alphai run --image quay.io/jupyter/base-notebook:latest --detach
|
|
195
|
-
|
|
196
|
-
# With custom name
|
|
197
|
-
alphai run --image python:3.11 --name my-python-env
|
|
198
|
-
|
|
199
|
-
# With environment variables
|
|
200
|
-
alphai run --image python:3.11 --env "DEBUG=true" --env "API_KEY=secret"
|
|
201
|
-
|
|
202
|
-
# With volume mounts
|
|
203
|
-
alphai run --image python:3.11 --volume "/host/path:/container/path" --volume "/data:/app/data"
|
|
204
|
-
|
|
205
|
-
# Complex example
|
|
206
|
-
alphai run \
|
|
207
|
-
--image quay.io/jupyter/base-notebook:latest \
|
|
208
|
-
--name jupyter-dev \
|
|
209
|
-
--app-port 5000 \
|
|
210
|
-
--jupyter-port 8888 \
|
|
211
|
-
--env "JUPYTER_ENABLE_LAB=yes" \
|
|
212
|
-
--volume "$(pwd):/home/jovyan/work" \
|
|
213
|
-
--detach
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
**Supported options:**
|
|
217
|
-
- `--image`: Docker image to run (required)
|
|
218
|
-
- `--app-port`: Application port (default: 5000)
|
|
219
|
-
- `--jupyter-port`: Jupyter port (default: 8888)
|
|
220
|
-
- `--name`: Container name (auto-generated if not specified)
|
|
221
|
-
- `--env`: Environment variables (format: `KEY=VALUE`, can be used multiple times)
|
|
222
|
-
- `--volume`: Volume mounts (format: `HOST_PATH:CONTAINER_PATH`, can be used multiple times)
|
|
223
|
-
- `--detach, -d`: Run container in background
|
|
224
|
-
|
|
225
|
-
### Configuration Management
|
|
226
|
-
|
|
227
|
-
#### `alphai config show`
|
|
228
|
-
Show current configuration.
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
alphai config show
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
#### `alphai config set`
|
|
235
|
-
Set configuration values.
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
# Set API URL
|
|
239
|
-
alphai config set api_url https://runalph.ai/api
|
|
240
|
-
|
|
241
|
-
# Enable debug mode
|
|
242
|
-
alphai config set debug true
|
|
243
|
-
|
|
244
|
-
# Set current organization
|
|
245
|
-
alphai config set current_org ORG_ID
|
|
246
|
-
|
|
247
|
-
# Set current project
|
|
248
|
-
alphai config set current_project PROJECT_ID
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
#### `alphai config reset`
|
|
252
|
-
Reset configuration to defaults.
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
alphai config reset
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
## Global Options
|
|
259
|
-
|
|
260
|
-
- `--debug`: Enable debug mode for the current command
|
|
261
|
-
- `--version`: Show version information
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
# Enable debug mode
|
|
265
|
-
alphai --debug orgs list
|
|
266
|
-
|
|
267
|
-
# Show version
|
|
268
|
-
alphai --version
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
## Environment Variables
|
|
272
|
-
|
|
273
|
-
- `ALPHAI_BEARER_TOKEN`: Bearer token for authentication
|
|
274
|
-
- `ALPHAI_API_URL`: Custom API base URL
|
|
275
|
-
- `ALPHAI_DEBUG`: Enable debug mode (set to `true`, `1`, `yes`, or `on`)
|
|
276
|
-
|
|
277
|
-
## Configuration
|
|
278
|
-
|
|
279
|
-
Configuration is stored in `~/.alphai/config.json`. Bearer tokens are securely stored in your system's keyring.
|
|
280
|
-
|
|
281
|
-
Example configuration:
|
|
282
|
-
```json
|
|
283
|
-
{
|
|
284
|
-
"api_url": "https://runalph.ai/api",
|
|
285
|
-
"current_org": "org_123",
|
|
286
|
-
"current_project": "proj_456",
|
|
287
|
-
"debug": false
|
|
288
|
-
}
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Features
|
|
292
|
-
|
|
293
|
-
### Beautiful CLI Interface
|
|
294
|
-
- 🎨 Rich terminal UI with colors and formatting
|
|
295
|
-
- 📊 Beautiful tables for data display
|
|
296
|
-
- ⏳ Progress indicators for long-running operations
|
|
297
|
-
- 🔐 Secure credential storage with keyring
|
|
298
|
-
|
|
299
|
-
### Docker Integration
|
|
300
|
-
- 🐳 Seamless Docker container management
|
|
301
|
-
- 📦 Automatic image pulling with progress
|
|
302
|
-
- 🔧 Support for custom ports, environment variables, and volumes
|
|
303
|
-
- 🚀 Background and interactive modes
|
|
304
|
-
|
|
305
|
-
### Smart Configuration
|
|
306
|
-
- 💾 Persistent configuration with secure token storage
|
|
307
|
-
- 🏢 Organization and project context management
|
|
308
|
-
- 🔧 Environment variable support
|
|
309
|
-
- 🔄 Easy configuration reset
|
|
310
|
-
|
|
311
|
-
### Error Handling
|
|
312
|
-
- 🛡️ Comprehensive error handling and user feedback
|
|
313
|
-
- 🔍 Debug mode for troubleshooting
|
|
314
|
-
- ⚡ Connection testing and validation
|
|
315
|
-
|
|
316
|
-
## Development
|
|
317
|
-
|
|
318
|
-
To set up for development:
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# Clone the repository
|
|
322
|
-
git clone https://github.com/americandatascience/alphai.git
|
|
323
|
-
cd alphai
|
|
324
|
-
|
|
325
|
-
# Install in development mode
|
|
326
|
-
pip install -e ".[dev]"
|
|
327
|
-
|
|
328
|
-
# Run tests
|
|
329
|
-
pytest
|
|
330
|
-
|
|
331
|
-
# Run linting
|
|
332
|
-
ruff check src/
|
|
333
|
-
black src/
|
|
334
|
-
|
|
335
|
-
# Type checking
|
|
336
|
-
mypy src/
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
## API Integration
|
|
340
|
-
|
|
341
|
-
This CLI uses the `alph-sdk` to interact with the runalph.ai API. All API operations are wrapped with beautiful progress indicators and error handling.
|
|
342
|
-
|
|
343
|
-
The CLI automatically:
|
|
344
|
-
- Validates bearer tokens before making API calls
|
|
345
|
-
- Provides helpful error messages for common issues
|
|
346
|
-
- Handles connection timeouts and network errors gracefully
|
|
347
|
-
- Uses secure credential storage
|
|
348
|
-
|
|
349
|
-
## Examples
|
|
350
|
-
|
|
351
|
-
### Complete Workflow
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
# 1. Login
|
|
355
|
-
alphai login
|
|
356
|
-
|
|
357
|
-
# 2. List organizations and select one
|
|
358
|
-
alphai orgs list
|
|
359
|
-
alphai orgs select org_abc123
|
|
360
|
-
|
|
361
|
-
# 3. List projects in the organization
|
|
362
|
-
alphai projects list
|
|
363
|
-
|
|
364
|
-
# 4. Run a development environment
|
|
365
|
-
alphai run \
|
|
366
|
-
--image quay.io/jupyter/datascience-notebook:latest \
|
|
367
|
-
--name datascience-env \
|
|
368
|
-
--volume "$(pwd):/home/jovyan/work" \
|
|
369
|
-
--env "JUPYTER_ENABLE_LAB=yes" \
|
|
370
|
-
--detach
|
|
371
|
-
|
|
372
|
-
# 5. Check status
|
|
373
|
-
alphai status
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### Multiple Containers
|
|
377
|
-
|
|
378
|
-
```bash
|
|
379
|
-
# Start a web application
|
|
380
|
-
alphai run --image nginx:latest --app-port 80 --name web-server --detach
|
|
381
|
-
|
|
382
|
-
# Start a database
|
|
383
|
-
alphai run --image postgres:13 --app-port 5432 --name database \
|
|
384
|
-
--env "POSTGRES_PASSWORD=secret" --detach
|
|
385
|
-
|
|
386
|
-
# Start a development environment
|
|
387
|
-
alphai run --image python:3.11 --name dev-env \
|
|
388
|
-
--volume "$(pwd):/app" --env "PYTHONPATH=/app"
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
## Support
|
|
392
|
-
|
|
393
|
-
- Documentation: https://docs.runalph.ai
|
|
394
|
-
- Issues: https://github.com/americandatascience/alphai/issues
|
|
395
|
-
- Website: https://runalph.ai
|
|
File without changes
|
|
File without changes
|