viur-cli 2.0.0rc6__tar.gz → 2.0.1.dev1__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 (42) hide show
  1. {viur_cli-2.0.0rc6/src/viur_cli.egg-info → viur_cli-2.0.1.dev1}/PKG-INFO +6 -6
  2. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/setup.cfg +5 -5
  3. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/__init__.py +1 -0
  4. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/cloud.py +19 -1
  5. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/conf.py +40 -30
  6. viur_cli-2.0.1.dev1/src/viur_cli/deprecated.py +18 -0
  7. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/local.py +14 -6
  8. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/update.py +23 -28
  9. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/version.py +1 -1
  10. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1/src/viur_cli.egg-info}/PKG-INFO +6 -6
  11. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli.egg-info/SOURCES.txt +1 -0
  12. viur_cli-2.0.1.dev1/src/viur_cli.egg-info/requires.txt +5 -0
  13. viur_cli-2.0.0rc6/src/viur_cli.egg-info/requires.txt +0 -5
  14. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/LICENSE +0 -0
  15. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/README.md +0 -0
  16. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/pyproject.toml +0 -0
  17. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/setup.py +0 -0
  18. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/build.py +0 -0
  19. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/cli.py +0 -0
  20. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/package.py +0 -0
  21. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/__init__.py +0 -0
  22. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/cli.py +0 -0
  23. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/__init__.py +0 -0
  24. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/csvwriter.py +0 -0
  25. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/dialog.py +0 -0
  26. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/logger.py +0 -0
  27. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/module.py +0 -0
  28. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/network.py +0 -0
  29. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/progressbar.py +0 -0
  30. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/readers.py +0 -0
  31. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/utils.py +0 -0
  32. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/viur.py +0 -0
  33. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scriptor/scriptor/writer.py +0 -0
  34. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scripts/__init__.py +0 -0
  35. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scripts/get_pyodide.py +0 -0
  36. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/scripts/viur_2to3.py +1 -1
  37. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/setup.py +0 -0
  38. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/tool.py +0 -0
  39. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli/utils.py +0 -0
  40. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli.egg-info/dependency_links.txt +0 -0
  41. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli.egg-info/entry_points.txt +0 -0
  42. {viur_cli-2.0.0rc6 → viur_cli-2.0.1.dev1}/src/viur_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: viur_cli
3
- Version: 2.0.0rc6
3
+ Version: 2.0.1.dev1
4
4
  Summary: Command-line interface for ViUR application maintenance.
5
5
  Home-page: https://github.com/viur-framework/viur-cli
6
6
  Author: Andreas H. Kelch
@@ -12,11 +12,11 @@ Classifier: License :: OSI Approved :: MIT License
12
12
  Requires-Python: >=3.11
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: app_server==0.9.9
16
- Requires-Dist: click==8.1.7
17
- Requires-Dist: pipfile-requirements==0.3.0
18
- Requires-Dist: requests==2.31.0
19
- Requires-Dist: semver==3.0.2
15
+ Requires-Dist: app_server~=0.9
16
+ Requires-Dist: click~=8.1.7
17
+ Requires-Dist: pipfile-requirements~=0.3
18
+ Requires-Dist: requests~=2.31
19
+ Requires-Dist: semver~=3.0
20
20
 
21
21
  <div align="center">
22
22
  <img src="https://github.com/viur-framework/viur-artwork/raw/main/icons/icon-cli.svg" height="196" alt="A hexagonal logo of the viur-cli" title="viur-cli">
@@ -20,11 +20,11 @@ package_dir =
20
20
  packages = find:
21
21
  python_requires = >=3.11
22
22
  install_requires =
23
- app_server==0.9.9
24
- click==8.1.7
25
- pipfile-requirements==0.3.0
26
- requests==2.31.0
27
- semver==3.0.2
23
+ app_server~=0.9
24
+ click~=8.1.7
25
+ pipfile-requirements~=0.3
26
+ requests~=2.31
27
+ semver~=3.0
28
28
 
