coloco 0.1.4__tar.gz → 0.2.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.
- {coloco-0.1.4 → coloco-0.2.0}/PKG-INFO +1 -1
- {coloco-0.1.4 → coloco-0.2.0}/pyproject.toml +1 -1
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/api.py +23 -10
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/createapp.py +5 -3
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/dev.py +11 -2
- {coloco-0.1.4 → coloco-0.2.0}/LICENSE +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/README.md +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/__init__.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/__main__.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/api.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/app.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/node.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/package.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/codegen.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/exceptions.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/lifespan.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/requirements.txt +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/static.py +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/docker/.dockerignore-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/docker/Dockerfile-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/docker/docker-compose.yml-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/404.svelte-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/app.css-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/app.svelte-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/index.html-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/index.svelte-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/main.ts-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/openapi-ts.config.ts-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/package.json-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/svelte.config.js-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/tsconfig.json-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/vite-env.d.ts-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/vite.config.ts-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/.gitignore-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/README.md-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/example/api.py-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/example/index.svelte-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/main.py-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/requirements.txt-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/tsconfig.json-tpl +0 -0
- {coloco-0.1.4 → coloco-0.2.0}/tests/__init__.py +0 -0
|
@@ -10,21 +10,13 @@ import uvicorn
|
|
|
10
10
|
app = typer.Typer()
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
def serve(
|
|
15
|
-
app: str = "main.app",
|
|
16
|
-
host: str = "127.0.0.1",
|
|
17
|
-
port: int = 80,
|
|
18
|
-
log_level: str = "info",
|
|
19
|
-
reload=False,
|
|
20
|
-
):
|
|
13
|
+
def _verify_app(app: str):
|
|
21
14
|
if not "." in app:
|
|
22
15
|
print(
|
|
23
16
|
"[red]App should be the name of a variable in a python file, example: main.py -> api = main.api[/red]"
|
|
24
17
|
)
|
|
25
18
|
raise typer.Abort()
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
|
|
28
20
|
module_name, var_name = app.rsplit(".", 1)
|
|
29
21
|
try:
|
|
30
22
|
# Needed for when running the binary
|
|
@@ -43,7 +35,17 @@ def serve(
|
|
|
43
35
|
if not isinstance(var, ColocoApp):
|
|
44
36
|
print(f"[red]{var_name} is not a ColocoApp. Please use create_app[/red]")
|
|
45
37
|
raise typer.Abort()
|
|
38
|
+
|
|
39
|
+
return True
|
|
46
40
|
|
|
41
|
+
def _serve(
|
|
42
|
+
app: str = "main.app",
|
|
43
|
+
host: str = "127.0.0.1",
|
|
44
|
+
port: int = 80,
|
|
45
|
+
log_level: str = "info",
|
|
46
|
+
reload=False,
|
|
47
|
+
):
|
|
48
|
+
module_name, var_name = app.rsplit(".", 1)
|
|
47
49
|
uvicorn.run(
|
|
48
50
|
f"{module_name}:{var_name}.api.service",
|
|
49
51
|
host=host,
|
|
@@ -51,3 +53,14 @@ def serve(
|
|
|
51
53
|
reload=reload,
|
|
52
54
|
log_level=log_level,
|
|
53
55
|
)
|
|
56
|
+
|
|
57
|
+
@app.command()
|
|
58
|
+
def serve(
|
|
59
|
+
app: str = "main.app",
|
|
60
|
+
host: str = "127.0.0.1",
|
|
61
|
+
port: int = 80,
|
|
62
|
+
log_level: str = "info",
|
|
63
|
+
reload=False,
|
|
64
|
+
):
|
|
65
|
+
_verify_app(app)
|
|
66
|
+
_serve(app=app, host=host, port=port, log_level=log_level, reload=reload)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import typer
|
|
2
1
|
from rich import print
|
|
2
|
+
from .node import install
|
|
3
3
|
import os
|
|
4
|
-
import shutil
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
def createapp(name: str):
|
|
@@ -9,7 +8,6 @@ def createapp(name: str):
|
|
|
9
8
|
template_dir = f"{current_dir}/../templates/standard"
|
|
10
9
|
install_dir = f"{os.getcwd()}/{name}"
|
|
11
10
|
print(f"Creating app {name}...")
|
|
12
|
-
print(f"App created in {install_dir}")
|
|
13
11
|
|
|
14
12
|
template_vars = {
|
|
15
13
|
"project_name": name,
|
|
@@ -34,3 +32,7 @@ def createapp(name: str):
|
|
|
34
32
|
os.path.join(install_dir, relative_path, file[:-4]), "w"
|
|
35
33
|
) as f:
|
|
36
34
|
f.write(content)
|
|
35
|
+
|
|
36
|
+
print(f"App created in {install_dir}")
|
|
37
|
+
|
|
38
|
+
print(f"\nRun [green]coloco dev[/green] from [yellow]{name}[/yellow] to start the app.")
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
from .api import _verify_app, _serve
|
|
2
|
+
from .node import install
|
|
3
|
+
import os
|
|
1
4
|
from rich import print
|
|
2
|
-
from .api import serve
|
|
3
5
|
from subprocess import Popen
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
def dev(app: str = "main.app", host: str = "127.0.0.1"):
|
|
9
|
+
_verify_app(app)
|
|
10
|
+
|
|
11
|
+
# Check Node Modules
|
|
12
|
+
if not os.path.exists(os.path.join(os.getcwd(), "node_modules")):
|
|
13
|
+
print("[yellow]Node modules not found, installing...[/yellow]")
|
|
14
|
+
install()
|
|
15
|
+
|
|
7
16
|
node = Popen([f"npm run dev"], cwd="+node", shell=True)
|
|
8
|
-
|
|
17
|
+
_serve(
|
|
9
18
|
app=app,
|
|
10
19
|
host=host,
|
|
11
20
|
port=5172,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|