ssb-project-cli 1.4.2__tar.gz → 1.4.4__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 (27) hide show
  1. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/PKG-INFO +1 -1
  2. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/pyproject.toml +1 -1
  3. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/app.py +18 -1
  4. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/create/create.py +6 -0
  5. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/util.py +23 -0
  6. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/LICENSE +0 -0
  7. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/README.md +0 -0
  8. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/__init__.py +0 -0
  9. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/__main__.py +0 -0
  10. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/py.typed +0 -0
  11. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/__init__.py +0 -0
  12. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/build/__init__.py +0 -0
  13. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/build/build.py +0 -0
  14. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/build/environment.py +0 -0
  15. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/build/poetry.py +0 -0
  16. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/build/prompt.py +0 -0
  17. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/build/temp_template_repo.py +0 -0
  18. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/build_cmds.md +0 -0
  19. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/clean/__init__.py +0 -0
  20. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/clean/clean.py +0 -0
  21. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/create/__init__.py +0 -0
  22. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/create/github.py +0 -0
  23. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/create/local_repo.py +0 -0
  24. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/create/prompt.py +0 -0
  25. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/create/repo_privacy.py +0 -0
  26. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/create/temp_git_repo.py +0 -0
  27. {ssb_project_cli-1.4.2 → ssb_project_cli-1.4.4}/src/ssb_project_cli/ssb_project/settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ssb-project-cli
3
- Version: 1.4.2
3
+ Version: 1.4.4
4
4
  Summary: SSB Project CLI
5
5
  Home-page: https://github.com/statisticsnorway/ssb-project-cli
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ssb-project-cli"
3
- version = "1.4.2"
3
+ version = "1.4.4"
4
4
  description = "SSB Project CLI"
5
5
  authors = ["Statistics Norway <stat-dev@ssb.no>"]
6
6
  license = "MIT"
@@ -18,6 +18,7 @@ from .settings import GITHUB_ORG_NAME
18
18
  from .settings import HOME_PATH
19
19
  from .settings import STAT_TEMPLATE_DEFAULT_REFERENCE
20
20
  from .settings import STAT_TEMPLATE_REPO_URL
21
+ from .util import handle_no_kernel_argument
21
22
 
22
23
 
23
24
  # Don't print with color, it's difficult to read when run in Jupyter
@@ -83,6 +84,12 @@ def create( # noqa: C901, S107
83
84
  help="The git reference to check against. Supports branches, tags and commit hashes.",
84
85
  ),
85
86
  ] = None,
87
+ name: Annotated[
88
+ t.Optional[str], typer.Option("--name", help="Project author's full name.")
89
+ ] = None,
90
+ email: Annotated[
91
+ t.Optional[str], typer.Option("--email", help="Project author's email.")
92
+ ] = None,
86
93
  no_kernel: Annotated[
87
94
  bool,
88
95
  typer.Option(
@@ -106,8 +113,10 @@ def create( # noqa: C901, S107
106
113
  GITHUB_ORG_NAME,
107
114
  template_git_url,
108
115
  checkout,
116
+ name,
117
+ email,
109
118
  verify_config,
110
- no_kernel,
119
+ handle_no_kernel_argument(no_kernel),
111
120
  )
112
121
 
113
122
 
@@ -123,6 +132,13 @@ def build(
123
132
  help="Verify git configuration files. Use --no-verify to disable verification (defaults to True).",
124
133
  show_default=True,
125
134
  ),
135
+ no_kernel: Annotated[
136
+ bool,
137
+ typer.Option(
138
+ "--no-kernel",
139
+ help="Do not install a kernel after the project is built (defaults to False).",
140
+ ),
141
+ ] = False,
126
142
  ) -> None:
127
143
  """:wrench: Create a virtual environment and corresponding Jupyter kernel. Runs in the current folder if no arguments are supplied."""
128
144
  build_project(
@@ -131,6 +147,7 @@ def build(
131
147
  STAT_TEMPLATE_REPO_URL,
132
148
  STAT_TEMPLATE_DEFAULT_REFERENCE,
133
149
  verify_config,
150
+ handle_no_kernel_argument(no_kernel),
134
151
  )
135
152
 
136
153
 
@@ -36,6 +36,8 @@ def create_project( # noqa: C901
36
36
  github_org_name: str,
37
37
  template_repo_url: str,
38
38
  checkout: str | None,
39
+ name: str | None,
40
+ email: str | None,
39
41
  verify_config: bool = True,
40
42
  no_kernel: bool = False,
41
43
  ) -> None:
@@ -52,6 +54,8 @@ def create_project( # noqa: C901
52
54
  github_org_name: Name of GitHub organization
53
55
  template_repo_url: The Cookiecutter template URI.
54
56
  checkout: The git reference to check against. Supports branches, tags and commit hashes.
57
+ name: The project author's name (optional).
58
+ email: The project author's email (optional).
55
59
  verify_config: Determines if gitconfig is verified.
56
60
  no_kernel: Determines if a kernel shall be generated or not.
57
61
  """
@@ -101,6 +105,8 @@ def create_project( # noqa: C901
101
105
  template_repo_url,
102
106
  checkout,
103
107
  working_directory,
108
+ name=name,
109
+ email=email,
104
110
  )
105
111
  build_project(
106
112
  project_directory,
@@ -170,3 +170,26 @@ def get_project_name_and_root_path(
170
170
  # Final fall back to project root directory name
171
171
  return path.name, path
172
172
  return None, None
173
+
174
+
175
+ def handle_no_kernel_argument(no_kernel: bool) -> bool:
176
+ """Handle the 'no_kernel' parameter and environment variable.
177
+
178
+ The CLI flag is always prioritised, otherwise it falls back to the environment
179
+ variable and then lastly defaults to False.
180
+ """
181
+ if no_kernel:
182
+ return no_kernel
183
+ env_var_no_kernel = os.environ.get("NO_KERNEL")
184
+ if env_var_no_kernel is None: # handle NO_KERNEL is undefined case
185
+ return False
186
+ elif env_var_no_kernel not in ["True", "False"]:
187
+ print(
188
+ f"""
189
+ The value of the 'NO_KERNEL' environment variable is {os.environ["NO_KERNEL"]}.
190
+ The only valid values are True and False.
191
+ """
192
+ )
193
+ exit(1)
194
+ else:
195
+ return bool(env_var_no_kernel)
File without changes