29
29
  [options.packages.find]
30
30
  where = src
@@ -9,3 +9,4 @@ from .scriptor import script
9
9
  from .tool import *
10
10
  from .update import *
11
11
  from .cloud import *
12
+ from .deprecated import *
@@ -87,6 +87,14 @@ def enable_gcp_backup():
87
87
  @click.argument("service", type=click.Choice(["gcloud"]), default="gcloud")
88
88
  @click.argument("profile", default="default")
89
89
  def init(service, profile):
90
+ """
91
+ Initializes the cloud service deployment.
92
+
93
+ Parameters:
94
+ - service (str): The cloud service to be initialized. Expected values are 'gcloud'.
95
+ - profile (str): The profile name to be used for initialization. Default value is 'default'.
96
+
97
+ """
90
98
  deployments = ["cron", "queue", "cron"]
91
99
  if service == "gcloud":
92
100
  for element in deployments:
@@ -97,6 +105,15 @@ def init(service, profile):
97
105
  @click.argument("option", type=click.Choice(["datastore"]), default="datastore")
98
106
  @click.argument("profile", default="default")
99
107
  def cleanup(service, option, profile):
108
+ """
109
+ Cleans up the indexes in the specified service and option.
110
+
111
+ Parameters:
112
+ - service (str): The service to clean up the indexes for.
113
+ - option (str): The option to clean up the indexes for.
114
+ - profile (str): The profile to use for configuration.
115
+
116
+ """
100
117
  conf = config.get_profile(profile)
101
118
 
102
119
  if service == "gcloud" and option == "datastore":
@@ -572,7 +589,8 @@ def deploy(action, profile, name, ext, yes, additional_args):
572
589
  return
573
590
 
574
591
  os.system(
575
- f'gcloud app deploy --project={conf["application_name"]} {" ".join(additional_args)} {yaml_file}')
592
+ f'gcloud app deploy --project={conf["application_name"]} {" ".join(additional_args)} {yaml_file} {"-q" if yes else ""}')
593
+
576
594
 
577
595
 
578
596
  def build_deploy_command(name, conf):
@@ -1,10 +1,13 @@
1
1
  import json
2
+ from pprint import pprint
3
+
2
4
  import click
3
5
  import requests
4
6
  import difflib
5
7
  from .utils import *
6
8
  from .version import __version__ as cli_version
7
9
 
10
+
8
11
  PROJECT_CONFIG_FILE = "project.json"
9
12
  PROJECT_CONFIG_VERSION = "2.0.0"
10
13
  LAST_VERSION = ""
@@ -86,7 +89,40 @@ class ProjectConfig(dict):
86
89
  except:
87
90
  raise click.ClickException(click.style(f"{configname} not found", fg="red"))
88
91
 
92
+ def find_key(self, dictionary, target_key, target, keep=False):
93
+ if target_key in dictionary:
94
+ if keep:
95
+ value = dictionary[target_key]
96
+ else:
97
+ value = dictionary.pop(target_key)
98
+ if not target:
99
+ self[target_key] = value
100
+ else:
101
+ self.setdefault(target, {})[target_key] = value
102
+ else:
103
+ for value in list(dictionary.values()):
104
+ if isinstance(value, dict):
105
+
106
+ self.find_key(value, target_key, target, keep=keep)
107
+
108
+ def remove_key(self, dictionary, target_key):
109
+ if target_key in dictionary:
110
+ del dictionary[target_key]
111
+
112
+ for value in list(dictionary.values()):
113
+ if isinstance(value, dict):
114
+ self.remove_key(value, target_key)
115
+
89
116
  def migrate(self):
117
+
118
+ if "application_name" not in self["default"]:
119
+ self.find_key(self, target_key="application_name", target="default", keep=True)
120
+ if "application_name" in self:
121
+ del self["application_name"]
122
+
123
+ self.remove_key(self, target_key="core")
124
+
125
+
90
126
  if old_format := self["default"].get("format"):
