entangled-cli 2.0.1__tar.gz → 2.0.3__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.
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/PKG-INFO +6 -2
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/README.md +3 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/new.py +1 -1
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/status.py +3 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/config/language.py +2 -1
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/construct.py +35 -10
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/hooks/__init__.py +2 -2
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/status.py +2 -2
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/pyproject.toml +4 -2
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/LICENSE +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/__init__.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/code_reader.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/__init__.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/brei.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/stitch.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/sync.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/tangle.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/commands/watch.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/config/__init__.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/config/templates.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/config/version.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/document.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/errors/__init__.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/errors/internal.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/errors/user.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/filedb.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/hooks/base.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/hooks/build.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/hooks/quarto_attributes.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/hooks/task.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/logging.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/main.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/markdown_reader.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/parsing.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/properties.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/py.typed +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/tangle.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/text_location.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/transaction.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/utility.py +0 -0
- {entangled_cli-2.0.1 → entangled_cli-2.0.3}/entangled/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: entangled-cli
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: Literate Programming toolbox
|
|
5
5
|
Home-page: https://entangled.github.io/
|
|
6
6
|
License: Apache 2
|
|
@@ -13,9 +13,10 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Requires-Dist: argh (>=0.30,<0.31)
|
|
15
15
|
Requires-Dist: brei (>=0.2.3,<0.3.0)
|
|
16
|
-
Requires-Dist: copier (>=
|
|
16
|
+
Requires-Dist: copier (>=9,<10)
|
|
17
17
|
Requires-Dist: filelock (>=3.12.0,<4.0.0)
|
|
18
18
|
Requires-Dist: mawk (>=0.1.4,<0.2.0)
|
|
19
|
+
Requires-Dist: pexpect (>=4.9.0,<5.0.0)
|
|
19
20
|
Requires-Dist: rich (>=13.3.5,<14.0.0)
|
|
20
21
|
Requires-Dist: rich-argparse (>=1.4.0,<2.0.0)
|
|
21
22
|
Requires-Dist: tomlkit (>=0.12.1,<0.13.0)
|
|
@@ -122,6 +123,9 @@ version = "2.0"
|
|
|
122
123
|
|
|
123
124
|
# default watch_list is ["**/*.md"]
|
|
124
125
|
watch_list = ["docs/**/*.md"]
|
|
126
|
+
|
|
127
|
+
# default ignore_list is ["**/README.md"]
|
|
128
|
+
ignore_list = ["docs/**/examples.md"]
|
|
125
129
|
```
|
|
126
130
|
|
|
127
131
|
You may add languages as follows:
|
|
@@ -123,7 +123,7 @@ def new(
|
|
|
123
123
|
"Please supply both a [template] and a [project_path].\n", print_help
|
|
124
124
|
)
|
|
125
125
|
|
|
126
|
-
copy_this_template:
|
|
126
|
+
copy_this_template: str = template
|
|
127
127
|
trust_this_template: bool = trust
|
|
128
128
|
|
|
129
129
|
# Use an officially supported template, if available, and trust it
|
|
@@ -31,6 +31,9 @@ def rich_status():
|
|
|
31
31
|
config_table.add_row(
|
|
32
32
|
"Watch list", ", ".join(f"'{pat}'" for pat in config.watch_list)
|
|
33
33
|
)
|
|
34
|
+
config_table.add_row(
|
|
35
|
+
"Ignore list", ", ".join(f"'{pat}'" for pat in config.ignore_list)
|
|
36
|
+
)
|
|
34
37
|
config_table.add_row("Hooks enabled", ", ".join(config.hooks))
|
|
35
38
|
|
|
36
39
|
console = Console(color_system="auto")
|
|
@@ -46,5 +46,6 @@ languages = [
|
|
|
46
46
|
Language("F#", ["fsharp"], Comment("//")),
|
|
47
47
|
Language("Javascript", ["javascript", "js", "ecma"], Comment("//")),
|
|
48
48
|
Language("Go", ["go", "golang"], Comment("//")),
|
|
49
|
-
Language("R", ["r", "rlang"], Comment("#"))
|
|
49
|
+
Language("R", ["r", "rlang"], Comment("#")),
|
|
50
|
+
Language("Nix", ["nix"], Comment("#"))
|
|
50
51
|
]
|
|
@@ -27,7 +27,7 @@ class FromStr:
|
|
|
27
27
|
def construct(annot: Any, json: Any) -> Any:
|
|
28
28
|
try:
|
|
29
29
|
return _construct(annot, json)
|
|
30
|
-
except (AssertionError, ValueError, KeyError) as e:
|
|
30
|
+
except (AssertionError, ValueError, KeyError, TypeError) as e:
|
|
31
31
|
raise ConfigError(annot, json) from e
|
|
32
32
|
|
|
33
33
|
|
|
@@ -47,6 +47,10 @@ def is_optional_type(dtype: Type[Any]) -> TypeGuard[Type[Optional[Any]]]:
|
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
def normalize_enum(x: str):
|
|
51
|
+
return x.upper().replace("-", "_")
|
|
52
|
+
|
|
53
|
+
|
|
50
54
|
def _construct(annot: Type[T], json: Any) -> T:
|
|
51
55
|
"""Construct an object from a given type from a JSON stream.
|
|
52
56
|
|
|
@@ -70,14 +74,35 @@ def _construct(annot: Type[T], json: Any) -> T:
|
|
|
70
74
|
)
|
|
71
75
|
if annot is Any:
|
|
72
76
|
return cast(T, json)
|
|
73
|
-
|
|
74
|
-
#
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return cast(T,
|
|
77
|
+
|
|
78
|
+
# dicts
|
|
79
|
+
if isgeneric(annot) and typing.get_origin(annot) is dict:
|
|
80
|
+
assert isinstance(json, dict)
|
|
81
|
+
return cast(T, {construct(typing.get_args(annot)[0], k): construct(typing.get_args(annot)[1], v)
|
|
82
|
+
for k, v in json.items()})
|
|
83
|
+
if annot is dict:
|
|
84
|
+
assert isinstance(json, dict)
|
|
85
|
+
return cast(T, json)
|
|
86
|
+
|
|
87
|
+
# lists
|
|
78
88
|
if isgeneric(annot) and typing.get_origin(annot) is list:
|
|
79
89
|
assert isinstance(json, list)
|
|
80
90
|
return cast(T, [construct(typing.get_args(annot)[0], item) for item in json])
|
|
91
|
+
if annot is list:
|
|
92
|
+
assert isinstance(json, list)
|
|
93
|
+
return cast(T, json)
|
|
94
|
+
|
|
95
|
+
# sets
|
|
96
|
+
if isgeneric(annot) and typing.get_origin(annot) is set:
|
|
97
|
+
assert isinstance(json, list)
|
|
98
|
+
return cast(T, {construct(typing.get_args(annot)[0], item) for item in json})
|
|
99
|
+
if annot is set:
|
|
100
|
+
assert isinstance(json, list)
|
|
101
|
+
return cast(T, set(json))
|
|
102
|
+
|
|
103
|
+
if annot is Path and isinstance(json, str):
|
|
104
|
+
return cast(T, Path(json))
|
|
105
|
+
|
|
81
106
|
if is_optional_type(annot):
|
|
82
107
|
if json is None:
|
|
83
108
|
return cast(T, None)
|
|
@@ -97,13 +122,13 @@ def _construct(annot: Type[T], json: Any) -> T:
|
|
|
97
122
|
if is_dataclass(annot):
|
|
98
123
|
assert isinstance(json, dict)
|
|
99
124
|
arg_annot = typing.get_type_hints(annot)
|
|
100
|
-
# assert all(k in json for k in arg_annot)
|
|
101
125
|
args = {k: construct(arg_annot[k], json[k]) for k in json}
|
|
102
126
|
return cast(T, annot(**args))
|
|
103
127
|
if isinstance(json, str) and isinstance(annot, type) and issubclass(annot, Enum):
|
|
104
|
-
options = {
|
|
105
|
-
assert json
|
|
106
|
-
|
|
128
|
+
options = {normalize_enum(e.name): e for e in annot}
|
|
129
|
+
assert isinstance(json, str)
|
|
130
|
+
assert normalize_enum(json) in options
|
|
131
|
+
return cast(T, options[normalize_enum(json)])
|
|
107
132
|
raise ValueError(f"Couldn't construct {annot} from {repr(json)}")
|
|
108
133
|
|
|
109
134
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from
|
|
2
|
+
from importlib.metadata import entry_points
|
|
3
3
|
|
|
4
4
|
from .base import HookBase, PrerequisitesFailed
|
|
5
5
|
from . import build, task, quarto_attributes
|
|
@@ -12,7 +12,7 @@ discovered_hooks = entry_points(group="entangled.hooks")
|
|
|
12
12
|
|
|
13
13
|
external_hooks = {
|
|
14
14
|
name: discovered_hooks[name].load().Hook
|
|
15
|
-
for name in discovered_hooks
|
|
15
|
+
for name in discovered_hooks.names
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
hooks: dict[str, type[HookBase]] = {
|
|
@@ -16,9 +16,9 @@ def find_watch_dirs():
|
|
|
16
16
|
|
|
17
17
|
def list_input_files():
|
|
18
18
|
"""List all input files."""
|
|
19
|
-
include_file_list = chain.from_iterable(map(Path(
|
|
19
|
+
include_file_list = chain.from_iterable(map(Path().glob, config.watch_list))
|
|
20
20
|
exclude_file_list = list(
|
|
21
|
-
chain.from_iterable(map(Path(
|
|
21
|
+
chain.from_iterable(map(Path().glob, config.ignore_list))
|
|
22
22
|
)
|
|
23
23
|
return [path for path in include_file_list if not path in exclude_file_list]
|
|
24
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "entangled-cli"
|
|
3
|
-
version = "2.0.
|
|
3
|
+
version = "2.0.3"
|
|
4
4
|
description = "Literate Programming toolbox"
|
|
5
5
|
repository = "https://github.com/entangled/entangled.py"
|
|
6
6
|
homepage = "https://entangled.github.io/"
|
|
@@ -17,9 +17,10 @@ filelock = "^3.12.0" # file lock for json db
|
|
|
17
17
|
argh = "^0.30" # easy argument parsing
|
|
18
18
|
rich = "^13.3.5" # colourful output
|
|
19
19
|
tomlkit = "^0.12.1" # read/write toml files
|
|
20
|
-
copier = "^
|
|
20
|
+
copier = "^9" # project templates
|
|
21
21
|
brei = "^0.2.3" # build system
|
|
22
22
|
rich-argparse = "^1.4.0" # colourful help messages
|
|
23
|
+
pexpect = "^4.9.0"
|
|
23
24
|
|
|
24
25
|
[tool.poetry.group.dev.dependencies]
|
|
25
26
|
pytest = "^7.3.1"
|
|
@@ -31,6 +32,7 @@ mkdocs-material = "^9.1.13"
|
|
|
31
32
|
mkdocstrings = { extras = ["python"], version = "^0.21.2" }
|
|
32
33
|
twine = "^4.0.2"
|
|
33
34
|
pytest-asyncio = "^0.21.1"
|
|
35
|
+
ruff = "^0.4.4"
|
|
34
36
|
|
|
35
37
|
[build-system]
|
|
36
38
|
requires = ["poetry-core"]
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|