blackant-sdk 1.0.2__py3-none-any.whl → 1.0.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.
blackant/cli.py ADDED
@@ -0,0 +1,301 @@
1
+ """BlackAnt SDK Command Line Interface.
2
+
3
+ This module provides a CLI for the BlackAnt SDK, allowing users to
4
+ interact with the BlackAnt platform directly from the terminal.
5
+
6
+ Usage:
7
+ blackant login --user USER --password PASS --url URL
8
+ blackant build --name SERVICE_NAME --path PATH [--push]
9
+ blackant list
10
+ blackant status SERVICE_NAME
11
+ blackant delete SERVICE_NAME
12
+ """
13
+
14
+ import os
15
+ import sys
16
+ import click
17
+ from typing import Optional
18
+
19
+
20
+ def get_client(user: Optional[str] = None, password: Optional[str] = None,
21
+ base_url: Optional[str] = None, login_url: Optional[str] = None):
22
+ """Create and authenticate a BlackAnt client.
23
+
24
+ Args:
25
+ user: Username (or from BLACKANT_USER env var)
26
+ password: Password (or from BLACKANT_PASSWORD env var)
27
+ base_url: Base URL (or from BLACKANT_URL env var)
28
+ login_url: Login URL (or from BLACKANT_LOGIN_URL env var)
29
+
30
+ Returns:
31
+ Authenticated BlackAntClient instance
32
+
33
+ Raises:
34
+ click.ClickException: If authentication fails or credentials missing
35
+ """
36
+ from blackant import BlackAntClient
37
+
38
+ user = user or os.getenv("BLACKANT_USER")
39
+ password = password or os.getenv("BLACKANT_PASSWORD")
40
+ base_url = base_url or os.getenv("BLACKANT_URL", "https://dev.blackant.app")
41
+ login_url = login_url or os.getenv("BLACKANT_LOGIN_URL", f"{base_url}/api/auth/login")
42
+
43
+ if not user or not password:
44
+ raise click.ClickException(
45
+ "Missing credentials. Provide --user and --password, "
46
+ "or set BLACKANT_USER and BLACKANT_PASSWORD environment variables."
47
+ )
48
+
49
+ try:
50
+ client = BlackAntClient(
51
+ user=user,
52
+ password=password,
53
+ base_url=base_url,
54
+ login_url=login_url
55
+ )
56
+ if not client.authenticate():
57
+ raise click.ClickException("Authentication failed. Check your credentials.")
58
+ return client
59
+ except Exception as e:
60
+ raise click.ClickException(f"Failed to connect: {e}")
61
+
62
+
63
+ @click.group()
64
+ @click.version_option(version="1.0.4", prog_name="blackant")
65
+ def main():
66
+ """BlackAnt SDK - Command Line Interface
67
+
68
+ Interact with the BlackAnt platform from your terminal.
69
+
70
+ \b
71
+ Environment variables:
72
+ BLACKANT_USER - Username for authentication
73
+ BLACKANT_PASSWORD - Password for authentication
74
+ BLACKANT_URL - Base URL (default: https://dev.blackant.app)
75
+
76
+ \b
77
+ Examples:
78
+ blackant login --user admin --password xxx
79
+ blackant build --name my-calc --path ./src/calculation/impl --push
80
+ blackant list
81
+ blackant status my-calc
82
+ """
83
+ pass
84
+
85
+
86
+ @main.command()
87
+ @click.option("--user", "-u", help="BlackAnt username")
88
+ @click.option("--password", "-p", help="BlackAnt password")
89
+ @click.option("--url", help="BlackAnt base URL")
90
+ def login(user: Optional[str], password: Optional[str], url: Optional[str]):
91
+ """Test connection and authenticate with BlackAnt.
92
+
93
+ Verifies that the provided credentials are valid and the
94
+ BlackAnt platform is reachable.
95
+ """
96
+ client = get_client(user=user, password=password, base_url=url)
97
+
98
+ if client.test_connection():
99
+ click.secho("Successfully connected to BlackAnt!", fg="green")
100
+ click.echo(f" User: {user or os.getenv('BLACKANT_USER')}")
101
+ click.echo(f" URL: {url or os.getenv('BLACKANT_URL', 'https://dev.blackant.app')}")
102
+ else:
103
+ raise click.ClickException("Connection test failed.")
104
+
105
+
106
+ @main.command()
107
+ @click.option("--name", "-n", required=True, help="Service name")
108
+ @click.option("--path", "-p", required=True, help="Path to implementation directory")
109
+ @click.option("--dockerfile", "-d", default="Dockerfile", help="Dockerfile name (default: Dockerfile)")
110
+ @click.option("--tag", "-t", default="latest", help="Image tag (default: latest)")
111
+ @click.option("--push/--no-push", default=True, help="Push to registry after build (default: yes)")
112
+ @click.option("--register/--no-register", default=False, help="Register service after push (default: no)")
113
+ @click.option("--user", "-u", help="BlackAnt username")
114
+ @click.option("--password", help="BlackAnt password")
115
+ @click.option("--url", help="BlackAnt base URL")
116
+ def build(name: str, path: str, dockerfile: str, tag: str, push: bool,
117
+ register: bool, user: Optional[str], password: Optional[str],
118
+ url: Optional[str]):
119
+ """Build a Docker image and optionally push to registry.
120
+
121
+ \b
122
+ Examples:
123
+ blackant build --name my-calc --path ./src/calculation/impl
124
+ blackant build --name my-calc --path ./impl --tag v1.0.0 --push
125
+ blackant build --name my-calc --path ./impl --no-push
126
+ """
127
+ client = get_client(user=user, password=password, base_url=url)
128
+
129
+ click.echo(f"Building service '{name}' from {path}...")
130
+ click.echo(f" Dockerfile: {dockerfile}")
131
+ click.echo(f" Tag: {tag}")
132
+ click.echo(f" Push: {'yes' if push else 'no'}")
133
+
134
+ try:
135
+ result = client.build_service(
136
+ service_name=name,
137
+ impl_path=path,
138
+ dockerfile_path=dockerfile,
139
+ tag=tag,
140
+ push=push,
141
+ register_service=register
142
+ )
143
+
144
+ if result.get("build_success"):
145
+ click.secho("Build successful!", fg="green")
146
+ click.echo(f" Image: {result.get('full_image', 'N/A')}")
147
+ click.echo(f" Image ID: {result.get('image_id', 'N/A')[:12]}...")
148
+ size_mb = result.get('size', 0) / 1024 / 1024
149
+ click.echo(f" Size: {size_mb:.2f} MB")
150
+
151
+ if push and result.get("pushed"):
152
+ click.secho("Push successful!", fg="green")
153
+ elif push:
154
+ click.secho("Push failed!", fg="red")
155
+ else:
156
+ raise click.ClickException("Build failed. Check logs for details.")
157
+
158
+ except Exception as e:
159
+ raise click.ClickException(f"Build error: {e}")
160
+
161
+
162
+ @main.command("list")
163
+ @click.option("--namespace", "-ns", help="Filter by namespace")
164
+ @click.option("--user", "-u", help="BlackAnt username")
165
+ @click.option("--password", "-p", help="BlackAnt password")
166
+ @click.option("--url", help="BlackAnt base URL")
167
+ def list_services(namespace: Optional[str], user: Optional[str],
168
+ password: Optional[str], url: Optional[str]):
169
+ """List all registered services.
170
+
171
+ \b
172
+ Examples:
173
+ blackant list
174
+ blackant list --namespace production
175
+ """
176
+ client = get_client(user=user, password=password, base_url=url)
177
+
178
+ try:
179
+ services = client.list_services(namespace=namespace)
180
+
181
+ if not services:
182
+ click.echo("No services found.")
183
+ return
184
+
185
+ click.echo(f"Found {len(services)} service(s):\n")
186
+
187
+ for svc in services:
188
+ name = svc.get("name", "Unknown")
189
+ status = svc.get("status", "Unknown")
190
+ svc_type = svc.get("type", "Unknown")
191
+
192
+ # Color based on status
193
+ if status.lower() in ("running", "active"):
194
+ status_color = "green"
195
+ elif status.lower() in ("stopped", "inactive"):
196
+ status_color = "yellow"
197
+ else:
198
+ status_color = "white"
199
+
200
+ click.echo(f" {name}")
201
+ click.echo(f" Status: ", nl=False)
202
+ click.secho(status, fg=status_color)
203
+ click.echo(f" Type: {svc_type}")
204
+ click.echo()
205
+
206
+ except Exception as e:
207
+ raise click.ClickException(f"Failed to list services: {e}")
208
+
209
+
210
+ @main.command()
211
+ @click.argument("name")
212
+ @click.option("--user", "-u", help="BlackAnt username")
213
+ @click.option("--password", "-p", help="BlackAnt password")
214
+ @click.option("--url", help="BlackAnt base URL")
215
+ def status(name: str, user: Optional[str], password: Optional[str],
216
+ url: Optional[str]):
217
+ """Get status of a specific service.
218
+
219
+ \b
220
+ Examples:
221
+ blackant status my-calc
222
+ blackant status my-service --user admin --password xxx
223
+ """
224
+ client = get_client(user=user, password=password, base_url=url)
225
+
226
+ try:
227
+ svc_status = client.get_service_status(service_name=name)
228
+
229
+ click.echo(f"Service: {name}\n")
230
+
231
+ for key, value in svc_status.items():
232
+ click.echo(f" {key}: {value}")
233
+
234
+ except Exception as e:
235
+ raise click.ClickException(f"Failed to get status: {e}")
236
+
237
+
238
+ @main.command()
239
+ @click.argument("name")
240
+ @click.option("--yes", "-y", is_flag=True, help="Skip confirmation")
241
+ @click.option("--user", "-u", help="BlackAnt username")
242
+ @click.option("--password", "-p", help="BlackAnt password")
243
+ @click.option("--url", help="BlackAnt base URL")
244
+ def delete(name: str, yes: bool, user: Optional[str], password: Optional[str],
245
+ url: Optional[str]):
246
+ """Delete a service.
247
+
248
+ \b
249
+ Examples:
250
+ blackant delete my-calc
251
+ blackant delete my-calc --yes
252
+ """
253
+ if not yes:
254
+ click.confirm(f"Are you sure you want to delete '{name}'?", abort=True)
255
+
256
+ client = get_client(user=user, password=password, base_url=url)
257
+
258
+ try:
259
+ if client.delete_service(service_name=name):
260
+ click.secho(f"Service '{name}' deleted successfully!", fg="green")
261
+ else:
262
+ raise click.ClickException(f"Failed to delete service '{name}'.")
263
+
264
+ except Exception as e:
265
+ raise click.ClickException(f"Delete error: {e}")
266
+
267
+
268
+ @main.command()
269
+ @click.argument("name")
270
+ @click.option("--user", "-u", help="BlackAnt username")
271
+ @click.option("--password", "-p", help="BlackAnt password")
272
+ @click.option("--url", help="BlackAnt base URL")
273
+ def info(name: str, user: Optional[str], password: Optional[str],
274
+ url: Optional[str]):
275
+ """Get detailed information about a service.
276
+
277
+ \b
278
+ Examples:
279
+ blackant info my-calc
280
+ """
281
+ client = get_client(user=user, password=password, base_url=url)
282
+
283
+ try:
284
+ service = client.get_service(service_name=name)
285
+
286
+ click.echo(f"Service: {name}\n")
287
+
288
+ for key, value in service.items():
289
+ if isinstance(value, dict):
290
+ click.echo(f" {key}:")
291
+ for k, v in value.items():
292
+ click.echo(f" {k}: {v}")
293
+ else:
294
+ click.echo(f" {key}: {value}")
295
+
296
+ except Exception as e:
297
+ raise click.ClickException(f"Failed to get service info: {e}")
298
+
299
+
300
+ if __name__ == "__main__":
301
+ main()
@@ -0,0 +1,196 @@
1
+ Metadata-Version: 2.4
2
+ Name: blackant-sdk
3
+ Version: 1.0.4
4
+ Summary: Python SDK for Docker operations with automatic authentication through BlackAnt platform
5
+ Author-email: Balázs Milán <milan.balazs@uni-obuda.hu>
6
+ Maintainer-email: BlackAnt Development Team <dev@blackant.app>
7
+ License: Proprietary - Óbudai Egyetem
8
+ Project-URL: Homepage, https://env.blackant.app/systemdevelopers/blackant_sdk
9
+ Project-URL: Documentation, https://docs.blackant.app
10
+ Project-URL: Repository, https://env.blackant.app/systemdevelopers/blackant_sdk
11
+ Project-URL: Bug Tracker, https://env.blackant.app/systemdevelopers/blackant_sdk/-/issues
12
+ Keywords: docker,sdk,authentication,blackant,container,orchestration,swarm
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: System :: Distributed Computing
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Operating System :: OS Independent
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: flask>=2.3.2
24
+ Requires-Dist: flask-restful>=0.3.10
25
+ Requires-Dist: waitress>=2.1.2
26
+ Requires-Dist: minio>=6.0.0
27
+ Requires-Dist: requests>=2.31.0
28
+ Requires-Dist: docker>=4.4.3
29
+ Requires-Dist: urllib3<2.0
30
+ Requires-Dist: gunicorn>=21.2.0
31
+ Requires-Dist: colorama>=0.4.6
32
+ Requires-Dist: python-keycloak>=3.0.0
33
+ Requires-Dist: PyJWT>=2.8.0
34
+ Requires-Dist: click>=8.1.0
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
37
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
38
+ Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
39
+ Requires-Dist: sphinx>=5.0.0; extra == "dev"
40
+ Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "dev"
41
+ Provides-Extra: test
42
+ Requires-Dist: pytest>=7.0.0; extra == "test"
43
+ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
44
+ Requires-Dist: pytest-mock>=3.10.0; extra == "test"
45
+ Provides-Extra: docs
46
+ Requires-Dist: sphinx>=5.0.0; extra == "docs"
47
+ Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
48
+
49
+ # BlackAnt SDK
50
+
51
+ Python SDK for Docker operations with automatic authentication through the BlackAnt platform.
52
+
53
+ ## Features
54
+
55
+ - Automatic authentication with BlackAnt platform
56
+ - Build Docker images on remote daemon
57
+ - Push images to private registry
58
+ - Service management (list, status, delete)
59
+ - Both Python API and CLI interface
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ pip install blackant-sdk
65
+ ```
66
+
67
+ ## Quick Start
68
+
69
+ ### Python API
70
+
71
+ ```python
72
+ from blackant import BlackAntClient
73
+
74
+ # Initialize client
75
+ client = BlackAntClient(
76
+ user="your-username",
77
+ password="your-password",
78
+ base_url="https://your-blackant-instance.com"
79
+ )
80
+
81
+ # Authenticate
82
+ if client.authenticate():
83
+ print("Connected to BlackAnt!")
84
+
85
+ # Build and push a service
86
+ result = client.build_service(
87
+ service_name="my-calculation",
88
+ impl_path="./src/calculation/impl",
89
+ tag="v1.0.0",
90
+ push=True
91
+ )
92
+
93
+ print(f"Image: {result['full_image']}")
94
+
95
+ # List services
96
+ services = client.list_services()
97
+ for svc in services:
98
+ print(f" - {svc['name']}: {svc['status']}")
99
+ ```
100
+
101
+ ### Command Line Interface (CLI)
102
+
103
+ ```bash
104
+ # Set credentials via environment variables
105
+ export BLACKANT_USER=your-username
106
+ export BLACKANT_PASSWORD=your-password
107
+ export BLACKANT_URL=https://your-blackant-instance.com
108
+
109
+ # Test connection
110
+ blackant login
111
+
112
+ # Build and push
113
+ blackant build --name my-calculation --path ./src/calculation/impl --tag v1.0.0
114
+
115
+ # List services
116
+ blackant list
117
+
118
+ # Get service status
119
+ blackant status my-calculation
120
+
121
+ # Delete service
122
+ blackant delete my-calculation
123
+ ```
124
+
125
+ ## Environment Variables
126
+
127
+ | Variable | Description | Default |
128
+ |----------|-------------|---------|
129
+ | `BLACKANT_USER` | Username for authentication | - |
130
+ | `BLACKANT_PASSWORD` | Password for authentication | - |
131
+ | `BLACKANT_URL` | BlackAnt platform base URL | `https://dev.blackant.app` |
132
+
133
+ ## API Reference
134
+
135
+ ### BlackAntClient
136
+
137
+ The main client class providing all SDK functionality.
138
+
139
+ #### Methods
140
+
141
+ | Method | Description |
142
+ |--------|-------------|
143
+ | `authenticate()` | Authenticate with BlackAnt platform |
144
+ | `test_connection()` | Test if connection is working |
145
+ | `build_service(...)` | Build Docker image and optionally push |
146
+ | `list_services()` | List all registered services |
147
+ | `get_service(name)` | Get service details |
148
+ | `get_service_status(name)` | Get service status |
149
+ | `delete_service(name)` | Delete a service |
150
+
151
+ ### CLI Commands
152
+
153
+ | Command | Description |
154
+ |---------|-------------|
155
+ | `blackant login` | Test connection and authenticate |
156
+ | `blackant build` | Build Docker image and push to registry |
157
+ | `blackant list` | List all registered services |
158
+ | `blackant status <name>` | Get status of a service |
159
+ | `blackant info <name>` | Get detailed service information |
160
+ | `blackant delete <name>` | Delete a service |
161
+
162
+ Use `blackant <command> --help` for detailed options.
163
+
164
+ ## Requirements
165
+
166
+ - Python 3.11+
167
+ - Access to a BlackAnt platform instance
168
+ - Valid BlackAnt credentials
169
+
170
+ ## License
171
+
172
+ Proprietary - Obuda University, John von Neumann Faculty of Informatics
173
+
174
+ ---
175
+
176
+ ## About
177
+
178
+ <p align="center">
179
+ <img src="https://nik.uni-obuda.hu/wp-content/uploads/2025/10/NIK_logo_header.png" alt="NIK Logo" width="300"/>
180
+ </p>
181
+
182
+ This SDK is developed and maintained by the **BlackAnt Development Team** at:
183
+
184
+ **Obuda University - John von Neumann Faculty of Informatics**
185
+ *(Óbudai Egyetem - Neumann János Informatikai Kar)*
186
+
187
+ | | |
188
+ |---|---|
189
+ | Address | 1034 Budapest, Bécsi út 96/B, Hungary |
190
+ | Phone | +36 1 666 5520 |
191
+ | Email | titkarsag@nik.uni-obuda.hu |
192
+ | Web | [nik.uni-obuda.hu](https://nik.uni-obuda.hu) |
193
+
194
+ ## Support
195
+
196
+ For SDK issues and questions, contact the BlackAnt Development Team at dev@blackant.app
@@ -1,4 +1,5 @@
1
1
  blackant/__init__.py,sha256=THZWaFP_eIFEDVsIQC5HSCY9k2nGeR1TQ3rNhdlScEM,746
2
+ blackant/cli.py,sha256=Ksnh2rGusb1MbDcFpnMgTbePaDG9JIcv1OIquPD4zNc,10284
2
3
  blackant/client.py,sha256=dsF-vPDzhv8Bx_OoakP4NC5dnbYRfkB4MHXcIAsIr9I,15180
3
4
  blackant/exceptions.py,sha256=6y9FwBlO_ntYmVyJfrhKVUUnAHaA0wkyJx2WtddU1Ts,2845
4
5
  blackant/auth/__init__.py,sha256=Ax1FqQsZNucr4CEUCqeZkrnbWN8Fx72IHFg3PZzbd2A,289
@@ -64,7 +65,8 @@ task/states/ready.py,sha256=kMpC6qY_IGkLc1JpaH_jf_NcZgC4vyLzoEZhYMDOwZA,1967
64
65
  task/states/running.py,sha256=HVkkZlC7xOV5M3NnJAf4SWyVE5JqT2LhZokIbRyskbQ,773
65
66
  task/states/set_up.py,sha256=NsoEGKVL_E3hQFIm3p3Bv6uC7J0DOPzTc8UZrMEVR1g,1634
66
67
  task/states/tear_down.py,sha256=xq6xSC2Q_Yuky047kRP4fSwM992PILIOYBZbOl1RIDA,1050
67
- blackant_sdk-1.0.2.dist-info/METADATA,sha256=uzdQjvqBJNSYM414ju-eN0aHA7JbSiMWCdi4hfRZUkg,3615
68
- blackant_sdk-1.0.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
69
- blackant_sdk-1.0.2.dist-info/top_level.txt,sha256=MZZ_UBTnah0fs9yzTmlavd4Z0HuJDD3alhfGlB79ZIE,48
70
- blackant_sdk-1.0.2.dist-info/RECORD,,
68
+ blackant_sdk-1.0.4.dist-info/METADATA,sha256=bRKLI5GYD4a2inCI8Xs9OPtQ0nkHaOSMQIRt335CWJQ,5723
69
+ blackant_sdk-1.0.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
70
+ blackant_sdk-1.0.4.dist-info/entry_points.txt,sha256=_0tArMbYqVL7laiHsKiwsfx2Lh-QyD24xHrRMLpg0ig,47
71
+ blackant_sdk-1.0.4.dist-info/top_level.txt,sha256=MZZ_UBTnah0fs9yzTmlavd4Z0HuJDD3alhfGlB79ZIE,48
72
+ blackant_sdk-1.0.4.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ blackant = blackant.cli:main
@@ -1,117 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: blackant-sdk
3
- Version: 1.0.2
4
- Summary: Python SDK for Docker operations with automatic authentication through BlackAnt platform
5
- Author-email: Balázs Milán <milan.balazs@uni-obuda.hu>
6
- Maintainer-email: BlackAnt Development Team <dev@blackant.app>
7
- License: Proprietary - Óbudai Egyetem
8
- Project-URL: Homepage, https://env.blackant.app/systemdevelopers/blackant_sdk
9
- Project-URL: Documentation, https://docs.blackant.app
10
- Project-URL: Repository, https://env.blackant.app/systemdevelopers/blackant_sdk
11
- Project-URL: Bug Tracker, https://env.blackant.app/systemdevelopers/blackant_sdk/-/issues
12
- Keywords: docker,sdk,authentication,blackant,container,orchestration,swarm
13
- Classifier: Development Status :: 4 - Beta
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
- Classifier: Topic :: System :: Distributed Computing
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.11
19
- Classifier: Programming Language :: Python :: 3.12
20
- Classifier: Operating System :: OS Independent
21
- Requires-Python: >=3.11
22
- Description-Content-Type: text/markdown
23
- Requires-Dist: flask>=2.3.2
24
- Requires-Dist: flask-restful>=0.3.10
25
- Requires-Dist: waitress>=2.1.2
26
- Requires-Dist: minio>=6.0.0
27
- Requires-Dist: requests>=2.31.0
28
- Requires-Dist: docker>=4.4.3
29
- Requires-Dist: urllib3<2.0
30
- Requires-Dist: gunicorn>=21.2.0
31
- Requires-Dist: colorama>=0.4.6
32
- Requires-Dist: python-keycloak>=3.0.0
33
- Requires-Dist: PyJWT>=2.8.0
34
- Provides-Extra: dev
35
- Requires-Dist: pytest>=7.0.0; extra == "dev"
36
- Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
37
- Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
38
- Requires-Dist: sphinx>=5.0.0; extra == "dev"
39
- Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "dev"
40
- Provides-Extra: test
41
- Requires-Dist: pytest>=7.0.0; extra == "test"
42
- Requires-Dist: pytest-cov>=4.0.0; extra == "test"
43
- Requires-Dist: pytest-mock>=3.10.0; extra == "test"
44
- Provides-Extra: docs
45
- Requires-Dist: sphinx>=5.0.0; extra == "docs"
46
- Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
47
-
48
- # Python REST API docker template
49
-
50
- A simple template to implement REST APIs using Python Flask & docker.
51
-
52
- ## Build arguments
53
-
54
- ### INSTALL_DEBUG_TOOLS
55
-
56
- If it's set to True, ptvsd is installed during build to be able to do live debugging.
57
-
58
- ## Environment variables
59
-
60
- ### CALCULATION_NAME
61
-
62
- Name of the calculation. Mandatory parameter.
63
-
64
- ### SERVER_PORT
65
-
66
- Port which on the server runs. Default: 5000
67
-
68
- ### DEBUG_MODE
69
-
70
- A switch to select between debug and release mode. If it is set to True, a Flask server will be started in debug mode and a ptvsd server. Otherwise, it is served using gevent production server. Default: False
71
-
72
- ### OBJECT_STORAGE_URL
73
-
74
- Url for the object storage. Mandatory if the code uses object storage.
75
-
76
- ### OBJECT_STORAGE_ACCESS_KEY
77
-
78
- Public key for the object storage.
79
-
80
- ### OBJECT_STORAGE_SECRET_KEY
81
-
82
- Private key for the object storage.
83
-
84
- ### SCHEDULER_URL
85
-
86
- Callback url of the scheduler.
87
-
88
- ## Commands
89
-
90
- ### Build
91
-
92
- ```sh
93
- docker-compose build
94
- ```
95
-
96
- ### Run
97
-
98
- ```sh
99
- docker-compose up
100
- ```
101
-
102
- ### Create task
103
-
104
- You can use the tools/send_request.py script to send a simple request to the calculation container.
105
-
106
- ### Debug
107
-
108
- If you use Visual Studio Code, there is a debug configuration called Python: Remote Attach which will start a debug session and connect to your running container.
109
-
110
- ## Documentation
111
-
112
- Full HTML and PDF documentation can be generated from any revision using the generate_documentation job in the CI.
113
- After the job have run successfully, the artifacts are stored for one day.
114
- If it's necessary it can be rerun any time.
115
-
116
-
117
- ......