Open
Conversation
66672dd to
889f5cf
Compare
f20aa1d to
29250a3
Compare
6240986 to
2b3df8a
Compare
60c2dc3 to
49a74c7
Compare
49a74c7 to
287367b
Compare
287367b to
0a631d2
Compare
0a631d2 to
921637d
Compare
1eaf2dd to
b68b72f
Compare
b68b72f to
284fdcc
Compare
284fdcc to
b34194a
Compare
b34194a to
5fed943
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==1.0.14->==3.0.29Release Notes
prompt-toolkit/python-prompt-toolkit
v3.0.29Compare Source
New features:
Fixes
handle_sigintfromApplication.runtoApplication.run_async.print_containerutility (handleEOFError).Breaking changes:
create_pipe_input,PosixPipeInputandWin32PipeInput.v3.0.28Compare Source
New features:
Fixes:
v3.0.27Compare Source
New features:
be configured, either as a fixed cursor shape, or in case of Vi input mode,
according to the current input mode.
possible to render many kinds of generated ANSI art.
alignattribute inLabelwidget.PlainTextOutput: an output implementation that doesn't render anyANSI escape sequences. This will be used by default when redirecting stdout
to a file.
create_app_session_from_tty: a context manager that enforcesinput/output to go to the current TTY, even if stdin/stdout are attached to
pipes.
to_plain_textutility for converting formatted text into plain text.Fixes:
sys.stderrfor output whensys.stdoutis not aTTY, but
sys.stderris. The previous behavior was confusing, especiallywhen rendering formatted text to the output, and we expect it to follow
redirection.
v3.0.26Compare Source
Fixes:
v3.0.25Compare Source
Fixes:
DummyOutputwhensys.stdoutisNoneandDummyInputwhensys.stdinisNone. This fixes an issue when the code runs on windows,using pythonw.exe and still tries to interact with the terminal.
Application._is_runningflag in case of exceptions in somesituations.
binding. For prompt sessions, the behavior is now identical to pressing
control-c.
slow_duration_callbackby default to 0.5. Thisprevents printing warnings if rendering takes too long on slow systems.
v3.0.24Compare Source
Fixes:
PermissionErrorwhen trying to attach /dev/null in vt100 input.v3.0.23Compare Source
Fixes:
New features:
vt100 input parser.
v3.0.22Compare Source
Fixes:
v3.0.21Compare Source
New features:
v3.0.20Compare Source
New features:
breakpointhook was installed). This enhances the usage of PDB for debugging
applications.
Fixes:
print_formatted_textis always printed above the runningapplication, like
patch_stdout. (Before,patch_stdoutwas even completelyignored in case of `print_formatted_text, so there was no proper way to use
it in a running application.)
v3.0.19Compare Source
Fixes:
issue when using aiogevent).
FormattedTextControlmouse logic.print_containeralways in a thread (avoid interfering with possibleevent loop).
when generating Sphinx docs).
v3.0.18Compare Source
New features:
in_threadparameter toApplication.run.This is useful for running an application in a background thread, while the
main thread blocks. This way, we are sure not to interfere with an event loop
in the current thread. (This simplifies some code in ptpython and fixes an
issue regarding leaking file descriptors due to not closing the event loop
that was created in this background thread.)
v3.0.17Compare Source
New features:
styleparameter inprint_containerutility.Fixes:
v3.0.16Compare Source
New features:
ScrollablePane: a scrollable layout container.This allows applications to build a layout, larger than the terminal, with a
vertical scroll bar. The vertical scrolling will be done automatically when
certain widgets receive the focus.
DeduplicateCompleter andConditionalCompleter`.deduplicateargument tomerge_completers.v3.0.15Compare Source
Fixes:
is used and big amounts of text are written.
Windowrendering, takedont_extend_width/dont_extend_heightintoaccount. This fixes issues where one window is enlarged unexpectedly because
it's bundled with another window in a
HSplit/VSplit, but with differentwidth/height.
SIGWINCHin progress bar anymore. (The UI runs in anotherthread, and we have terminal size polling now).
Application.invalidate(). (Fixes aRuntimeErrorin some situations when using progress bars.)ANSI support.
QUICK_EDIT_MODEon Windows 10 when mouse support is requested.v3.0.14Compare Source
New features:
PROMPT_TOOLKIT_BELL=falseenvironment variable has beenset.
Fixes:
v3.0.13Compare Source
Fixes:
ThreadedHistory. Previous fix was notcorrect.
v3.0.12Compare Source
Fixes:
ThreadedHistorythat happens when continuouslypasting input text (which would continously repopulate the history).
cleanup).
v3.0.11Compare Source
New features:
a thread other than the main thread (where handling SIGWINCH doesn't work) or
in the Windows console.
Fixes:
AppSessionin order to see which application isrunning, rather then looking at the event loop which is installed when
StdoutProxyis created. This way,patch_stdoutwill work whenprompt_toolkit applications with a different event loop run.
rawargument ofPatchStdout.ThreadedHistory, which includes several fixes, inparticular a race condition (see issue #1158) that happened when editing
input while a big history was still being loaded in the background.
v3.0.10Compare Source
New features:
WordCompleter: acceptdisplay_dict. Also accept formatted textfor both
display_dictandmeta_dict.Fixes:
v3.0.9New features:
Fixes:
print_formatted_text. (Don't render stylingattributes to output between fragments that have identical styling.)
FileHistorydecoding errors.v3.0.8New features:
validatorparameter toinput_dialog.Fixes:
fileno.somehow.
isattymethod was not implemented.to_formatted_text.Document._is_word_before_cursor_complete.Fixes some key bindings.
ProgressBarCounterin shortcuts module.v3.0.7Compare Source
New features:
PromptSession.Other changes:
InputtoOutputclasses (this does clean up some code).
Fixes:
FormattedTextControlwhen line wrapping is turnedon.
BrokenPipeError.v3.0.6Compare Source
New features:
See issues #876 and PR #1150 and #1184 on GitHub.
PosixPipeInputandWin32PipeInput).Outputimplementations. Added
get_default_color_depthmethod toOutputobjects.
connection stdout.
REPLACE_SINGLEinput mode for Vi key bindings.KeyPressEventin key_binding/init.py (often used in typeannotations).
(this improves copying in some terminals).
Fixes:
sys.stdin.encodingfor decoding stdin stream.v3.0.5Compare Source
Fixes:
v3.0.4Compare Source
New features:
set_exception_handleroptional argument toPromptSession.prompt().Fixes:
PromptSessionwas invalidating the UIcontinuously.
call_soon_threadsafe).set_exception_handlerinApplication.runto therun_asynccall.NestedCompleterwhen there is a leading space.Breaking changes:
ShiftControlhas been replaced withControlShiftands-cwithc-sinkey bindings. Aliases for backwards-compatibility have been added.
v3.0.3Compare Source
New features:
home/end/page-up/page-down/insert.
better regular expressions. This should improve the start-up time for
applications using this feature.
ProgressBarCounter.stopped.scroll_offset,min_brightnessandmax_brightness.always_prefer_ttyparameters tocreate_input()andcreate_output().Application.run()ifget_event_loop()raisesRuntimeerror.Fixes:
too many useless coroutines were created.)
prompt_toolkit application is stopped by something other than user input. (In
that case, the application would hang, waiting for input.) This also fixes a
RuntimeErrorin the progress bar code.line-number.currentstyle. (wascurrent-line-number.)get_size).invalidate()if the application is not running.v3.0.2New features:
Fixes
handle_sigintfromApplication.runtoApplication.run_async.print_containerutility (handleEOFError).Breaking changes:
create_pipe_input,PosixPipeInputandWin32PipeInput.v3.0.1Fixes:
issue when using aiogevent).
FormattedTextControlmouse logic.print_containeralways in a thread (avoid interfering with possibleevent loop).
when generating Sphinx docs).
v3.0.0Compare Source
New features:
Breaking changes:
although 3.7 is preferred (because of ContextVars).
Applicationbecame a contextvar. Which means that it should bepropagated correctly to the code that requires it. However, random other
threads or coroutines won't be able to know what the current application is.
Application. You still have to call eitherrun()orrun_asyncon theApplicationobject.patch_stdoutnow requires anApplicationas input.v2.0.10Compare Source
v2.0.9Compare Source
Bug fixes:
Application.run_system_commandon Windows.the cursor.
v2.0.8Compare Source
Bug fixes:
not reflected in the history.
down in some applications after some time (especially if there is a refresh
interval).
print_containerutility work if the input is not a pty.New features:
READLINE_LIKEdisplay method.FuzzyCompleterandFuzzyWordCompleter.AssertionError in many cases).
v2.0.7Compare Source
Bug fixes:
prompt()method. This fixes the issue that passingdefaultonce, willstore it for all consequent calls in the
PromptSession.__pt_formatted_text__always returns aFormattedTextinstance. This fixes an issue with
print_formatted_text.New features:
(Print warning instead of failing with an assertion.)
print_containerutility.collections.abc.Sequencefor HSplit/VSplit children (instead oflists only).
v2.0.6Compare Source
Bug fixes:
(Terminals can assign different color schemes for ansi colors, and we don't
want use any of those for colors that are defined like #aabbcc for instance.)
Backwards incompatible changes:
Bufferclass. Reset the buffer unless theaccept_handlerreturns
True(which means: "keep_text"). This doesn't affect applicationsthat use
PromptSession.New features:
AdjustBrightnessStyleTransformation. This is a simple styletransformation that improves the rendering on terminals with light or dark
background.
TextArea:focus_on_click.auto_suggest,complete_while_typing,history,get_line_prefix,input_processors.lexer,completer,complete_while_typing,accept_handler,read_only,wrap_lines.v2.0.5Compare Source
Bug fixes:
DynamicContainer. Return correct result forget_children. Thisfixes a bug related to focusing.
start,endandsym_bcharacters ofprogress bar.
Backwards incompatible changes:
PromptSessionattributes when exiting prompt.New features:
get_line_prefixattribute to window. This opens manypossibilities:
of the line, or insert some symbols in front. Like the Vim "breakindent"
option.
dark color schemes. Added
swap_light_and_dark_colorsparameter toprompt()function.format()method to ANSI formatted text.pre_runargument toPromptSession.prompt()method.v2.0.4Compare Source
Bug fixes:
TextArea. Setaccept_handlertoNoneif not given.mode, and the buffer doesn't have an accept handler.
defaultargument of thepromptfunction when called multipletimes.
historyinprompt()function again.Backwards incompatible changes:
PipeInputtoPosixPipeInput. AddedWin32PipeInputandcreate_input_pipe.bufferargument to theaccept_handlerofTextArea.New features:
accept_defaultargument toprompt().DynamicContainer.merge_completersfor merging multiple completers together.v2.0.3Compare Source
Bug fixes:
doesn't cross.
v2.0.2Compare Source
Bug fixes:
the line.
v2.0.1Compare Source
Version 2.0 includes a big refactoring of the internal architecture. This
includes the merge of the CommandLineInterface and the Application object, a
rewrite of how user controls are focused, a rewrite of how event loops work
and the removal of the buffers dictionary. This introduces many backwards
incompatible changes, but the result is a very nice and powerful architecture.
Most architectural changes effect full screen applications. For applications
that use
prompt_toolkit.shortcutsfor simple prompts, there are fewerincompatibilities.
Changes:
No automatic translation from \r into \n during the input processing. These
are two different keys that can be handled independently. This is a big
backward-incompatibility, because the
Enterkey isControlM, notControlJ. So, now that we stopped translating \r into \n, it could be thatcustom key bindings for
Enterdon't work anymore. Make sure to bindKeys.Enterinstead ofKeys.ControlJfor handling theEnterkey.The
CommandLineInterfaceand theApplicationclasses are merged. First,CommandLineInterfacecontained all the I/O objects (like the input, outputand event loop), while the
Applicationcontained everything else. There wasno practical reason to keep this separation. (
CommandLineInterfacewasmostly a proxy to
Application.)A consequence is that almost all code which used to receive a
CommandLineInterface, will now use anApplication. Usually, where wehad an attribute
cli, we'll now have an attributeapp.Secondly, the
Applicationobject is no longer passed around. Theget_appfunction can be used at any time to acquire the active application.
(For backwards-compatibility, we have aliases to the old names, whenever
possible.)
prompt_toolkit no longer depends on Pygments, but it can still use Pygments
for its color schemes and lexers. In many places we used Pygments "Tokens",
this has been replaced by the concept of class names, somewhat similar to
HTML and CSS.
PygmentsStyleandPygmentsLexeradaptors are available forplugging in Pygments styles and lexers.
Wherever we had a list of
(Token, text)tuples, we now have lists of(style_string, text)tuples. The style string can contain both inlinestyling as well as refer to a class from the style sheet.
PygmentsTokensis an adaptor that converts a list of Pygments tokens into a list of
(style_string, text)tuples.Changes in the
Styleclasses.style.from_dictdoes not exist anymore. Instantiate theStyleclassdirectory to create a new style.
Style.from_dictcan be used to createa style from a dictionary, where the dictionary keys are a space separated
list of class names, and the values, style strings (like before).
print_tokenswas renamed toprint_formatted_text.In many places in the layout, we accept a parameter named
style. All thestyles from the layout hierarchy are combined to decide what style to be
used.
The ANSI color names were confusing and inconsistent with common naming
conventions. This has been fixed, but aliases for the original names were
kept.
The way focusing works is different. Before it was always a
Bufferthatwas focused, and because of that, any visible
BufferControlthat containedthis
Bufferwould be focused. Now, any user control can be focused. Allof this is handled in the
Application.layoutobject.The
buffersdictionary (CommandLineInterface.buffers) does not existanymore. Further,
bufferswas aBufferMappingthat keeps track of whichbuffer has the focus. This significantly reduces the freedom for creating
complex applications. We wanted to move toward a layout that can be defined
as a (hierarchical) collection of user widgets. A user widget does not need
to have a
Bufferunderneath and any widget should be focusable.layout.Layoutwas introduced to contain the root layout widget and keeptrack of the focus.
The key bindings were refactored. It became much more flexible to combine
sets of key bindings.
Registryhas been renamed toKeyBindings.add_bindingfunction has been renamed to simplyadd.load_*function returns oneKeyBindingsobjects, instead ofpopulating an existing one, like before.
ConditionalKeyBindingswas added. This can be used to enable/disableall the key bindings from a given
Registry.merge_key_bindingswas added. This takes a list ofKeyBindingsand merges them into one.key_binding.defaults.load_key_bindingswas added to load all the keybindings.
KeyBindingManagerhas been removed completely.input_processorwas renamed tokey_processor.Further:
Keyclass does not exist anymore. Every key is a string and it'sconsidered fine to use string literals in the key bindings. This is more
readable, but we still have run-time validation. The
Keysenum stillexist (for backwards-compatibility, but also to have an overview of which
keys are supported.)
User controls can define key bindings, which are active when the user control
is focused.
UIControlgot aget_key_bindings(abstract) method.Changes in the layout engine:
LayoutDimensionwas renamed toDimension.VSplitandHSplitnow take apaddingargument.VSplitandHSplitnow take analignargument.(TOP/CENTER/BOTTOM/JUSTIFY) or (LEFT/CENTER/RIGHT/JUSTIFY).
Floatnow takesallow_cover_cursorandattach_to_windowarguments.Windowgot anWindowAlignargument. This can be used for the alignmentof the content.
TokenListControl(renamed toFormattedTextControl) doesnot have an alignment argument anymore.
Window, got astyleargument. The style forparent containers propagate to child containers, but can be overriden.
This is in particular useful for setting a background color.
FillControldoes not exist anymore. Use thestyleandcharargumentsof the
Windowclass instead.DummyControlwas added.PromptMarginnow takesline_numberandis_soft_wrapas input.Changes to
BufferControl:The
InputProcessorclass has been refactored. Theapply_transformationmethod should now takes a
TransformationInputobject as input.The text
(reverse-i-search)is now displayed through a processor. (Seethe
shortcutsmodule for an example of its usage.)widgetsanddialogsmodules:A small collection of widgets was added. These are more complex collections
of user controls that are ready to embed in a layout. A
shortcuts.dialogsmodule was added as a high level API for displaying input, confirmation and
message dialogs.
Every class that exposes a
__pt_container__method (which is supposedto return a
Containerinstance) is considered a widget. Theto_containershortcut will call this method in situations where aContainerobject is expected. This avoids inheritance from otherContainertypes, but also having to unpack the container object fromthe widget, in case we would have used composition.
Warning: The API of the widgets module is not considered stable yet, and
can change is the future, if needed.
Changes to
Buffer:Bufferno longer takes anaccept_action. BothAcceptActionandAbortActionhave been removed. Instead it takes anaccept_handler.Changes regarding auto completion:
menu.
wrapped in
ThreadedCompleterin order to get asynchronous autocompletion.displayed as soon as they are generated. This means that we don't have to
wait for all the completions to be generated, before displaying the first
one. The completion menus are updated as soon as new completions arrive.
Changes regarding input validation:
Validator.from_callableclass method for easy creation ofnew validators.
Changes regarding the
Historyclasses:Historybase class has a different interface. This was needed forasynchronous loading of the history.
ThreadedHistorywas added for this.Changes related to
shortcuts.prompt:There is now a class
PromptSessionwhich also has a methodprompt. Boththe class and the method take about the same arguments. This can be used to
create a session. Every
promptcall of the same instance will reuse allthe arguments given to the class itself.
The input history is always shared during the entire session.
Of course, it's still possible to call the global
promptfunction. Thiswill create a new
PromptSessionevery time when it's called.The
promptfunction now takes akey_bindingsargument instead ofkey_bindings_registry. This should only contain the additional bindings.(The default bindings are always included.)
Changes to the event loops:
The event loop API is now closer to how asyncio works. A prompt_toolkit
Applicationnow has aFutureobject. Calling the.run_async()methodcreates and returns that
Future. An event loop has arun_until_completemethod that takes a future and runs the event loop until the Future is set.
The idea is to be able to transition easily to asyncio when Python 2
support can be dropped in the future.
Applicationstill has a methodrun()that underneath still runs theevent loop until the
Futureis set and returns that result.The asyncio adaptors (like the asyncio event loop integration) now require
Python 3.5. (We use the async/await syntax internally.)
The
InputandOutputclasses have some changes. (Not really important.)Application.run_sub_applicationshas been removed. The alternative is tocall
run_coroutine_in_terminalwhich returns aFuture.Changes to the
filtersmodule:The
Applicationis no longer passed around, so bothCLIFilterandSimpleFilterwere merged intoFilter.to_cli_filterandto_simple_filterbecameto_filter.All filters have been turned into functions. For instance,
IsDonebecame
is_doneandHasCompletionsbecamehas_completions.This was done because almost all classes were called without any arguments
in the
__init__causing additional braces everywhere. This means thatHasCompletions()has to be replaced byhas_completions(withoutparenthesis).
The few filters that took arguments as input, became functions, but still
have to be called with the given arguments.
For new filters, it is recommended to use the
@Conditiondecorator,rather then inheriting from
Filter.Other renames:
IncrementalSearchDirectionwas renamed toSearchDirection.use_alternate_screenparameter has been renamed tofull_screen.Buffer.initial_documentwas renamed toBuffer.document.TokenListControlhas been renamed toFormattedTextControl.Application.set_return_valuehas been renamed toApplication.set_result.Other new features:
DummyAutoSuggestandDynamicAutoSuggestwere added.DummyClipboardandDynamicClipboardwere added.DummyCompleterandDynamicCompleterwere added.DummyHistoryandDynamicHistorywas added.to_containerandto_windowutilities were added.v1.0.18Compare Source
v1.0.17Compare Source
v1.0.16Compare Source
v1.0.15Compare Source
Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.