bluer-objects 6.377.1__py3-none-any.whl → 6.464.1__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 (72) hide show
  1. bluer_objects/.abcli/alias.sh +8 -12
  2. bluer_objects/.abcli/assets/cd.sh +1 -1
  3. bluer_objects/.abcli/assets/mv.sh +6 -6
  4. bluer_objects/.abcli/assets/publish.sh +4 -1
  5. bluer_objects/.abcli/mlflow/tags/search.sh +1 -5
  6. bluer_objects/.abcli/tests/help.sh +0 -7
  7. bluer_objects/.abcli/tests/mlflow_tags.sh +1 -1
  8. bluer_objects/.abcli/tests/pdf.sh +10 -2
  9. bluer_objects/README/__init__.py +7 -37
  10. bluer_objects/README/alias.py +15 -4
  11. bluer_objects/README/build/__init__.py +0 -0
  12. bluer_objects/README/build/aliases.py +23 -0
  13. bluer_objects/README/build/docs.py +23 -0
  14. bluer_objects/README/build/modules.py +9 -0
  15. bluer_objects/README/consts.py +8 -3
  16. bluer_objects/README/functions.py +50 -22
  17. bluer_objects/README/process/__init__.py +0 -0
  18. bluer_objects/README/process/assets.py +36 -0
  19. bluer_objects/README/process/details.py +20 -0
  20. bluer_objects/README/process/envs.py +23 -0
  21. bluer_objects/README/process/help.py +27 -0
  22. bluer_objects/README/process/include.py +40 -0
  23. bluer_objects/README/process/legacy.py +21 -0
  24. bluer_objects/README/process/mermaid.py +20 -0
  25. bluer_objects/README/process/national_internet.py +55 -0
  26. bluer_objects/README/process/objects.py +32 -0
  27. bluer_objects/README/process/signature.py +35 -0
  28. bluer_objects/README/process/title.py +44 -0
  29. bluer_objects/README/process/variables.py +12 -0
  30. bluer_objects/__init__.py +1 -1
  31. bluer_objects/config.env +8 -4
  32. bluer_objects/env.py +4 -1
  33. bluer_objects/file/functions.py +8 -1
  34. bluer_objects/help/assets.py +6 -9
  35. bluer_objects/help/functions.py +0 -2
  36. bluer_objects/help/mlflow/cache.py +2 -4
  37. bluer_objects/help/mlflow/tags.py +34 -23
  38. bluer_objects/mlflow/__init__.py +1 -1
  39. bluer_objects/mlflow/__main__.py +49 -31
  40. bluer_objects/mlflow/lock/functions.py +1 -1
  41. bluer_objects/mlflow/logging.py +6 -0
  42. bluer_objects/mlflow/models.py +7 -0
  43. bluer_objects/mlflow/objects.py +7 -0
  44. bluer_objects/mlflow/runs.py +10 -1
  45. bluer_objects/mlflow/serverless/__init__.py +3 -0
  46. bluer_objects/mlflow/serverless/api.py +88 -0
  47. bluer_objects/mlflow/serverless/read.py +19 -0
  48. bluer_objects/mlflow/serverless/search.py +35 -0
  49. bluer_objects/mlflow/serverless/write.py +42 -0
  50. bluer_objects/mlflow/tags.py +59 -9
  51. bluer_objects/objects.py +3 -1
  52. bluer_objects/pdf/convert/convert.py +1 -2
  53. bluer_objects/tests/test_env.py +34 -22
  54. bluer_objects/tests/test_file_download.py +5 -0
  55. bluer_objects/tests/test_mlflow.py +112 -3
  56. bluer_objects/tests/test_web_is_accessible.py +1 -1
  57. {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/METADATA +19 -13
  58. {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/RECORD +61 -50
  59. {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/WHEEL +1 -1
  60. bluer_objects/.abcli/tests/mlflow_test.sh +0 -7
  61. bluer_objects/.abcli/tests/web_is_accessible.sh +0 -17
  62. bluer_objects/.abcli/tests/web_where_am_ai.sh +0 -5
  63. bluer_objects/.abcli/url.sh +0 -15
  64. bluer_objects/.abcli/web/is_accessible.sh +0 -13
  65. bluer_objects/.abcli/web/where_am_i.sh +0 -5
  66. bluer_objects/README/utils.py +0 -275
  67. bluer_objects/help/web.py +0 -38
  68. bluer_objects/web/__init__.py +0 -1
  69. bluer_objects/web/__main__.py +0 -31
  70. bluer_objects/web/functions.py +0 -9
  71. {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/licenses/LICENSE +0 -0
  72. {bluer_objects-6.377.1.dist-info → bluer_objects-6.464.1.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,5 @@
1
1
  #! /usr/bin/env bash
2
2
 
3
- alias @ai=bluer_ai
4
- alias @i=bluer_ai
5
-
6
3
  alias @assets=bluer_objects_assets
7
4
 
8
5
  alias @create_test_asset=bluer_objects_create_test_asset
@@ -12,7 +9,6 @@ alias @download=bluer_objects_download
12
9
  alias @gif=bluer_objects_gif
13
10
 
14
11
  alias @cache=bluer_objects_mlflow_cache
15
- alias @ref="bluer_objects_mlflow_cache read"
16
12
  alias @tags=bluer_objects_mlflow_tags
17
13
 
18
14
  alias @clone=bluer_objects_clone
@@ -30,18 +26,18 @@ alias @metadata=bluer_objects_metadata
30
26
 
31
27
  alias @mlflow=bluer_objects_mlflow
32
28
 
33
- alias @mysql=abcli_mysql
29
+ alias @pdf=bluer_objects_pdf
34
30
 
35
- alias @objects=bluer_objects
31
+ alias @upload=bluer_objects_upload
36
32
 
37
- alias @pdf=bluer_objects_pdf
33
+ # ignore
34
+ alias @i=bluer_ai
35
+ alias @ai=bluer_ai
36
+
37
+ alias @objects=bluer_objects
38
38
 
39
- alias @random=bluer_ai_string_random
39
+ alias @ref="bluer_objects_mlflow_cache read"
40
40
 
41
41
  alias @select=bluer_ai_select
42
42
 
43
43
  alias @storage=bluer_ai_storage
44
-
45
- alias @upload=bluer_objects_upload
46
-
47
- alias @web=bluer_objects_web
@@ -3,7 +3,7 @@
3
3
  function bluer_objects_assets_cd() {
4
4
  local options=$1
5
5
  local do_create=$(bluer_ai_option_int "$options" create 0)
6
- local volume=$(bluer_ai_option "$options" vol)
6
+ local volume=$(bluer_ai_option "$options" vol $BLUER_OBJECTS_DEFAULT_ASSETS_VOL)
7
7
 
8
8
  local path=$2
9
9
  path=$abcli_path_git/assets$volume/$path
@@ -2,23 +2,23 @@
2
2
 
3
3
  function bluer_objects_assets_mv() {
4
4
  local options=$1
5
- local do_create=$(bluer_ai_option_int "$options" create 0)
5
+ local do_create=$(bluer_ai_option_int "$options" create 1)
6
6
  local extension=$(bluer_ai_option "$options" extension jpg)
7
- local volume=$(bluer_ai_option "$options" vol)
7
+ local volume=$(bluer_ai_option "$options" vol $BLUER_OBJECTS_DEFAULT_ASSETS_VOL)
8
8
 
9
9
  local path=$2
10
- path=$abcli_path_git/assets$volume/$path
10
+ local full_path=$abcli_path_git/assets$volume/$path/
11
11
 
12
12
  if [[ "$do_create" == 1 ]]; then
13
- mkdir -pv $path
13
+ mkdir -pv $full_path
14
14
  [[ $? -ne 0 ]] && return 1
15
15
  fi
16
16
 
17
- bluer_ai_log "Downloads/.$extension -> assets$volume/path"
17
+ bluer_ai_log "Downloads/.$extension -> assets$volume/$path"
18
18
 
19
19
  mv -v \
20
20
  $HOME/Downloads/*.$extension \
21
- $path
21
+ $full_path
22
22
  [[ $? -ne 0 ]] && return 1
23
23
 
24
24
  local push_options=$3
@@ -4,7 +4,10 @@ function bluer_objects_assets_publish() {
4
4
  local options=$1
5
5
 
6
6
  local do_download=$(bluer_ai_option_int "$options" download 0)
7
- local do_pull=$(bluer_ai_option_int "$options" pull 1)
7
+
8
+ local do_pull=1
9
+ [[ "$BLUER_AI_WEB_STATUS" != "online" ]] && do_pull=0
10
+ do_pull=$(bluer_ai_option_int "$options" pull $do_pull)
8
11
  local do_push=$(bluer_ai_option_int "$options" push 0)
9
12
  local extensions=$(bluer_ai_option "$options" extensions png)
10
13
 
@@ -1,12 +1,8 @@
1
1
  #! /usr/bin/env bash
2
2
 
3
3
  function bluer_objects_mlflow_tags_search() {
4
- local options=$1
5
- local is_explicit=$(bluer_ai_option_int "$options" explicit 0)
6
-
7
4
  python3 -m bluer_objects.mlflow \
8
5
  search \
9
- --explicit_query $is_explicit \
10
- --tags "$options" \
6
+ --tags "$1" \
11
7
  "${@:2}"
12
8
  }
@@ -3,9 +3,6 @@
3
3
  function test_bluer_objects_help() {
4
4
  local options=$1
5
5
 
6
- # legacy, not tested:
7
- # - @mysql
8
-
9
6
  local module
10
7
  for module in \
11
8
  "@assets" \
@@ -89,10 +86,6 @@ function test_bluer_objects_help() {
89
86
  \
90
87
  "@upload" \
91
88
  \
92
- "@web" \
93
- "@web is_accessible" \
94
- "@web where_am_i" \
95
- \
96
89
  "@wait" \
97
90
  \
98
91
  "bluer_objects"; do
@@ -24,6 +24,6 @@ function test_bluer_objects_mlflow_tags_search() {
24
24
  local options=$1
25
25
 
26
26
  bluer_objects_mlflow_tags search \
27
- cloned.firms_area-template-v1=True \
27
+ this=that,what,~who \
28
28
  --log 0
29
29
  }
@@ -3,11 +3,15 @@
3
3
  function test_bluer_objects_pdf_convert_inline() {
4
4
  local options=$1
5
5
 
6
+ local do_install=1
7
+ [[ "$abcli_is_mac" == true ]] &&
8
+ do_install=0
9
+
6
10
  local object_name=test_bluer_objects_pdf_convert-$(bluer_ai_string_timestamp)
7
11
 
8
12
  bluer_ai_eval ,$options \
9
13
  bluer_objects_pdf_convert \
10
- inline,install,combine,$2 \
14
+ inline,install=$do_install,combine,$2 \
11
15
  bluer_objects \
12
16
  aliases,aliases/assets.md \
13
17
  $object_name \
@@ -19,11 +23,15 @@ function test_bluer_objects_pdf_convert_inline() {
19
23
  function test_bluer_objects_pdf_convert() {
20
24
  local options=$1
21
25
 
26
+ local do_install=1
27
+ [[ "$abcli_is_mac" == true ]] &&
28
+ do_install=0
29
+
22
30
  local object_name=test_bluer_objects_pdf_convert-2025-11-30-ci0cd7
23
31
 
24
32
  bluer_ai_eval ,$options \
25
33
  bluer_objects_pdf_convert \
26
- install,combine,$2 \
34
+ install=$do_install,combine,$2 \
27
35
  $object_name \
28
36
  "${@:3}"
29
37
 
@@ -1,60 +1,30 @@
1
1
  import os
2
2
 
3
- from blueness import module
4
-
5
3
  from bluer_options.help.functions import get_help
6
- from bluer_objects import NAME as MY_NAME
4
+
5
+ from bluer_objects import NAME, VERSION, REPO_NAME, ICON
7
6
  from bluer_objects import file
7
+ from bluer_objects.README.build.docs import docs
8
8
  from bluer_objects.README.functions import build
9
9
  from bluer_objects.README.items import Items
10
10
  from bluer_objects.help.functions import help_functions
11
- from bluer_objects.logger import logger
12
-
13
- MY_NAME = module.name(__file__, MY_NAME)
14
11
 
15
12
 
16
13
  def build_me() -> bool:
17
- from bluer_objects import NAME, VERSION, REPO_NAME, ICON
18
-
19
14
  return all(
20
15
  build(
21
- path=os.path.join(file.path(__file__), path),
16
+ items=readme.get("items", []),
17
+ path=os.path.join(file.path(__file__), readme["path"]),
22
18
  ICON=ICON,
23
19
  NAME=NAME,
24
20
  VERSION=VERSION,
25
21
  REPO_NAME=REPO_NAME,
22
+ macros=readme.get("macros", {}),
26
23
  help_function=lambda tokens: get_help(
27
24
  tokens,
28
25
  help_functions,
29
26
  mono=True,
30
27
  ),
31
28
  )
32
- for path in [
33
- "../docs/aliases",
34
- "../docs",
35
- "../..",
36
- ".",
37
- ]
38
- + [
39
- f"../docs/aliases/{alias}.md"
40
- for alias in [
41
- "assets",
42
- "clone",
43
- "download",
44
- "file",
45
- "gif",
46
- "host",
47
- "ls",
48
- "metadata",
49
- "mlflow",
50
- "pdf",
51
- "upload",
52
- ]
53
- ]
54
- + [
55
- f"../mlflow/{module_name}"
56
- for module_name in [
57
- "lock",
58
- ]
59
- ]
29
+ for readme in docs
60
30
  )
@@ -4,6 +4,8 @@ from pathlib import Path
4
4
  import os
5
5
  import re
6
6
 
7
+ from bluer_ai import NAME as BLUER_AI_NAME
8
+
7
9
  from bluer_objects import file
8
10
 
9
11
 
@@ -18,7 +20,11 @@ def list_of_aliases(
18
20
 
19
21
  alias_sh_path = os.path.join(
20
22
  module_path,
21
- ".abcli/alias.sh",
23
+ (
24
+ ".abcli/plugins/alias.sh"
25
+ if module_name == BLUER_AI_NAME
26
+ else ".abcli/alias.sh"
27
+ ),
22
28
  )
23
29
 
24
30
  output: List[str] = []
@@ -41,16 +47,21 @@ def list_of_aliases(
41
47
  m = re.fullmatch(r"alias\s+@([^=]+)=.+", s.strip())
42
48
  return m.group(1) if m else ""
43
49
 
50
+ list_of_aliases = [
51
+ alias_name
52
+ for alias_name in sorted([extract_alias_name(line) for line in content])
53
+ if alias_name not in ["", "."]
54
+ ]
55
+
44
56
  return [
45
57
  (
46
58
  (
47
59
  f"- [@{alias_name}](./{alias_name}.md)"
48
60
  if itemized
49
- else f"[@{alias_name}](./bluer_agent/docs/aliases/{alias_name}.md) "
61
+ else f"[@{alias_name}](./{module_name}/docs/aliases/{alias_name}.md) "
50
62
  )
51
63
  if as_markdown
52
64
  else alias_name
53
65
  )
54
- for alias_name in sorted([extract_alias_name(line) for line in content])
55
- if alias_name
66
+ for alias_name in list_of_aliases
56
67
  ]
File without changes
@@ -0,0 +1,23 @@
1
+ from bluer_objects import NAME
2
+ from bluer_objects.README.alias import list_of_aliases
3
+
4
+
5
+ docs = [
6
+ {
7
+ "path": "../docs/aliases",
8
+ "macros": {
9
+ "aliases:::": list_of_aliases(
10
+ NAME,
11
+ itemized=True,
12
+ ),
13
+ },
14
+ },
15
+ ] + [
16
+ {
17
+ "path": f"../docs/aliases/{alias_name}.md",
18
+ }
19
+ for alias_name in list_of_aliases(
20
+ NAME,
21
+ as_markdown=False,
22
+ )
23
+ ]
@@ -0,0 +1,23 @@
1
+ from bluer_objects import NAME
2
+ from bluer_objects.README.build import modules
3
+ from bluer_objects.README.alias import list_of_aliases
4
+ from bluer_objects.README.build import aliases
5
+
6
+ docs = (
7
+ [
8
+ {
9
+ "path": ".",
10
+ },
11
+ {
12
+ "path": "../..",
13
+ "macros": {
14
+ "aliases:::": list_of_aliases(NAME),
15
+ },
16
+ },
17
+ {
18
+ "path": "../docs",
19
+ },
20
+ ]
21
+ + aliases.docs
22
+ + modules.docs
23
+ )
@@ -0,0 +1,9 @@
1
+ docs = [
2
+ {
3
+ "path": f"../mlflow/{module_name}",
4
+ }
5
+ for module_name in [
6
+ "lock",
7
+ "serverless",
8
+ ]
9
+ ]
@@ -4,20 +4,25 @@ from typing import Union
4
4
  from bluer_objects.env import abcli_path_git
5
5
 
6
6
  github_kamangir = "https://github.com/kamangir"
7
- designs_repo = f"{github_kamangir}/bluer-designs/"
7
+ designs_repo = f"{github_kamangir}/bluer-designs"
8
8
 
9
9
 
10
10
  def designs_url(suffix: str) -> str:
11
- return f"{designs_repo}/blob/main/{suffix}"
11
+ return "{}/blob/main{}".format(
12
+ designs_repo,
13
+ f"/{suffix}" if suffix else "",
14
+ )
12
15
 
13
16
 
14
17
  def assets_url(
15
18
  suffix: str = "",
16
19
  volume: Union[str, int] = "",
20
+ blob: bool = False,
17
21
  ) -> str:
18
- return "{}/assets{}/raw/main{}".format(
22
+ return "{}/assets{}/{}/main{}".format(
19
23
  github_kamangir,
20
24
  str(volume),
25
+ "blob" if blob else "raw",
21
26
  f"/{suffix}" if suffix else "",
22
27
  )
23
28
 
@@ -3,25 +3,24 @@ import os
3
3
  import yaml
4
4
 
5
5
  from blueness import module
6
-
6
+ from bluer_options import env
7
+ from bluer_options.logger import shorten_text
7
8
  from bluer_objects import NAME as MY_NAME
8
- from bluer_objects.metadata import get_from_object
9
- from bluer_objects import file, env
9
+ from bluer_objects import file
10
10
  from bluer_objects import markdown
11
- from bluer_objects.README.utils import (
12
- apply_legacy,
13
- process_assets,
14
- process_details,
15
- process_envs,
16
- process_help,
17
- process_include,
18
- process_mermaid,
19
- process_objects,
20
- process_title,
21
- process_variable,
22
- signature,
23
- variables,
24
- )
11
+ from bluer_objects.metadata import get_from_object
12
+ from bluer_objects.README.process.assets import process_assets
13
+ from bluer_objects.README.process.details import process_details
14
+ from bluer_objects.README.process.envs import process_envs
15
+ from bluer_objects.README.process.help import process_help
16
+ from bluer_objects.README.process.include import process_include
17
+ from bluer_objects.README.process.legacy import apply_legacy
18
+ from bluer_objects.README.process.mermaid import process_mermaid
19
+ from bluer_objects.README.process.national_internet import process_national_internet
20
+ from bluer_objects.README.process.objects import process_objects
21
+ from bluer_objects.README.process.title import process_title
22
+ from bluer_objects.README.process.variables import process_variable, variables
23
+ from bluer_objects.README.process.signature import signature
25
24
  from bluer_objects.logger import logger
26
25
 
27
26
  MY_NAME = module.name(__file__, MY_NAME)
@@ -42,7 +41,8 @@ def build(
42
41
  help_function: Union[Callable[[List[str]], str], None] = None,
43
42
  legacy_mode: bool = True,
44
43
  assets_repo: str = "kamangir/assets",
45
- download: bool = True,
44
+ download: bool = env.BLUER_AI_WEB_STATUS != "offline",
45
+ verbose: bool = False,
46
46
  ) -> bool:
47
47
  if path:
48
48
  if path.endswith(".md"):
@@ -56,7 +56,7 @@ def build(
56
56
  MODULE_NAME = REPO_NAME
57
57
 
58
58
  logger.info(
59
- "{}.build: {}-{}: {}[{}]: {} -{}> {}".format(
59
+ "{}.build: {}-{}: {}[{}]: {} -{}{}> {}".format(
60
60
  MY_NAME,
61
61
  NAME,
62
62
  VERSION,
@@ -64,10 +64,15 @@ def build(
64
64
  MODULE_NAME,
65
65
  template_filename,
66
66
  "+legacy-" if legacy_mode else "",
67
+ "download-" if download else "",
67
68
  filename,
68
69
  )
69
70
  )
70
71
 
72
+ if verbose:
73
+ logger.info(f"filename: {filename}")
74
+ logger.info(f"items: {items}")
75
+
71
76
  table_of_items = markdown.generate_table(items, cols=cols) if cols > 0 else items
72
77
 
73
78
  success, template = file.load_text(template_filename)
@@ -107,7 +112,7 @@ def build(
107
112
  download=download,
108
113
  )
109
114
 
110
- logger.info(f"metadata[{object_name_and_key}] = {value}")
115
+ logger.info(shorten_text(f"metadata[{object_name_and_key}] = {value}"))
111
116
 
112
117
  if template_line.startswith("metadata:::"):
113
118
  content += (
@@ -195,10 +200,33 @@ def build(
195
200
  content_section = process_mermaid(template_line)
196
201
  else:
197
202
  for macro, macro_value in macros.items():
198
- if macro in template_line:
199
- content_section = macro_value
203
+ if macro not in template_line:
204
+ continue
205
+
206
+ if template_line.replace(macro, "").strip():
207
+ # this and that macro::: is going to be ...
208
+ content_section = [
209
+ template_line.replace(
210
+ macro,
211
+ (
212
+ " ".join(macro_value)
213
+ if isinstance(macro_value, list)
214
+ else macro_value
215
+ ),
216
+ )
217
+ ]
218
+ else:
219
+ # macro:::
220
+ content_section = (
221
+ macro_value if isinstance(macro_value, list) else [macro_value]
222
+ )
200
223
  break
201
224
 
202
225
  content += content_section
203
226
 
227
+ content = process_national_internet(
228
+ filename,
229
+ content,
230
+ )
231
+
204
232
  return file.save_text(filename, content)
File without changes
@@ -0,0 +1,36 @@
1
+ from bluer_objects import file
2
+
3
+
4
+ def process_assets(
5
+ template_line: str,
6
+ assets_repo: str,
7
+ ) -> str:
8
+ prefix = f"https://github.com/{assets_repo}/blob/main"
9
+
10
+ if "assets:::" in template_line:
11
+ template_line = " ".join(
12
+ [
13
+ (
14
+ (
15
+ "![image]({}/{}?raw=true)".format(
16
+ prefix,
17
+ token.split(":::")[1].strip(),
18
+ )
19
+ if any(
20
+ token.endswith(extension)
21
+ for extension in ["png", "jpg", "jpeg", "gif"]
22
+ )
23
+ else "[{}]({}/{})".format(
24
+ file.name_and_extension(token.split(":::")[1].strip()),
25
+ prefix,
26
+ token.split(":::")[1].strip(),
27
+ )
28
+ )
29
+ if token.startswith("assets:::")
30
+ else token
31
+ )
32
+ for token in template_line.split(" ")
33
+ ]
34
+ )
35
+
36
+ return template_line
@@ -0,0 +1,20 @@
1
+ from typing import List
2
+
3
+
4
+ def process_details(template_line: str) -> List[str]:
5
+ suffix = template_line.split(":::", 1)[1]
6
+ if suffix:
7
+ content_section = [
8
+ "",
9
+ "<details>",
10
+ f"<summary>{suffix}</summary>",
11
+ "",
12
+ ]
13
+ else:
14
+ content_section = [
15
+ "",
16
+ "</details>",
17
+ "",
18
+ ]
19
+
20
+ return content_section
@@ -0,0 +1,23 @@
1
+ from bluer_options.env import get_env
2
+
3
+ from bluer_objects.logger import logger
4
+
5
+
6
+ def process_envs(template_line: str) -> str:
7
+ while "env:::" in template_line:
8
+ env_name = template_line.split("env:::", 1)[1]
9
+ if " " in env_name:
10
+ env_name = env_name.split(" ", 1)[0]
11
+ else:
12
+ if ":::" in env_name:
13
+ env_name = env_name.split(":::", 1)[0]
14
+
15
+ env_value = get_env(env_name)
16
+
17
+ template_line = template_line.replace(
18
+ f"env:::{env_name}",
19
+ env_value,
20
+ )
21
+ logger.info(f"{env_name} -> {env_value}")
22
+
23
+ return template_line
@@ -0,0 +1,27 @@
1
+ from typing import List, Union, Callable, Tuple
2
+
3
+ from bluer_objects.logger import logger
4
+
5
+
6
+ def process_help(
7
+ template_line: str,
8
+ help_function: Union[Callable[[List[str]], str], None] = None,
9
+ ) -> Tuple[bool, List[str]]:
10
+ help_command = template_line.split("help:::")[1].strip()
11
+
12
+ tokens = help_command.strip().split(" ")[1:]
13
+
14
+ help_content = help_function(tokens)
15
+ if not help_content:
16
+ logger.error(f"help not found: {help_command}: {tokens}")
17
+ return False, []
18
+
19
+ logger.info(f"+= help: {help_command}")
20
+ print(help_content)
21
+ content_section = [
22
+ "```bash",
23
+ help_content,
24
+ "```",
25
+ ]
26
+
27
+ return True, content_section
@@ -0,0 +1,40 @@
1
+ from typing import List
2
+
3
+ from bluer_objects import file
4
+ from bluer_objects import NAME as MY_NAME
5
+ from bluer_objects.logger import logger
6
+
7
+
8
+ def process_include(
9
+ template_line: str,
10
+ template_path: str,
11
+ ) -> List[str]:
12
+ include_filename_relative = template_line.split(" ")[1].strip()
13
+ include_filename = file.absolute(
14
+ include_filename_relative,
15
+ template_path,
16
+ )
17
+
18
+ success, content_section = file.load_text(include_filename)
19
+ if not success:
20
+ return success
21
+
22
+ content_section = [
23
+ line for line in content_section if not line.startswith("used by:")
24
+ ]
25
+
26
+ include_title = (template_line.split(" ", 2) + ["", "", ""])[2]
27
+ if include_title:
28
+ content_section = [f"## {include_title}"] + content_section[1:]
29
+
30
+ if "include:::noref" not in template_line:
31
+ content_section += [
32
+ "using [{}]({}).".format(
33
+ file.name(include_filename),
34
+ include_filename_relative,
35
+ )
36
+ ]
37
+
38
+ logger.info(f"{MY_NAME}.build: including {include_filename} ...")
39
+
40
+ return content_section
@@ -0,0 +1,21 @@
1
+ from typing import List
2
+
3
+ from bluer_objects.logger import logger
4
+
5
+
6
+ def apply_legacy_on_line(line: str) -> str:
7
+ for before, after in {
8
+ "yaml:::": "metadata:::",
9
+ "--help--": "help:::",
10
+ "--include": "include:::",
11
+ "--table--": "items:::",
12
+ "--signature--": "signature:::",
13
+ }.items():
14
+ line = line.replace(before, after)
15
+ return line
16
+
17
+
18
+ def apply_legacy(template: List[str]) -> List[str]:
19
+ logger.info("applying legacy conversions...")
20
+ template = [apply_legacy_on_line(line) for line in template]
21
+ return template