alphai 0.0.6__tar.gz → 0.1.0__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.
alphai-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,394 @@
1
+ Metadata-Version: 2.4
2
+ Name: alphai
3
+ Version: 0.1.0
4
+ Summary: A CLI tool and Python package for the runalph.ai platform
5
+ Author-email: American Data Science <support@americandatascience.com>
6
+ Project-URL: Homepage, https://runalph.ai
7
+ Project-URL: Documentation, https://docs.runalph.ai
8
+ Project-URL: Repository, https://github.com/americandatascience/alphai
9
+ Project-URL: Issues, https://github.com/americandatascience/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.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: click>=8.1.0
19
+ Requires-Dist: rich>=13.0.0
20
+ Requires-Dist: alph-sdk>=0.1.0
21
+ Requires-Dist: httpx>=0.25.0
22
+ Requires-Dist: pydantic>=2.0.0
23
+ Requires-Dist: keyring>=24.0.0
24
+ Requires-Dist: typer>=0.9.0
25
+ Requires-Dist: questionary>=2.1.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
28
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
29
+ Requires-Dist: black>=23.0.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
31
+ Requires-Dist: mypy>=1.5.0; extra == "dev"
32
+
33
+ # alphai
34
+
35
+ A beautiful and powerful CLI tool and Python package for the runalph.ai platform, built with Click and Rich.
36
+
37
+ Depends on the `alph-sdk` Python SDK for seamless API integration.
38
+
39
+ ## Installation
40
+
41
+ The CLI is automatically installed when you install the Python package:
42
+
43
+ ```bash
44
+ pip install alphai
45
+ ```
46
+
47
+ ## Quick Start
48
+
49
+ 1. **Authenticate** with your runalph.ai account:
50
+ ```bash
51
+ alphai login
52
+ ```
53
+
54
+ 2. **View your status**:
55
+ ```bash
56
+ alphai status
57
+ ```
58
+
59
+ 3. **List organizations**:
60
+ ```bash
61
+ alphai orgs list
62
+ ```
63
+
64
+ 4. **List projects**:
65
+ ```bash
66
+ alphai projects list
67
+ ```
68
+
69
+ 5. **Run a Docker container**:
70
+ ```bash
71
+ alphai run --image quay.io/jupyter/base-notebook:latest
72
+ ```
73
+
74
+ ## Commands
75
+
76
+ ### Authentication
77
+
78
+ #### `alphai login`
79
+ Authenticate with the runalph.ai API using browser-based authentication or a bearer token.
80
+
81
+ **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.
82
+
83
+ ```bash
84
+ # Interactive login (browser-based, recommended)
85
+ alphai login
86
+
87
+ # Browser-based login (explicit)
88
+ alphai login --browser
89
+
90
+ # Login with token directly
91
+ alphai login --token YOUR_BEARER_TOKEN
92
+
93
+ # Force re-authentication even if already logged in
94
+ alphai login --force
95
+
96
+ # Login with custom API URL
97
+ alphai login --api-url https://runalph.ai/api --token YOUR_TOKEN
98
+
99
+ # Force browser login even if already authenticated
100
+ alphai login --browser --force
101
+ ```
102
+
103
+ **Authentication methods:**
104
+ 1. **Browser login (recommended)**: Opens your browser for secure OAuth authentication
105
+ 2. **Token login**: Manually enter a bearer token from https://runalph.ai/account/tokens
106
+
107
+ **Options:**
108
+ - `--token`: Provide a bearer token directly (bypasses authentication check)
109
+ - `--browser`: Use browser-based authentication explicitly
110
+ - `--force`: Force re-authentication even if already logged in
111
+ - `--api-url`: Set a custom API base URL
112
+
113
+ You can also set the `ALPHAI_BEARER_TOKEN` environment variable to authenticate automatically.
114
+
115
+ #### `alphai logout`
116
+ Log out and clear authentication credentials.
117
+
118
+ ```bash
119
+ alphai logout
120
+ ```
121
+
122
+ #### `alphai status`
123
+ Show current configuration and authentication status.
124
+
125
+ ```bash
126
+ alphai status
127
+ ```
128
+
129
+ ### Organizations
130
+
131
+ #### `alphai orgs list`
132
+ List all organizations you have access to.
133
+
134
+ ```bash
135
+ alphai orgs list
136
+ ```
137
+
138
+ #### `alphai orgs create`
139
+ Create a new organization.
140
+
141
+ ```bash
142
+ # Create with name only
143
+ alphai orgs create --name "My Organization"
144
+
145
+ # Create with name and description
146
+ alphai orgs create --name "My Org" --description "A sample organization"
147
+ ```
148
+
149
+ #### `alphai orgs select`
150
+ Select an organization as your current context.
151
+
152
+ ```bash
153
+ alphai orgs select ORG_ID
154
+ ```
155
+
156
+ ### Projects
157
+
158
+ #### `alphai projects list`
159
+ List all projects, optionally filtered by organization.
160
+
161
+ ```bash
162
+ # List all projects
163
+ alphai projects list
164
+
165
+ # List projects in a specific organization
166
+ alphai projects list --org ORG_ID
167
+
168
+ # List projects in current organization context
169
+ alphai orgs select ORG_ID
170
+ alphai projects list
171
+ ```
172
+
173
+ #### `alphai projects select`
174
+ Select a project as your current context.
175
+
176
+ ```bash
177
+ alphai projects select PROJECT_ID
178
+ ```
179
+
180
+ ### Docker Container Management
181
+
182
+ #### `alphai run`
183
+ Launch and manage local Docker containers with beautiful progress indicators.
184
+
185
+ ```bash
186
+ # Basic usage - run Jupyter notebook
187
+ alphai run --image quay.io/jupyter/base-notebook:latest
188
+
189
+ # Custom ports
190
+ alphai run --image quay.io/jupyter/base-notebook:latest --app-port 3000 --jupyter-port 9999
191
+
192
+ # Run in background (detached)
193
+ alphai run --image quay.io/jupyter/base-notebook:latest --detach
194
+
195
+ # With custom name
196
+ alphai run --image python:3.11 --name my-python-env
197
+
198
+ # With environment variables
199
+ alphai run --image python:3.11 --env "DEBUG=true" --env "API_KEY=secret"
200
+
201
+ # With volume mounts
202
+ alphai run --image python:3.11 --volume "/host/path:/container/path" --volume "/data:/app/data"
203
+
204
+ # Complex example
205
+ alphai run \
206
+ --image quay.io/jupyter/base-notebook:latest \
207
+ --name jupyter-dev \
208
+ --app-port 5000 \
209
+ --jupyter-port 8888 \
210
+ --env "JUPYTER_ENABLE_LAB=yes" \
211
+ --volume "$(pwd):/home/jovyan/work" \
212
+ --detach
213
+ ```
214
+
215
+ **Supported options:**
216
+ - `--image`: Docker image to run (required)
217
+ - `--app-port`: Application port (default: 5000)
218
+ - `--jupyter-port`: Jupyter port (default: 8888)
219
+ - `--name`: Container name (auto-generated if not specified)
220
+ - `--env`: Environment variables (format: `KEY=VALUE`, can be used multiple times)
221
+ - `--volume`: Volume mounts (format: `HOST_PATH:CONTAINER_PATH`, can be used multiple times)
222
+ - `--detach, -d`: Run container in background
223
+
224
+ ### Configuration Management
225
+
226
+ #### `alphai config show`
227
+ Show current configuration.
228
+
229
+ ```bash
230
+ alphai config show
231
+ ```
232
+
233
+ #### `alphai config set`
234
+ Set configuration values.
235
+
236
+ ```bash
237
+ # Set API URL
238
+ alphai config set api_url https://runalph.ai/api
239
+
240
+ # Enable debug mode
241
+ alphai config set debug true
242
+
243
+ # Set current organization
244
+ alphai config set current_org ORG_ID
245
+
246
+ # Set current project
247
+ alphai config set current_project PROJECT_ID
248
+ ```
249
+
250
+ #### `alphai config reset`
251
+ Reset configuration to defaults.
252
+
253
+ ```bash
254
+ alphai config reset
255
+ ```
256
+
257
+ ## Global Options
258
+
259
+ - `--debug`: Enable debug mode for the current command
260
+ - `--version`: Show version information
261
+
262
+ ```bash
263
+ # Enable debug mode
264
+ alphai --debug orgs list
265
+
266
+ # Show version
267
+ alphai --version
268
+ ```
269
+
270
+ ## Environment Variables
271
+
272
+ - `ALPHAI_BEARER_TOKEN`: Bearer token for authentication
273
+ - `ALPHAI_API_URL`: Custom API base URL
274
+ - `ALPHAI_DEBUG`: Enable debug mode (set to `true`, `1`, `yes`, or `on`)
275
+
276
+ ## Configuration
277
+
278
+ Configuration is stored in `~/.alphai/config.json`. Bearer tokens are securely stored in your system's keyring.
279
+
280
+ Example configuration:
281
+ ```json
282
+ {
283
+ "api_url": "https://runalph.ai/api",
284
+ "current_org": "org_123",
285
+ "current_project": "proj_456",
286
+ "debug": false
287
+ }
288
+ ```
289
+
290
+ ## Features
291
+
292
+ ### Beautiful CLI Interface
293
+ - 🎨 Rich terminal UI with colors and formatting
294
+ - 📊 Beautiful tables for data display
295
+ - ⏳ Progress indicators for long-running operations
296
+ - 🔐 Secure credential storage with keyring
297
+
298
+ ### Docker Integration
299
+ - 🐳 Seamless Docker container management
300
+ - 📦 Automatic image pulling with progress
301
+ - 🔧 Support for custom ports, environment variables, and volumes
302
+ - 🚀 Background and interactive modes
303
+
304
+ ### Smart Configuration
305
+ - 💾 Persistent configuration with secure token storage
306
+ - 🏢 Organization and project context management
307
+ - 🔧 Environment variable support
308
+ - 🔄 Easy configuration reset
309
+
310
+ ### Error Handling
311
+ - 🛡️ Comprehensive error handling and user feedback
312
+ - 🔍 Debug mode for troubleshooting
313
+ - ⚡ Connection testing and validation
314
+
315
+ ## Development
316
+
317
+ To set up for development:
318
+
319
+ ```bash
320
+ # Clone the repository
321
+ git clone https://github.com/americandatascience/alphai.git
322
+ cd alphai
323
+
324
+ # Install in development mode
325
+ pip install -e ".[dev]"
326
+
327
+ # Run tests
328
+ pytest
329
+
330
+ # Run linting
331
+ ruff check src/
332
+ black src/
333
+
334
+ # Type checking
335
+ mypy src/
336
+ ```
337
+
338
+ ## API Integration
339
+
340
+ 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.
341
+
342
+ The CLI automatically:
343
+ - Validates bearer tokens before making API calls
344
+ - Provides helpful error messages for common issues
345
+ - Handles connection timeouts and network errors gracefully
346
+ - Uses secure credential storage
347
+
348
+ ## Examples
349
+
350
+ ### Complete Workflow
351
+
352
+ ```bash
353
+ # 1. Login
354
+ alphai login
355
+
356
+ # 2. List organizations and select one
357
+ alphai orgs list
358
+ alphai orgs select org_abc123
359
+
360
+ # 3. List projects in the organization
361
+ alphai projects list
362
+
363
+ # 4. Run a development environment
364
+ alphai run \
365
+ --image quay.io/jupyter/datascience-notebook:latest \
366
+ --name datascience-env \
367
+ --volume "$(pwd):/home/jovyan/work" \
368
+ --env "JUPYTER_ENABLE_LAB=yes" \
369
+ --detach
370
+
371
+ # 5. Check status
372
+ alphai status
373
+ ```
374
+
375
+ ### Multiple Containers
376
+
377
+ ```bash
378
+ # Start a web application
379
+ alphai run --image nginx:latest --app-port 80 --name web-server --detach
380
+
381
+ # Start a database
382
+ alphai run --image postgres:13 --app-port 5432 --name database \
383
+ --env "POSTGRES_PASSWORD=secret" --detach
384
+
385
+ # Start a development environment
386
+ alphai run --image python:3.11 --name dev-env \
387
+ --volume "$(pwd):/app" --env "PYTHONPATH=/app"
388
+ ```
389
+
390
+ ## Support
391
+
392
+ - Documentation: https://docs.runalph.ai
393
+ - Issues: https://github.com/americandatascience/alphai/issues
394
+ - Website: https://runalph.ai