pdit 0.7.0__tar.gz → 0.7.0a1__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. {pdit-0.7.0/pdit.egg-info → pdit-0.7.0a1}/PKG-INFO +1 -1
  2. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/exporter.py +4 -39
  3. {pdit-0.7.0 → pdit-0.7.0a1/pdit.egg-info}/PKG-INFO +1 -1
  4. {pdit-0.7.0 → pdit-0.7.0a1}/pyproject.toml +1 -1
  5. {pdit-0.7.0 → pdit-0.7.0a1}/LICENSE +0 -0
  6. {pdit-0.7.0 → pdit-0.7.0a1}/MANIFEST.in +0 -0
  7. {pdit-0.7.0 → pdit-0.7.0a1}/README.md +0 -0
  8. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/__init__.py +0 -0
  9. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/_demo.py +0 -0
  10. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/_static/assets/index-WLaVrqLo.js +0 -0
  11. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/_static/assets/index-rS96z8hq.css +0 -0
  12. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/_static/export.html +0 -0
  13. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/_static/index.html +0 -0
  14. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/cli.py +0 -0
  15. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/file_watcher.py +0 -0
  16. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/ipython_executor.py +0 -0
  17. {pdit-0.7.0 → pdit-0.7.0a1}/pdit/server.py +0 -0
  18. {pdit-0.7.0 → pdit-0.7.0a1}/pdit.egg-info/SOURCES.txt +0 -0
  19. {pdit-0.7.0 → pdit-0.7.0a1}/pdit.egg-info/dependency_links.txt +0 -0
  20. {pdit-0.7.0 → pdit-0.7.0a1}/pdit.egg-info/entry_points.txt +0 -0
  21. {pdit-0.7.0 → pdit-0.7.0a1}/pdit.egg-info/requires.txt +0 -0
  22. {pdit-0.7.0 → pdit-0.7.0a1}/pdit.egg-info/top_level.txt +0 -0
  23. {pdit-0.7.0 → pdit-0.7.0a1}/setup.cfg +0 -0
  24. {pdit-0.7.0 → pdit-0.7.0a1}/tests/test_file_watcher.py +0 -0
  25. {pdit-0.7.0 → pdit-0.7.0a1}/tests/test_ipython_executor.py +0 -0
  26. {pdit-0.7.0 → pdit-0.7.0a1}/tests/test_local_import.py +0 -0
  27. {pdit-0.7.0 → pdit-0.7.0a1}/tests/test_server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pdit
3
- Version: 0.7.0
3
+ Version: 0.7.0a1
4
4
  Summary: Interactive Python code editor with inline execution results
5
5
  Author: Harry Vangberg
6
6
  License: MIT
@@ -1,15 +1,13 @@
1
1
  """Export functionality for pdit scripts."""
2
2
 
3
- import asyncio
4
3
  import json
5
4
  from pathlib import Path
6
- from threading import Thread
7
- from typing import Any, Callable, Coroutine
5
+ from typing import Any
8
6
 
9
7
  from .ipython_executor import IPythonExecutor
10
8
 
11
9
 
12
- async def _execute_script_async(script_content: str, script_name: str) -> list[dict[str, Any]]:
10
+ def execute_script(script_content: str, script_name: str) -> list[dict[str, Any]]:
13
11
  """Execute a script and return expressions in frontend format.
14
12
 
15
13
  Args:
@@ -24,7 +22,7 @@ async def _execute_script_async(script_content: str, script_name: str) -> list[d
24
22
  expression_id = 0
25
23
 
26
24
  try:
27
- async for event in executor.execute_script(script_content, script_name=script_name):
25
+ for event in executor.execute_script(script_content, script_name=script_name):
28
26
  # Skip the expressions list event
29
27
  if event.get("type") == "expressions":
30
28
  continue
@@ -42,44 +40,11 @@ async def _execute_script_async(script_content: str, script_name: str) -> list[d
42
40
  })
43
41
  expression_id += 1
44
42
  finally:
45
- await executor.shutdown()
43
+ executor.shutdown()
46
44
 
47
45
  return expressions
48
46
 
49
47
 
50
- def _run_async(
51
- async_fn: Callable[..., Coroutine[Any, Any, Any]],
52
- *args: Any,
53
- **kwargs: Any,
54
- ) -> Any:
55
- try:
56
- asyncio.get_running_loop()
57
- except RuntimeError:
58
- return asyncio.run(async_fn(*args, **kwargs))
59
-
60
- result: dict[str, Any] = {}
61
- error: dict[str, BaseException] = {}
62
-
63
- def runner() -> None:
64
- try:
65
- result["value"] = asyncio.run(async_fn(*args, **kwargs))
66
- except BaseException as exc:
67
- error["value"] = exc
68
-
69
- thread = Thread(target=runner, daemon=True)
70
- thread.start()
71
- thread.join()
72
-
73
- if "value" in error:
74
- raise error["value"]
75
- return result["value"]
76
-
77
-
78
- def execute_script(script_content: str, script_name: str) -> list[dict[str, Any]]:
79
- """Execute a script and return expressions in frontend format."""
80
- return _run_async(_execute_script_async, script_content, script_name)
81
-
82
-
83
48
  def generate_html(script_content: str, expressions: list[dict[str, Any]]) -> str:
84
49
  """Generate self-contained HTML from script and execution results.
85
50
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pdit
3
- Version: 0.7.0
3
+ Version: 0.7.0a1
4
4
  Summary: Interactive Python code editor with inline execution results
5
5
  Author: Harry Vangberg
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pdit"
7
- version = "0.7.0"
7
+ version = "0.7.0a1"
8
8
  description = "Interactive Python code editor with inline execution results"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9,<3.14"
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