91
127
  self["format"] = old_format
92
128
  del self["default"]["format"]
@@ -118,17 +154,6 @@ class ProjectConfig(dict):
118
154
  builds[k]["kind"] = "exec"
119
155
  self["default"]["builds"] = builds
120
156
 
121
- # Version 1.2.0
122
- """
123
- Convert versions in the configuration to builds.
124
-
125
- This method iterates through the provided version list and updates the project configuration
126
- by converting versions to builds.
127
-
128
- :param version_list: list
129
- List of versions to convert to builds.
130
- :return: None
131
- """
132
157
  # Check if Builds is in the project.json
133
158
  if "builds" not in self["default"].keys():
134
159
  self["default"]["builds"] = {}
@@ -159,27 +184,12 @@ class ProjectConfig(dict):
159
184
  )
160
185
 
161
186
  if response == "yes":
162
- del self["default"]["builds"]["vi"]
187
+ self["default"]["builds"].pop("vi", None)
188
+ echo_info("You are using the ViUR Admin")
163
189
  elif response == "no":
164
- del self["default"]["builds"]["admin"]
165
-
166
- """
167
- Fetch the version of the 'viur-core' package.
168
-
169
- This method is responsible for fetching the version of the 'viur-core' package using 'pip list' and updating
170
- the project configuration accordingly.
171
-
172
- :return: None
173
- """
174
- try:
175
- result = os.popen('pip list --format=json').read()
176
- core_version = [x for x in json.loads(result) if x["name"] == "viur-core"][0]["version"]
177
- self["default"]["core"] = core_version
178
-
179
- except:
180
- self["default"]["core"] = "submodule"
190
+ self["default"]["builds"].pop("admin", None)
191
+ echo_info("You are using the Vi Administration")
181
192
 
182
- # conf updates must increase format version
183
193
  self.save()
184
194
 
185
195
 
@@ -0,0 +1,18 @@
1
+ import click
2
+ from . import cli, echo_error
3
+
4
+ '''
5
+ This Document keeps Track of "Deprecation Warnings"
6
+ '''
7
+
8
+ @cli.command(hidden= True)
9
+ @click.argument('argument', nargs=-1)
10
+ def install(argument: list):
11
+ echo_error("the ViUR install command is out of Date")
12
+ echo_error("Please use the 'viur package' commands instead")
13
+
14
+ @cli.command(hidden= True)
15
+ @click.argument('argument', nargs=-1)
16
+ def deploy(argument: list):
17
+ echo_error("The 'deploy' command out of Date")
18
+ echo_error("Please use 'viur cloud deploy' commands instead")
@@ -7,7 +7,7 @@ import subprocess
7
7
 
8
8
  from viur_cli import echo_info, echo_warning
9
9
  from .conf import config
10
- from . import cli, echo_error, utils
10
+ from . import cli, echo_error, utils, echo_fatal
11
11
  from requests import get
12
12
  from .package import vi as vi_install
13
13
  from types import SimpleNamespace
@@ -23,7 +23,7 @@ def get_user_info():
23
23
  curl_command = f'curl -X GET -H "Authorization: Bearer {auth_token}" "https://www.googleapis.com/oauth2/v1/userinfo?alt=json"'
24
24
 
25
25
  curl_process = subprocess.run(curl_command,
26
- capture_output=True, shell = True,
26
+ capture_output=True, shell=True,
27
27
  text=True)
28
28
  user_info = json.loads(curl_process.stdout)
29
29
 
@@ -37,11 +37,18 @@ def run(profile, additional_args):
37
37
  """
38
38
  Start your application locally.
39
39
  The 'run' command launches your ViUR application locally specified configuration and optional arguments.
40
+ This Enforces the Usage of gcloud tool
40
41
  """
