mrmd-python 0.3.3__tar.gz → 0.3.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mrmd-python
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Python runtime server implementing the MRMD Runtime Protocol (MRP)
5
5
  Author: mrmd contributors
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mrmd-python"
3
- version = "0.3.3"
3
+ version = "0.3.4"
4
4
  description = "Python runtime server implementing the MRMD Runtime Protocol (MRP)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -647,8 +647,8 @@ class IPythonWorker:
647
647
  return ExecuteResult(
648
648
  success=False,
649
649
  error=ExecuteError(
650
- ename="VenvError",
651
- evalue="Could not find Python executable in venv",
650
+ type="VenvError",
651
+ message="Could not find Python executable in venv",
652
652
  traceback=[]
653
653
  )
654
654
  )
@@ -658,11 +658,12 @@ class IPythonWorker:
658
658
 
659
659
  # Create a wrapper script that executes the code and captures output
660
660
  # Uses AST to detect trailing expressions and print their results like IPython
661
+ # Use .strip() to remove any leading/trailing whitespace from the embedded code
661
662
  wrapper_code = '''
662
663
  import sys as _sys
663
664
  import ast as _ast
664
665
 
665
- _code = """ ''' + code.replace('\\', '\\\\').replace('"""', '\\"\\"\\"') + ''' """
666
+ _code = """''' + code.replace('\\', '\\\\').replace('"""', '\\"\\"\\"') + '''""".strip()
666
667
 
667
668
  try:
668
669
  _tree = _ast.parse(_code)
@@ -716,8 +717,8 @@ except Exception as _e:
716
717
  stdout=result.stdout,
717
718
  stderr=result.stderr,
718
719
  error=ExecuteError(
719
- ename="ExecutionError",
720
- evalue=error_lines[-1] if error_lines else "Unknown error",
720
+ type="ExecutionError",
721
+ message=error_lines[-1] if error_lines else "Unknown error",
721
722
  traceback=error_lines
722
723
  ),
723
724
  executionCount=self._execution_count,
@@ -728,8 +729,8 @@ except Exception as _e:
728
729
  return ExecuteResult(
729
730
  success=False,
730
731
  error=ExecuteError(
731
- ename="TimeoutError",
732
- evalue="Execution timed out after 5 minutes",
732
+ type="TimeoutError",
733
+ message="Execution timed out after 5 minutes",
733
734
  traceback=[]
734
735
  ),
735
736
  executionCount=self._execution_count,
@@ -738,8 +739,8 @@ except Exception as _e:
738
739
  return ExecuteResult(
739
740
  success=False,
740
741
  error=ExecuteError(
741
- ename=type(e).__name__,
742
- evalue=str(e),
742
+ type=type(e).__name__,
743
+ message=str(e),
743
744
  traceback=[]
744
745
  ),
745
746
  executionCount=self._execution_count,
@@ -763,8 +764,8 @@ except Exception as _e:
763
764
  return ExecuteResult(
764
765
  success=False,
765
766
  error=ExecuteError(
766
- ename="VenvError",
767
- evalue="Could not find Python executable in venv",
767
+ type="VenvError",
768
+ message="Could not find Python executable in venv",
768
769
  traceback=[]
769
770
  )
770
771
  )
@@ -776,11 +777,12 @@ except Exception as _e:
776
777
 
777
778
  # Wrap code to capture expression results like IPython does
778
779
  # This handles cases like "import sys; sys.executable" which need to print
780
+ # Use .strip() to remove any leading/trailing whitespace from the embedded code
779
781
  wrapper_code = '''
780
782
  import sys as _sys
781
783
  import ast as _ast
782
784
 
783
- _code = """ ''' + code.replace('\\', '\\\\').replace('"""', '\\"\\"\\"') + ''' """
785
+ _code = """''' + code.replace('\\', '\\\\').replace('"""', '\\"\\"\\"') + '''""".strip()
784
786
 
785
787
  # Parse to check if last statement is an expression
786
788
  try:
@@ -855,8 +857,8 @@ except SyntaxError as _e:
855
857
  stdout=accumulated_stdout,
856
858
  stderr=accumulated_stderr,
857
859
  error=ExecuteError(
858
- ename="ExecutionError",
859
- evalue=error_lines[-1] if error_lines else "Unknown error",
860
+ type="ExecutionError",
861
+ message=error_lines[-1] if error_lines else "Unknown error",
860
862
  traceback=error_lines
861
863
  ),
862
864
  executionCount=self._execution_count,
@@ -875,8 +877,8 @@ except SyntaxError as _e:
875
877
  return ExecuteResult(
876
878
  success=False,
877
879
  error=ExecuteError(
878
- ename=type(e).__name__,
879
- evalue=str(e),
880
+ type=type(e).__name__,
881
+ message=str(e),
880
882
  traceback=[]
881
883
  ),
882
884
  executionCount=self._execution_count,
File without changes
File without changes
File without changes