coloco 0.1.3__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.3 → coloco-0.2.0}/PKG-INFO +1 -1
  2. {coloco-0.1.3 → coloco-0.2.0}/pyproject.toml +1 -1
  3. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/cli/api.py +29 -11
  4. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/cli/createapp.py +5 -3
  5. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/cli/dev.py +11 -2
  6. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/docker/Dockerfile-tpl +0 -4
  7. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+node/package.json-tpl +1 -2
  8. {coloco-0.1.3 → coloco-0.2.0}/LICENSE +0 -0
  9. {coloco-0.1.3 → coloco-0.2.0}/README.md +0 -0
  10. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/__init__.py +0 -0
  11. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/__main__.py +0 -0
  12. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/api.py +0 -0
  13. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/app.py +0 -0
  14. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/cli/node.py +0 -0
  15. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/cli/package.py +0 -0
  16. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/codegen.py +0 -0
  17. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/exceptions.py +0 -0
  18. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/lifespan.py +0 -0
  19. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/requirements.txt +0 -0
  20. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/static.py +0 -0
  21. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/docker/.dockerignore-tpl +0 -0
  22. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/docker/docker-compose.yml-tpl +0 -0
  23. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+app/404.svelte-tpl +0 -0
  24. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+app/app.css-tpl +0 -0
  25. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+app/app.svelte-tpl +0 -0
  26. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+app/index.html-tpl +0 -0
  27. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+app/index.svelte-tpl +0 -0
  28. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+app/main.ts-tpl +0 -0
  29. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+node/openapi-ts.config.ts-tpl +0 -0
  30. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+node/svelte.config.js-tpl +0 -0
  31. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+node/tsconfig.json-tpl +0 -0
  32. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+node/vite-env.d.ts-tpl +0 -0
  33. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/+node/vite.config.ts-tpl +0 -0
  34. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/.gitignore-tpl +0 -0
  35. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/README.md-tpl +0 -0
  36. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/example/api.py-tpl +0 -0
  37. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/example/index.svelte-tpl +0 -0
  38. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/main.py-tpl +0 -0
  39. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/requirements.txt-tpl +0 -0
  40. {coloco-0.1.3 → coloco-0.2.0}/src/coloco/templates/standard/tsconfig.json-tpl +0 -0
  41. {coloco-0.1.3 → 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.3
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.3"
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" },
@@ -1,29 +1,26 @@
1
+ from ..app import ColocoApp
1
2
  from importlib import import_module
2
- import typer
3
+ import os
3
4
  from rich import print
5
+ import sys
6
+ import typer
4
7
  import uvicorn
5
- from ..app import ColocoApp
6
8
 
7
9
 
8
10
  app = typer.Typer()
9
11
 
10
12
 
11
- @app.command()
12
- def serve(
13
- app: str = "main.app",
14
- host: str = "127.0.0.1",
15
- port: int = 80,
16
- log_level: str = "info",
17
- reload=False,
18
- ):
13
+ def _verify_app(app: str):
19
14
  if not "." in app:
20
15
  print(
21
16
  "[red]App should be the name of a variable in a python file, example: main.py -> api = main.api[/red]"
22
17
  )
23
18
  raise typer.Abort()
24
-
19
+
25
20
  module_name, var_name = app.rsplit(".", 1)
26
21
  try:
22
+ # Needed for when running the binary
23
+ sys.path.append(os.getcwd())
27
24
  module = import_module(module_name)
28
25
  except ImportError:
29
26
  print(f"[red]Module or python file {module_name} not found[/red]")
@@ -38,7 +35,17 @@ def serve(
38
35
  if not isinstance(var, ColocoApp):
39
36
  print(f"[red]{var_name} is not a ColocoApp. Please use create_app[/red]")
40
37
  raise typer.Abort()
38
+
39
+ return True
41
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)
42
49
  uvicorn.run(
43
50
  f"{module_name}:{var_name}.api.service",
44
51
  host=host,
@@ -46,3 +53,14 @@ def serve(
46
53
  reload=reload,
47
54
  log_level=log_level,
48
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,
@@ -9,10 +9,6 @@ WORKDIR /app
9
9
  ADD ./requirements.txt /app/requirements.txt
10
10
  RUN python -m pip install -r /app/requirements.txt
11
11
 
12
- # TODO: remove this when coloco is a package
13
- ADD ./coloco/requirements.txt /app/coloco/requirements.txt
14
- RUN python -m pip install -r /app/coloco/requirements.txt
15
-
16
12
  # Node Install
17
13
  RUN mkdir /.npm && chown -R 1000:1000 "/.npm"
18
14
  ADD ./+node/package.json /app/package.json
@@ -11,10 +11,9 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@coloco/api-client-svelte": "^0.1.1",
14
- "@coloco/router": "^0.1.1",
14
+ "@coloco/router": "^0.1.2",
15
15
  "@hey-api/client-fetch": "^0.8.2",
16
16
  "@hey-api/openapi-ts": "^0.64.7",
17
- "@mateothegreat/svelte5-router": "^0.1.38",
18
17
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
19
18
  "@tsconfig/svelte": "^5.0.4",
20
19
  "@types/node": "^22.13.4",
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