pdit 0.3.2__tar.gz → 0.4.0__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.3.2/pdit.egg-info → pdit-0.4.0}/PKG-INFO +1 -1
  2. {pdit-0.3.2 → pdit-0.4.0}/pdit/ipython_executor.py +3 -0
  3. {pdit-0.3.2 → pdit-0.4.0/pdit.egg-info}/PKG-INFO +1 -1
  4. {pdit-0.3.2 → pdit-0.4.0}/pyproject.toml +1 -1
  5. {pdit-0.3.2 → pdit-0.4.0}/tests/test_ipython_executor.py +20 -0
  6. {pdit-0.3.2 → pdit-0.4.0}/LICENSE +0 -0
  7. {pdit-0.3.2 → pdit-0.4.0}/MANIFEST.in +0 -0
  8. {pdit-0.3.2 → pdit-0.4.0}/README.md +0 -0
  9. {pdit-0.3.2 → pdit-0.4.0}/pdit/__init__.py +0 -0
  10. {pdit-0.3.2 → pdit-0.4.0}/pdit/_demo.py +0 -0
  11. {pdit-0.3.2 → pdit-0.4.0}/pdit/_static/assets/index-1w8kifoA.js +0 -0
  12. {pdit-0.3.2 → pdit-0.4.0}/pdit/_static/assets/index-rS96z8hq.css +0 -0
  13. {pdit-0.3.2 → pdit-0.4.0}/pdit/_static/export.html +0 -0
  14. {pdit-0.3.2 → pdit-0.4.0}/pdit/_static/index.html +0 -0
  15. {pdit-0.3.2 → pdit-0.4.0}/pdit/cli.py +0 -0
  16. {pdit-0.3.2 → pdit-0.4.0}/pdit/exporter.py +0 -0
  17. {pdit-0.3.2 → pdit-0.4.0}/pdit/file_watcher.py +0 -0
  18. {pdit-0.3.2 → pdit-0.4.0}/pdit/server.py +0 -0
  19. {pdit-0.3.2 → pdit-0.4.0}/pdit.egg-info/SOURCES.txt +0 -0
  20. {pdit-0.3.2 → pdit-0.4.0}/pdit.egg-info/dependency_links.txt +0 -0
  21. {pdit-0.3.2 → pdit-0.4.0}/pdit.egg-info/entry_points.txt +0 -0
  22. {pdit-0.3.2 → pdit-0.4.0}/pdit.egg-info/requires.txt +0 -0
  23. {pdit-0.3.2 → pdit-0.4.0}/pdit.egg-info/top_level.txt +0 -0
  24. {pdit-0.3.2 → pdit-0.4.0}/setup.cfg +0 -0
  25. {pdit-0.3.2 → pdit-0.4.0}/tests/test_file_watcher.py +0 -0
  26. {pdit-0.3.2 → pdit-0.4.0}/tests/test_local_import.py +0 -0
  27. {pdit-0.3.2 → pdit-0.4.0}/tests/test_server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pdit
3
- Version: 0.3.2
3
+ Version: 0.4.0
4
4
  Summary: Interactive Python code editor with inline execution results
5
5
  Author: Harry Vangberg
6
6
  License: MIT
@@ -167,6 +167,9 @@ del _register_pdit_runtime_hooks
167
167
 
168
168
  for node in tree.body:
169
169
  line_start = node.lineno
170
+ if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
171
+ if node.decorator_list:
172
+ line_start = min(dec.lineno for dec in node.decorator_list)
170
173
  line_end = node.end_lineno or node.lineno
171
174
 
172
175
  # Extract source
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pdit
3
- Version: 0.3.2
3
+ Version: 0.4.0
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.3.2"
7
+ version = "0.4.0"
8
8
  description = "Interactive Python code editor with inline execution results"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9,<3.14"
@@ -448,6 +448,26 @@ result"""
448
448
  assert results[2]["isInvisible"] is True # assignment
449
449
  assert "7" in results[3]["output"][0]["content"]
450
450
 
451
+ async def test_function_decorator_applied(self, executor):
452
+ """Test that function decorators are applied."""
453
+ script = """from functools import wraps
454
+
455
+ def add_one(fn):
456
+ @wraps(fn)
457
+ def wrapper(*args, **kwargs):
458
+ return fn(*args, **kwargs) + 1
459
+ return wrapper
460
+
461
+ @add_one
462
+ def add(a, b):
463
+ return a + b
464
+
465
+ add(2, 3)"""
466
+ results = await collect_results(executor.execute_script(script))
467
+
468
+ final_result = results[-1]
469
+ assert "6" in final_result["output"][0]["content"]
470
+
451
471
  async def test_list_comprehension(self, executor):
452
472
  """Test list comprehension execution."""
453
473
  script = "[x**2 for x in range(5)]"
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