zrb 0.6.2__py3-none-any.whl → 0.7.0__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.
Files changed (48) hide show
  1. zrb/builtin/generator/common/task_input.py +76 -13
  2. zrb/builtin/generator/docker_compose_task/template/src/kebab-zrb-task-name/image/Dockerfile +4 -2
  3. zrb/builtin/generator/docker_compose_task/template/src/kebab-zrb-task-name/image/pyproject.toml +25 -0
  4. zrb/builtin/generator/fastapp/add.py +9 -0
  5. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/activate-venv.sh +5 -0
  6. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-prepare-backend.sh +1 -1
  7. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-prepare-load-test.sh +1 -2
  8. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/loadtest/pyproject.toml +21 -0
  9. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/Dockerfile +4 -2
  10. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/pyproject.toml +44 -0
  11. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/start.sh +2 -2
  12. zrb/builtin/generator/pip_package/add.py +8 -4
  13. zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/cmd/activate-venv.sh +5 -0
  14. zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/cmd/build.sh +1 -1
  15. zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/cmd/install-symlink.sh +1 -1
  16. zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/cmd/prepare-venv.sh +1 -2
  17. zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/cmd/publish.sh +1 -1
  18. zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/pyproject.toml +22 -27
  19. zrb/builtin/generator/plugin/create.py +6 -3
  20. zrb/builtin/generator/plugin/template/_cmd/activate-venv.sh +6 -2
  21. zrb/builtin/generator/plugin/template/_cmd/build.sh +1 -1
  22. zrb/builtin/generator/plugin/template/_cmd/install-symlink.sh +1 -1
  23. zrb/builtin/generator/plugin/template/_cmd/prepare-venv.sh +1 -2
  24. zrb/builtin/generator/plugin/template/_cmd/publish.sh +1 -1
  25. zrb/builtin/generator/plugin/template/project.sh +24 -20
  26. zrb/builtin/generator/plugin/template/pyproject.toml +22 -29
  27. zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/__main__.py +5 -0
  28. zrb/builtin/generator/project/create.py +13 -1
  29. zrb/builtin/generator/project/template/project.sh +24 -35
  30. zrb/builtin/generator/project/template/pyproject.toml +21 -0
  31. zrb/builtin/generator/simple_python_app/add.py +9 -0
  32. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/cmd/app-activate-venv.sh +6 -1
  33. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/cmd/app-start.sh +2 -2
  34. zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/Dockerfile +4 -2
  35. zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/pyproject.toml +27 -0
  36. zrb/shell-scripts/_common-util.sh +5 -1
  37. {zrb-0.6.2.dist-info → zrb-0.7.0.dist-info}/METADATA +26 -28
  38. {zrb-0.6.2.dist-info → zrb-0.7.0.dist-info}/RECORD +207 -209
  39. {zrb-0.6.2.dist-info → zrb-0.7.0.dist-info}/WHEEL +1 -1
  40. zrb/builtin/generator/docker_compose_task/template/src/kebab-zrb-task-name/image/requirements.txt +0 -1
  41. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/loadtest/requirements.txt +0 -1
  42. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/requirements.txt +0 -24
  43. zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/requirements.txt +0 -4
  44. zrb/builtin/generator/plugin/template/requirements.txt +0 -4
  45. zrb/builtin/generator/project/template/requirements.txt +0 -1
  46. zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/requirements.txt +0 -1
  47. {zrb-0.6.2.dist-info → zrb-0.7.0.dist-info}/LICENSE +0 -0
  48. {zrb-0.6.2.dist-info → zrb-0.7.0.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,9 @@
1
1
  import os
2
2
 
3
3
  from zrb.builtin.generator.common.task_input import (
4
+ project_author_email_input,
5
+ project_author_name_input,
6
+ project_description_input,
4
7
  project_dir_input,
5
8
  project_name_input,
6
9
  )
@@ -55,11 +58,20 @@ async def validate(*args: Any, **kwargs: Any):
55
58
 
56
59
  copy_resource = ResourceMaker(
57
60
  name="copy-resource",
58
- inputs=[project_dir_input, project_name_input],
61
+ inputs=[
62
+ project_dir_input,
63
+ project_name_input,
64
+ project_description_input,
65
+ project_author_name_input,
66
+ project_author_email_input,
67
+ ],
59
68
  upstreams=[validate],
60
69
  replacements={
61
70
  "zrbProjectDir": "{{input.project_dir}}",
62
71
  "zrbProjectName": "{{input.project_name}}",
72
+ "zrbProjectDescription": "{{input.project_description}}",
73
+ "zrbProjectAuthorName": "{{input.project_author_name}}",
74
+ "zrbProjectAuthorEmail": "{{input.project_author_email}}",
63
75
  "zrbImageDefaultNamespace": IMAGE_DEFAULT_NAMESPACE,
64
76
  "zrbVersion": version,
65
77
  },
@@ -1,55 +1,43 @@
1
1
  #!/bin/bash
2
2
 
3
- PROJECT_DIR=$(pwd)
4
- echo "🤖 Set project directory to ${PROJECT_DIR}"
3
+ log_progress() {
4
+ echo -e "🤖 \e[0;33m${1}\e[0;0m"
5
+ }
6
+
5
7
 
8
+ init() {
9
+ export PROJECT_DIR=$(pwd)
10
+ log_progress "Setting project directory to ${PROJECT_DIR}"
6
11
 
7
- _IS_EMPTY_VENV=0
8
- if [ -z "$PROJECT_USE_VENV" ] || [ "$PROJECT_USE_VENV" = 1 ]
9
- then
10
- if [ ! -d .venv ]
12
+ _IS_EMPTY_VENV=0
13
+ if [ ! -d "${PROJECT_DIR}/.venv" ]
11
14
  then
12
- echo '🤖 Create virtual environment'
15
+ log_progress 'Creating virtual environment'
13
16
  python -m venv "${PROJECT_DIR}/.venv"
17
+ source "${PROJECT_DIR}/.venv/bin/activate"
18
+ pip install --upgrade pip
19
+ pip install "poetry==1.7.1"
14
20
  _IS_EMPTY_VENV=1
15
21
  fi
16
- echo '🤖 Activate virtual environment'
17
- source "${PROJECT_DIR}/.venv/bin/activate"
18
- fi
19
22
 
20
- install_requirements() {
21
- echo '🤖 Install requirements'
22
- pip install --upgrade pip
23
- pip install -r "${PROJECT_DIR}/requirements.txt"
23
+ log_progress 'Activating virtual environment'
24
+ source "${PROJECT_DIR}/.venv/bin/activate"
24
25
  }
25
26
 
27
+
26
28
  reload() {
27
29
 
28
30
  if [ ! -f "${PROJECT_DIR}/.env" ]
29
31
  then
30
- echo '🤖 Create project configuration (.env)'
32
+ log_progress 'Creating project configuration (.env)'
31
33
  cp "${PROJECT_DIR}/template.env" "${PROJECT_DIR}/.env"
32
34
  fi
33
35
 
34
- echo '🤖 Load project configuration (.env)'
36
+ log_progress 'Loading project configuration (.env)'
35
37
  source "${PROJECT_DIR}/.env"
36
38
 
37
- if [ -z "$PROJECT_AUTO_INSTALL_PIP" ] || [ "$PROJECT_AUTO_INSTALL_PIP" = 1 ]
38
- then
39
- if [ "$_IS_EMPTY_VENV" = 1 ]
40
- then
41
- install_requirements
42
- _IS_EMPTY_VENV=0
43
- else
44
- echo '🤖 Checking .venv and requirements.txt timestamp'
45
- _VENV_TIMESTAMP=$(find .venv -type d -exec stat -c %Y {} \; | sort -n | tail -n 1)
46
- _REQUIREMENTS_TIMESTAMP=$(stat -c %Y requirements.txt)
47
- if [ "$_VENV_TIMESTAMP" -lt "$_REQUIREMENTS_TIMESTAMP" ]
48
- then
49
- install_requirements
50
- fi
51
- fi
52
- fi
39
+ log_progress 'Install'
40
+ poetry install
53
41
 
54
42
  _CURRENT_SHELL=$(ps -p $$ | awk 'NR==2 {print $4}')
55
43
  case "$_CURRENT_SHELL" in
@@ -62,12 +50,13 @@ reload() {
62
50
  esac
63
51
  if [ "$_CURRENT_SHELL" = "zsh" ] || [ "$_CURRENT_SHELL" = "bash" ]
64
52
  then
65
- echo "🤖 Set up shell completion for $_CURRENT_SHELL"
53
+ log_progress "Setting up shell completion for $_CURRENT_SHELL"
66
54
  eval "$(_ZRB_COMPLETE=${_CURRENT_SHELL}_source zrb)"
67
55
  else
68
- echo "🤖 Cannot set up shell completion for $_CURRENT_SHELL"
56
+ log_progress "Cannot set up shell completion for $_CURRENT_SHELL"
69
57
  fi
70
58
  }
71
59
 
60
+ init
72
61
  reload
73
- echo '🤖 Happy Coding :)'
62
+ log_progress 'Happy Coding :)'
@@ -0,0 +1,21 @@
1
+ [tool.poetry]
2
+ name = "kebab-zrb-project-name"
3
+ version = "0.0.1"
4
+ description = "zrbProjectDescription"
5
+ authors = ["zrbProjectAuthorName <zrbProjectAuthorEmail>"]
6
+ keywords = []
7
+ packages = [
8
+ {include = "kebab-zrb-project-name", from = ".."},
9
+ ]
10
+
11
+ [tool.poetry.dependencies]
12
+ python = ">=3.10.0,<4.0.0"
13
+ zrb = ">=zrbVersion"
14
+
15
+ [tool.poetry.dev-dependencies]
16
+
17
+ [tool.poetry.scripts]
18
+
19
+ [build-system]
20
+ requires = ["poetry-core>=1.0.0"]
21
+ build-backend = "poetry.core.masonry.api"
@@ -6,6 +6,9 @@ from zrb.builtin.generator.common.helper import (
6
6
  )
7
7
  from zrb.builtin.generator.common.task_factory import create_register_module
8
8
  from zrb.builtin.generator.common.task_input import (
9
+ app_author_email_input,
10
+ app_author_name_input,
11
+ app_description_input,
9
12
  app_image_name_input,
10
13
  app_name_input,
11
14
  env_prefix_input,
@@ -58,6 +61,9 @@ copy_resource = ResourceMaker(
58
61
  inputs=[
59
62
  project_dir_input,
60
63
  app_name_input,
64
+ app_description_input,
65
+ app_author_name_input,
66
+ app_author_email_input,
61
67
  app_image_name_input,
62
68
  http_port_input,
63
69
  env_prefix_input,
@@ -65,6 +71,9 @@ copy_resource = ResourceMaker(
65
71
  upstreams=[validate],
66
72
  replacements={
67
73
  "zrbAppName": "{{input.app_name}}",
74
+ "zrbAppDescription": "{{input.app_description}}",
75
+ "zrbAppAuthorName": "{{input.app_author_name}}",
76
+ "zrbAppAuthorEmail": "{{input.app_author_email}}",
68
77
  "zrbAppHttpPort": '{{util.coalesce(input.http_port, "3000")}}',
69
78
  "ZRB_ENV_PREFIX": '{{util.coalesce(input.env_prefix, "MY").upper()}}',
70
79
  "zrb-app-image-name": "{{input.app_image_name}}",
@@ -2,6 +2,11 @@ if [ ! -d .venv ]
2
2
  then
3
3
  echo "Init virtual environment"
4
4
  python -m venv .venv
5
+ source .venv/bin/activate
6
+ echo "Upgrade Pip"
7
+ pip install -U pip
8
+ echo "Install Poetry"
9
+ pip install "poetry==1.7.1"
5
10
  fi
6
11
  echo "Activate virtual environment"
7
- source .venv/bin/activate
12
+ source .venv/bin/activate
@@ -1,6 +1,6 @@
1
1
  PYTHONUNBUFFERED=1
2
2
  echo "Install packages"
3
- pip install -r requirements.txt
3
+ poetry install --no-root
4
4
 
5
5
  echo "Start app"
6
- uvicorn main:app --host {{env.get("APP_HOST", "0.0.0.0")}} --port {{env.get("APP_PORT", "8080")}}
6
+ poetry run uvicorn main:app --host {{env.get("APP_HOST", "0.0.0.0")}} --port {{env.get("APP_PORT", "8080")}}
@@ -2,6 +2,8 @@ FROM python:3.10-slim
2
2
  ENV APP_MESSAGE "Hello, world!"
3
3
  ENV APP_PORT 8080
4
4
  WORKDIR /home
5
+ COPY ./pyproject.toml ./pyproject.toml
6
+ RUN pip install "poetry==1.7.1"
7
+ RUN poetry install --only main --no-root
5
8
  COPY . .
6
- RUN pip install -r requirements.txt
7
- CMD uvicorn main:app --host "0.0.0.0" --port "$APP_PORT"
9
+ CMD poetry run uvicorn main:app --host "0.0.0.0" --port "$APP_PORT"
@@ -0,0 +1,27 @@
1
+ [tool.poetry]
2
+ name = "kebab-zrb-app-name"
3
+ version = "0.0.1"
4
+ description = "zrbAppDescription"
5
+ authors = ["zrbAppAuthorName <zrbAppAuthorEmail>"]
6
+ keywords = []
7
+ packages = [
8
+ {include = "kebab-zrb-project-name", from = ".."},
9
+ ]
10
+
11
+ [tool.poetry.dependencies]
12
+ python = ">=3.10.0,<4.0.0"
13
+ uvicorn = "==0.20.0"
14
+
15
+ [tool.poetry.dev-dependencies]
16
+ flake8 = "~6.0.0"
17
+ black = "~23.12.1"
18
+ isort = "~5.13.2"
19
+ pytest = "~7.4.0"
20
+ pytest-cov = "~4.1.0"
21
+ pytest-asyncio = "~0.21.0"
22
+ flameprof = "~0.4"
23
+
24
+ [build-system]
25
+ requires = ["poetry-core>=1.0.0"]
26
+ build-backend = "poetry.core.masonry.api"
27
+
@@ -12,4 +12,8 @@ try_sudo() {
12
12
  else
13
13
  $@
14
14
  fi
15
- }
15
+ }
16
+
17
+ log_progress() {
18
+ echo -e "🤖 \e[0;33m${1}\e[0;0m"
19
+ }
@@ -1,35 +1,33 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 0.6.2
3
+ Version: 0.7.0
4
4
  Summary: A Framework to Enhance Your Workflow
5
- Author-email: Go Frendi Gunawan <gofrendiasgard@gmail.com>
6
- Requires-Python: >=3.10.0
7
- Description-Content-Type: text/markdown
8
- Classifier: Programming Language :: Python :: 3
5
+ Home-page: https://github.com/state-alchemists/zrb
6
+ License: AGPL-3.0-or-later
7
+ Keywords: Automation,Task Runner,Code Generator,Low Code
8
+ Author: Go Frendi Gunawan
9
+ Author-email: gofrendiasgard@gmail.com
10
+ Requires-Python: >=3.10.0,<4.0.0
9
11
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
10
- Classifier: Operating System :: OS Independent
11
- Requires-Dist: click ~= 8.1.4
12
- Requires-Dist: aiofiles ~= 23.1.0
13
- Requires-Dist: beartype ~= 0.15.0
14
- Requires-Dist: termcolor ~= 2.3.0
15
- Requires-Dist: Jinja2 ~= 3.1.2
16
- Requires-Dist: libcst ~= 0.4.9
17
- Requires-Dist: python-dotenv ~= 1.0.0
18
- Requires-Dist: jsons ~= 1.6.3
19
- Requires-Dist: ruamel.yaml ~= 0.17.32
20
- Requires-Dist: setuptools ~= 68.0.0
21
- Requires-Dist: autopep8 ~= 2.0.2
22
- Requires-Dist: croniter ~= 2.0.1
23
- Requires-Dist: flake8 ~= 6.0.0 ; extra == "dev"
24
- Requires-Dist: black~=23.12.1 ; extra == "dev"
25
- Requires-Dist: isort~=5.13.2 ; extra == "dev"
26
- Requires-Dist: pytest ~= 7.4.0 ; extra == "dev"
27
- Requires-Dist: pytest-cov ~= 4.1.0 ; extra == "dev"
28
- Requires-Dist: pytest-asyncio ~= 0.21.0 ; extra == "dev"
29
- Requires-Dist: flameprof ~= 0.4 ; extra == "dev"
30
- Project-URL: Bug Tracker, https://github.com/state-alchemists/zrb/issues
31
- Project-URL: Homepage, https://github.com/state-alchemists/zrb
32
- Provides-Extra: dev
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Dist: Jinja2 (>=3.1.2,<3.2.0)
17
+ Requires-Dist: aiofiles (>=23.1.0,<23.2.0)
18
+ Requires-Dist: autopep8 (>=2.0.2,<2.1.0)
19
+ Requires-Dist: beartype (>=0.15.0,<0.16.0)
20
+ Requires-Dist: click (>=8.1.4,<8.2.0)
21
+ Requires-Dist: croniter (>=2.0.1,<2.1.0)
22
+ Requires-Dist: jsons (>=1.6.3,<1.7.0)
23
+ Requires-Dist: libcst (>=0.4.9,<0.5.0)
24
+ Requires-Dist: python-dotenv (>=1.0.0,<1.1.0)
25
+ Requires-Dist: ruamel.yaml (>=0.17.32,<0.18.0)
26
+ Requires-Dist: setuptools (>=68.0.0,<68.1.0)
27
+ Requires-Dist: termcolor (>=2.3.0,<2.4.0)
28
+ Project-URL: Documentation, https://github.com/state-alchemists/zrb
29
+ Project-URL: Repository, https://github.com/state-alchemists/zrb
30
+ Description-Content-Type: text/markdown
33
31
 
34
32
  ![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb/android-chrome-192x192.png)
35
33