41
- echo_warning(f"You are using the development Server with your default account: {get_user_info()['email']}")
42
+ try:
43
+ echo_warning(f"You are using the development Server with your default account: {get_user_info()['email']}")
44
+ except:
45
+ echo_fatal(f"It seems you are not Using an appropriate account. "
46
+ f"Please install the 'gcloud' tool or Log in with an appropriate account.")
47
+
42
48
  conf = config.get_profile(profile)
49
+ utils.system(
50
+ f'app_server -A={conf["application_name"]} {conf["distribution_folder"]} {" ".join(additional_args)}')
43
51
 
44
- utils.system(f'app_server -A={conf["application_name"]} {conf["distribution_folder"]} {" ".join(additional_args)}')
45
52
 
46
53
  @cli.command()
47
54
  @click.argument("profile", default="default")
@@ -149,10 +156,11 @@ def env(profile):
149
156
  else:
150
157
  click.echo(f"{failed_icon} gcloud")
151
158
 
152
- click.echo(f"Your default gcloud user Info:")
153
- for k,v in get_user_info().items():
159
+ click.echo(f"\nYour default gcloud user Info:\n--------------------------------")
160
+ for k, v in get_user_info().items():
154
161
  click.echo(f"{k}: {v}")
155
162
 
163
+
156
164
  @cli.command()
157
165
  @click.option('--dev', '-d', is_flag=True, default=False)
158
166
  def check(dev):
@@ -3,7 +3,7 @@ import os
3
3
  import sys
4
4
  import re
5
5
  from .conf import config
6
- from . import cli, echo_error, echo_positive, echo_info, utils
6
+ from . import cli, echo_error, echo_info, utils
7
7
 
8
8
 
9
9
  @cli.command(context_settings={"ignore_unknown_options": True})
@@ -20,20 +20,14 @@ def update(action, profile, additional_args):
20
20
  that the specified project configuration exists.
21
21
 
22
22
  Note:
23
-
24
23
  - Ensure that the specified project configuration ('name') is valid and defined in your project's configuration.
25
-
26
24
  - Additional arguments can be used to customize the update process if supported by the action.
27
-
28
25
  """
29
- conf = config.get_profile(profile)
30
26
 
31
27
  if action == "requirements":
32
28
  create_req(True, profile)
33
29
 
34
30
 
35
-
36
-
37
31
  def create_req(yes, profile, confirm_value=True):
38
32
  """
39
33
  Load project's pipenv and build a requirements.txt.
