lean-interact 0.3.1__tar.gz → 0.3.2__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: lean-interact
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: LeanInteract is a Python package that allows you to interact with the Lean theorem prover.
5
5
  Author-email: Auguste Poiroux <auguste.poiroux@epfl.ch>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lean-interact"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "LeanInteract is a Python package that allows you to interact with the Lean theorem prover."
5
5
  keywords = ["Lean", "theorem proving", "autoformalization", "REPL"]
6
6
  license = { file = "LICENSE" }
@@ -64,6 +64,7 @@ class LeanServer:
64
64
  echo=False,
65
65
  preexec_fn=lambda: _limit_memory(self.config.memory_hard_limit_mb),
66
66
  )
67
+ self._proc.delaybeforesend = None
67
68
  # `stty -icanon` is required to handle arbitrary long inputs in the Lean REPL
68
69
  self._proc.sendline("stty -icanon")
69
70
  self._proc.sendline(f"lake env {self.config._cache_repl_dir}/.lake/build/bin/repl || exit")
@@ -411,6 +411,18 @@ class TestLeanServer(unittest.TestCase):
411
411
  step2 = server.run(ProofStep(tactic="rfl", proof_state=step1.proof_state))
412
412
  self.assertEqual(step2, ProofStepResponse(proof_state=2, goals=[]))
413
413
 
414
+ def test_run_lots_of_commands(self):
415
+ server = LeanServer(LeanREPLConfig(verbose=True))
416
+
417
+ init_env = server.run(Command(cmd="#eval 1"))
418
+ assert isinstance(init_env, CommandResponse)
419
+ for i in range(1000):
420
+ cmd = Command(
421
+ cmd=f"theorem womp{i} (a{i} b c : Nat) : (a{i} + b) + c = c + a{i} + b := by sorry", env=init_env.env
422
+ )
423
+ result = server.run(cmd)
424
+ self.assertIsInstance(result, CommandResponse)
425
+
414
426
  def test_bug_increasing_memory(self):
415
427
  mem_limit = 512
416
428
  server = AutoLeanServer(config=LeanREPLConfig(memory_hard_limit_mb=mem_limit, verbose=True))
@@ -435,6 +447,8 @@ class TestLeanServer(unittest.TestCase):
435
447
  result_queue.put(("success", result))
436
448
  except TimeoutError as e:
437
449
  result_queue.put(("timeout", e))
450
+ except ConnectionAbortedError as e:
451
+ result_queue.put(("connection_aborted", e)) # out of memory
438
452
  except Exception as e:
439
453
  result_queue.put(("error", e))
440
454
 
@@ -351,7 +351,7 @@ wheels = [
351
351
 
352
352
  [[package]]
353
353
  name = "lean-interact"
354
- version = "0.3.0"
354
+ version = "0.3.2"
355
355
  source = { editable = "." }
356
356
  dependencies = [
357
357
  { name = "gitpython" },
File without changes
File without changes
File without changes