prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Integrating a key-based mode into a compute-bound script

Open
#746 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

Hello.

I went through the tutorials and the docs but could not see a relevant example about an idea that I have in mind. So I wanted to ask whether it is possible to do this.

I already have a fairly complex python tool that when launched uses some other toolkits for training machine learning models. So my tool is a blocking process that just dumps out periodic progress logs.

Can i integrate a vi-modeish narrow HSplit to be able to send some commands to the running script to change its behaviour on the fly? To simplify imagine this program:

x = 10
while True:
  print('x = {}'.format(x))
  do_some_heavy_computations_that_block()

User presses : then sends 'x+=1', taps enter and the utility receives the command and injects to the namespace, etc.

Any pointers would be appreciated, thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository file, test, or entry point; begin with the documented HSplit component and the input and event-loop guidance referenced by the author. A concrete issue would need to define how commands interact with the blocking process and what observable behavior or tests would confirm that the feature is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.