entangled-cli 2.3.0__tar.gz → 2.3.1__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 (49) hide show
  1. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/PKG-INFO +1 -1
  2. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/reset.py +1 -1
  3. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/stitch.py +6 -7
  4. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/tangle.py +1 -1
  5. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/io/stat.py +1 -1
  6. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/io/transaction.py +3 -0
  7. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/io/virtual.py +2 -2
  8. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/markdown_reader.py +5 -4
  9. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/pyproject.toml +1 -1
  10. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/.gitignore +0 -0
  11. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/LICENSE +0 -0
  12. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/README.md +0 -0
  13. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/__init__.py +0 -0
  14. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/code_reader.py +0 -0
  15. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/__init__.py +0 -0
  16. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/brei.py +0 -0
  17. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/new.py +0 -0
  18. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/status.py +0 -0
  19. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/sync.py +0 -0
  20. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/commands/watch.py +0 -0
  21. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/config/__init__.py +0 -0
  22. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/config/language.py +0 -0
  23. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/config/templates.py +0 -0
  24. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/config/version.py +0 -0
  25. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/document.py +0 -0
  26. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/errors/__init__.py +0 -0
  27. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/errors/internal.py +0 -0
  28. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/errors/user.py +0 -0
  29. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/from_str.py +0 -0
  30. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/__init__.py +0 -0
  31. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/base.py +0 -0
  32. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/build.py +0 -0
  33. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/quarto_attributes.py +0 -0
  34. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/repl.py +0 -0
  35. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/shebang.py +0 -0
  36. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/spdx_license.py +0 -0
  37. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/hooks/task.py +0 -0
  38. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/io/__init__.py +0 -0
  39. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/io/filedb.py +0 -0
  40. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/logging.py +0 -0
  41. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/main.py +0 -0
  42. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/parsing.py +0 -0
  43. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/properties.py +0 -0
  44. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/py.typed +0 -0
  45. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/status.py +0 -0
  46. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/tangle.py +0 -0
  47. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/text_location.py +0 -0
  48. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/utility.py +0 -0
  49. {entangled_cli-2.3.0 → entangled_cli-2.3.1}/entangled/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: entangled-cli
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Literate Programming toolbox
5
5
  Project-URL: Homepage, https://entangled.github.io/
6
6
  Project-URL: Repository, https://github.com/entangled/entangled.py
@@ -40,7 +40,7 @@ def reset():
40
40
  for path in input_file_list:
41
41
  logging.debug("reading `%s`", path)
42
42
  t.update(path)
43
- _, _ = read_markdown_file(path, refs=refs, hooks=hooks)
43
+ _, _ = read_markdown_file(t, path, refs=refs, hooks=hooks)
44
44
 
45
45
  for h in hooks:
46
46
  h.pre_tangle(refs)
@@ -46,17 +46,16 @@ def stitch(*, force: bool = False, show: bool = False):
46
46
  refs = ReferenceMap()
47
47
  content: dict[Path, list[Content]] = {}
48
48
  try:
49
- for path in input_file_list:
50
- logging.debug("reading `%s`", path)
51
- _, c = read_markdown_file(path, refs=refs, hooks=hooks)
52
- content[path] = c
53
-
54
49
  with transaction(mode) as t:
50
+ for path in input_file_list:
51
+ logging.debug("reading `%s`", path)
52
+ _, c = read_markdown_file(t, path, refs=refs, hooks=hooks)
53
+ content[path] = c
54
+
55
55
  for path in t.db.managed_files:
56
56
  logging.debug("reading `%s`", path)
57
57
  t.update(path)
58
- with open(path, "r") as f:
59
- CodeReader(path, refs).run(f.read())
58
+ _ = CodeReader(path, refs).run(t.read(path))
60
59
 
61
60
  for path in input_file_list:
62
61
  t.write(path, stitch_markdown(refs, content[path]), [])
@@ -52,7 +52,7 @@ def tangle(*, annotate: str | None = None, force: bool = False, show: bool = Fal
52
52
  for path in input_file_list:
53
53
  logging.debug("reading `%s`", path)
54
54
  t.update(path)
55
- _, _ = read_markdown_file(path, refs=refs, hooks=hooks)
55
+ _, _ = read_markdown_file(t, path, refs=refs, hooks=hooks)
56
56
 
57
57
  for h in hooks:
58
58
  h.pre_tangle(refs)
@@ -55,7 +55,7 @@ class FileData:
55
55
  if stat is None:
56
56
  return None
57
57
 
58
- with open(path, "r") as f:
58
+ with open(path, "r", encoding="utf-8") as f:
59
59
  content = f.read()
60
60
  digest = hexdigest(content)
61
61
 
@@ -158,6 +158,9 @@ class Transaction:
158
158
  else:
159
159
  logging.debug("target `%s` unchanged", path)
160
160
 
161
+ def read(self, path: Path) -> str:
162
+ return self.fs[path].content
163
+
161
164
  def clear_orphans(self):
162
165
  orphans = self.db.managed_files - self.passed
163
166
  if not orphans:
@@ -25,7 +25,7 @@ def atomic_write(target: Path, content: str, mode: int | None):
25
25
  """
26
26
  tmp_dir = Path() / ".entangled" / "tmp"
27
27
  tmp_dir.mkdir(exist_ok=True, parents=True)
28
- with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=tmp_dir) as f:
28
+ with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=tmp_dir, encoding="utf-8") as f:
29
29
  _ = f.write(assure_final_newline(content))
30
30
  # Flush and sync contents to disk
31
31
  f.flush()
@@ -53,7 +53,7 @@ class FileCache:
53
53
  """
54
54
  if key not in self._data:
55
55
  if (s := stat(key)) is None:
56
- raise KeyError()
56
+ raise FileNotFoundError(key)
57
57
  self._data[key] = s
58
58
  return self._data[key]
59
59
 
@@ -8,6 +8,8 @@ import mawk
8
8
  import logging
9
9
 
10
10
  from entangled.config.language import Language
11
+ from entangled.io.transaction import Transaction
12
+ from entangled.io.virtual import FileCache
11
13
 
12
14
  from .config import config
13
15
  from .utility import first
@@ -146,8 +148,8 @@ class MarkdownLexer(mawk.RuleSet):
146
148
  self.flush_plain_text()
147
149
  return []
148
150
 
149
-
150
151
  def read_markdown_file(
152
+ t: Transaction,
151
153
  path: Path,
152
154
  refs: ReferenceMap | None = None,
153
155
  hooks: list[HookBase] | None = None) \
@@ -167,9 +169,8 @@ def read_markdown_file(
167
169
  content is a list of `PlainText | ReferenceId`. Each `ReferenceId` can be
168
170
  looked up in the reference map.
169
171
  """
170
- with open(path, "r") as f:
171
- rel_path = path.resolve().relative_to(Path.cwd())
172
- return read_markdown_string(f.read(), rel_path, refs, hooks)
172
+ rel_path = path.resolve().relative_to(Path.cwd())
173
+ return read_markdown_string(t.read(rel_path), rel_path, refs, hooks)
173
174
 
174
175
 
175
176
  def read_markdown_string(
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "entangled-cli"
3
- version = "2.3.0"
3
+ version = "2.3.1"
4
4
  description = "Literate Programming toolbox"
5
5
  authors = [{ name = "Johan Hidding", email = "j.hidding@esciencecenter.nl" }]
6
6
  requires-python = ">=3.12,<4"
File without changes
File without changes
File without changes