@@ -53,27 +47,28 @@ def create_req(yes, profile, confirm_value=True):
53
47
  """
54
48
  conf = config.get_profile(profile)
55
49
  dist_folder = conf["distribution_folder"]
56
- if conf["core"] != "submodule":
57
- if yes or click.confirm(
58
- text=f"Do you want to regenerate the requirements.txt located in the {dist_folder}?",
59
- default=confirm_value):
60
- os.system(f"pipfile2req --hashes > {dist_folder}/requirements.txt")
61
- file_object = open(f"{dist_folder}/requirements.txt", 'r')
62
- generated_requirements = file_object.read()
63
- for line in generated_requirements.splitlines():
64
- if "]==" in line:
65
- # we got a dependency with extras
66
- generated_requirements += re.sub(r"\[.*?\]", "", line) + "\n"
67
- file_object.close()
68
-
69
- file_obj = open(f"{dist_folder}/requirements.txt", 'w')
70
- file_obj.write(generated_requirements)
71
- file_obj.close()
72
- echo_info("requirements.txt successfully generated")
73
-
74
- if check_req(f"{dist_folder}/requirements.txt"):
75
- if not click.confirm(f"There are some depencency errors, are you sure you want to continue?"):
76
- sys.exit(0)
50
+
51
+ if yes or click.confirm( text=f"Do you want to regenerate the requirements.txt located in the {dist_folder}?",
52
+ default=confirm_value):
53
+ os.system(f"pipfile2req --hashes > {dist_folder}/requirements.txt")
54
+ file_object = open(f"{dist_folder}/requirements.txt", 'r')
55
+ generated_requirements = file_object.read()
56
+
57
+ for line in generated_requirements.splitlines():
58
+ if "]==" in line:
59
+ # we got a dependency with extras
60
+ generated_requirements += re.sub(r"\[.*?\]", "", line) + "\n"
61
+ file_object.close()
62
+
63
+
64
+ file_obj = open(f"{dist_folder}/requirements.txt", 'w')
65
+ file_obj.write(generated_requirements)
66
+ file_obj.close()
67
+ echo_info("requirements.txt successfully generated")
68
+
69
+ if check_req(f"{dist_folder}/requirements.txt"):
70
+ if not click.confirm(f"There are some depencency errors, are you sure you want to continue?"):
71
+ sys.exit(0)
77
72
 
78
73
 
79
74
  def check_req(projects_requirements_path):
@@ -1,3 +1,3 @@
1
- __version__ = "2.0.0-rc6"
1
+ __version__ = "2.0.1.dev1"
2
2
  MINIMAL_PIPENV = "2023.11.15"
3
3
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: viur_cli
3
- Version: 2.0.0rc6
3
+ Version: 2.0.1.dev1
4
4
  Summary: Command-line interface for ViUR application maintenance.
5
5
  Home-page: https://github.com/viur-framework/viur-cli
6
6
  Author: Andreas H. Kelch
@@ -12,11 +12,11 @@ Classifier: License :: OSI Approved :: MIT License
12
12
  Requires-Python: >=3.11
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: app_server==0.9.9
16
- Requires-Dist: click==8.1.7
17
- Requires-Dist: pipfile-requirements==0.3.0
18
- Requires-Dist: requests==2.31.0
19
- Requires-Dist: semver==3.0.2
15
+ Requires-Dist: app_server~=0.9
16
+ Requires-Dist: click~=8.1.7
17
+ Requires-Dist: pipfile-requirements~=0.3
18
+ Requires-Dist: requests~=2.31
19
+ Requires-Dist: semver~=3.0
20
20
 
21
21
  <div align="center">
22
22
  <img src="https://github.com/viur-framework/viur-artwork/raw/main/icons/icon-cli.svg" height="196" alt="A hexagonal logo of the viur-cli" title="viur-cli">
@@ -8,6 +8,7 @@ src/viur_cli/build.py
8
8
  src/viur_cli/cli.py
9
9
  src/viur_cli/cloud.py
10
10
  src/viur_cli/conf.py
11
+ src/viur_cli/deprecated.py
11
12
  src/viur_cli/local.py
12
13
  src/viur_cli/package.py
13
14
  src/viur_cli/setup.py
@@ -0,0 +1,5 @@
1
+ app_server~=0.9
2
+ click~=8.1.7
3
+ pipfile-requirements~=0.3
4
+ requests~=2.31
5
+ semver~=3.0
@@ -1,5 +0,0 @@
1
- app_server==0.9.9
2
- click==8.1.7
3
- pipfile-requirements==0.3.0
4
- requests==2.31.0
5
- semver==3.0.2
File without changes
File without changes
File without changes
@@ -21,8 +21,8 @@ lookup = {
21
21
  "onItemEdited": "onEdited",
22
22
  "projectID": "conf[\"viur.instance.project_id\"]",
23
23
  "utils.currentLanguage": "current.language",
24
- "utils.currentRequest": "current.request",
25
24
  "utils.currentRequestData": "current.request_data",
25
+ "utils.currentRequest": "current.request",
26
26
  "utils.currentSession": "current.session",
27
27
  "utils.getCurrentUser": "current.user.get",
28
28
  "utils.isLocalDevelopmentServer": "conf[\"viur.instance.is_dev_server\"]",