pygent 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

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.
pygent/runtime.py CHANGED
@@ -48,28 +48,35 @@ class Runtime:
48
48
 
49
49
  # ---------------- public API ----------------
50
50
  def bash(self, cmd: str, timeout: int = 30) -> str:
51
- """Run a command in the container or locally and return the output."""
51
+ """Run a command in the container or locally and return the output.
52
+
53
+ The executed command is always included in the returned string so the
54
+ caller can display what was run.
55
+ """
52
56
  if self._use_docker and self.container is not None:
53
57
  res = self.container.exec_run(
54
58
  cmd,
55
59
  workdir="/workspace",
56
60
  demux=True,
57
61
  tty=False,
62
+ stdin=False,
58
63
  timeout=timeout,
59
64
  )
60
65
  stdout, stderr = (
61
66
  res.output if isinstance(res.output, tuple) else (res.output, b"")
62
67
  )
63
- return (stdout or b"").decode() + (stderr or b"").decode()
68
+ output = (stdout or b"").decode() + (stderr or b"").decode()
69
+ return f"$ {cmd}\n{output}"
64
70
  proc = subprocess.run(
65
71
  cmd,
66
72
  shell=True,
67
73
  cwd=self.base_dir,
68
74
  capture_output=True,
69
75
  text=True,
76
+ stdin=subprocess.DEVNULL,
70
77
  timeout=timeout,
71
78
  )
72
- return proc.stdout + proc.stderr
79
+ return f"$ {cmd}\n{proc.stdout + proc.stderr}"
73
80
 
74
81
  def write_file(self, path: Union[str, Path], content: str) -> str:
75
82
  p = self.base_dir / path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygent
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Pygent is a minimalist coding assistant that runs commands in a Docker container when available and falls back to local execution. See https://marianochaves.github.io/pygent for documentation and https://github.com/marianochaves/pygent for the source code.
5
5
  Author-email: Mariano Chaves <mchaves.software@gmail.com>
6
6
  Project-URL: Documentation, https://marianochaves.github.io/pygent
@@ -5,12 +5,12 @@ pygent/cli.py,sha256=Hz2FZeNMVhxoT5DjCqphXla3TisGJtPEz921LEcpxrA,527
5
5
  pygent/models.py,sha256=_3Y1Z5wL6FUqzC-EOjZe3Vkcq4SzbPdGz6TbshcEB98,992
6
6
  pygent/openai_compat.py,sha256=mS6ntl70jpVH3JzfNYEDhg-z7QIQcMqQTuEV5ja7VOo,2173
7
7
  pygent/py.typed,sha256=0Wh72UpGSn4lSGW-u3xMV9kxcBHMdwE15IGUqiJTwqo,52
8
- pygent/runtime.py,sha256=MxuYTIzVqXOLGuM-2J8TtJRjud1Z-LYHt5dtCVpW27E,3165
8
+ pygent/runtime.py,sha256=6VEV4DwpdfrhpGpUiBJr_O1vlo407o0Mvd8Mdhq964A,3417
9
9
  pygent/tools.py,sha256=8-jvqYeiJOlZ2ku1MTnBnK2O1m90hkrboq9aZrMORr0,1732
10
10
  pygent/ui.py,sha256=xqPAvweghPOBBvoD72HzhN6zlXew_3inb8AN7Ck2zpQ,1328
11
- pygent-0.1.7.dist-info/licenses/LICENSE,sha256=rIktBU2VR4kHzsWul64cbom2zHIgGqYmABoZwSur6T8,1071
12
- pygent-0.1.7.dist-info/METADATA,sha256=E-A18f6OmzOQiRBF2tb0a0SZgj2q2Y4EY9UA4BRr3FI,877
13
- pygent-0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- pygent-0.1.7.dist-info/entry_points.txt,sha256=b9j216E5UpuMrQWRZrwyEmacNEAYvw1tCKkZqdIVIOc,70
15
- pygent-0.1.7.dist-info/top_level.txt,sha256=P26IYsb-ThK5IkGP_bRuGJQ0Q_Y8JCcbYqVpvULdxDw,7
16
- pygent-0.1.7.dist-info/RECORD,,
11
+ pygent-0.1.9.dist-info/licenses/LICENSE,sha256=rIktBU2VR4kHzsWul64cbom2zHIgGqYmABoZwSur6T8,1071
12
+ pygent-0.1.9.dist-info/METADATA,sha256=YzPl-3O1RvCKbCeZQTcJUNt2m3sw2G6THKEXpbPtM8o,877
13
+ pygent-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ pygent-0.1.9.dist-info/entry_points.txt,sha256=b9j216E5UpuMrQWRZrwyEmacNEAYvw1tCKkZqdIVIOc,70
15
+ pygent-0.1.9.dist-info/top_level.txt,sha256=P26IYsb-ThK5IkGP_bRuGJQ0Q_Y8JCcbYqVpvULdxDw,7
16
+ pygent-0.1.9.dist-info/RECORD,,
File without changes