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.
Files changed (41) hide show
  1. {coloco-0.1.4 → coloco-0.2.0}/PKG-INFO +1 -1
  2. {coloco-0.1.4 → coloco-0.2.0}/pyproject.toml +1 -1
  3. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/api.py +23 -10
  4. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/createapp.py +5 -3
  5. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/dev.py +11 -2
  6. {coloco-0.1.4 → coloco-0.2.0}/LICENSE +0 -0
  7. {coloco-0.1.4 → coloco-0.2.0}/README.md +0 -0
  8. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/__init__.py +0 -0
  9. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/__main__.py +0 -0
  10. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/api.py +0 -0
  11. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/app.py +0 -0
  12. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/node.py +0 -0
  13. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/cli/package.py +0 -0
  14. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/codegen.py +0 -0
  15. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/exceptions.py +0 -0
  16. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/lifespan.py +0 -0
  17. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/requirements.txt +0 -0
  18. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/static.py +0 -0
  19. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/docker/.dockerignore-tpl +0 -0
  20. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/docker/Dockerfile-tpl +0 -0
  21. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/docker/docker-compose.yml-tpl +0 -0
  22. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/404.svelte-tpl +0 -0
  23. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/app.css-tpl +0 -0
  24. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/app.svelte-tpl +0 -0
  25. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/index.html-tpl +0 -0
  26. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/index.svelte-tpl +0 -0
  27. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+app/main.ts-tpl +0 -0
  28. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/openapi-ts.config.ts-tpl +0 -0
  29. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/package.json-tpl +0 -0
  30. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/svelte.config.js-tpl +0 -0
  31. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/tsconfig.json-tpl +0 -0
  32. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/vite-env.d.ts-tpl +0 -0
  33. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/+node/vite.config.ts-tpl +0 -0
  34. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/.gitignore-tpl +0 -0
  35. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/README.md-tpl +0 -0
  36. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/example/api.py-tpl +0 -0
  37. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/example/index.svelte-tpl +0 -0
  38. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/main.py-tpl +0 -0
  39. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/requirements.txt-tpl +0 -0
  40. {coloco-0.1.4 → coloco-0.2.0}/src/coloco/templates/standard/tsconfig.json-tpl +0 -0
  41. {coloco-0.1.4 → coloco-0.2.0}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: coloco
3
- Version: 0.1.4
3
+ Version: 0.2.0
4
4
  Summary: A kit for creating FastAPI + Svelte applications
5
5
  Author-Email: Channel Cat <channelcat@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "coloco"
3
- version = "0.1.4"
3
+ version = "0.2.0"
4
4
  description = "A kit for creating FastAPI + Svelte applications"
5
5
  authors = [
6
6
  { name = "Channel Cat", email = "channelcat@gmail.com" },
@@ -10,21 +10,13 @@ import uvicorn
10
10
  app = typer.Typer()
11
11
 
12
12
 
13
- @app.command()
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
- serve(
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