The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
This release involves major changes to reprexlite. There is a significant refactoring of the library internals and also many changes to the API. This enabled new feature and more customizability.
- Added a new
--editor
/-e
option to specify what editor to use. If not used, this has same behavior as before. This option is also the new way to launch the IPython interactive shell editor (by passingipython
). - Added new options to control parsing and output style.
--prompt
and--continuation
options let you set the primary and secondary prompt prefixes in rendered output. These default to empty srings""
for "reprex-style" output.- A new
--parsing-method
option controls input-parsing behavior.- The default value
auto
can automatically handle "reprex-style" input as well as "doctest-style`/Python REPL input. - A value
declared
will use the values of--prompt
,--continuation
, and--comment
for parsing input in addition to styling output. To handle input and output with different styes, you can override input-side values with the--input-prompt
,--input-continuation
, and--input-comment
options.
- The default value
- Changed the way to access the IPython interactive shell editor. This is now launched by using the new
--editor
/-e
option by passingipython
. The IPython shell editor also now respects other command line configuration options. It is now considered a stable feature and is no longer experimental. - Renamed the
--old-results
option to--keep-old-results
.
- Fixed bug that silenced output when using the IPython cell magic or the IPython shell editor and encountering an error where reprexlite couldn't render your code (such as a syntax error). This should now display an informative error message.
- Added new
reprexlite.parsing
module which contains functions for parsing input. These functions yield tuples representing lines of the input with an enum indicating whether the line is code or a result. - Added new
reprexlite.reprexes
module which contains code for evaluating a reprex.- The new
Reprex
dataclass serves as the main container for reprex data. It holds parallel lists ofStatement
,ParsedResult
, andRawResult
data.- The
Reprex.from_input_lines
factory method creates aReprex
from the output of thereprexlite.parsing
parsing functions. - The
Reprex.from_input
factory method wraps parsing and takes a string input.
- The
- The
Statement
dataclass holds code data and parsed concrete syntax tree. This serves a similar purpose to the oldStatement
class. - The
ParsedResult
dataclass holds old evaluation results parsed from the input, if any. - The
RawResult
dataclass holds the returned values from evaluating code. This serves a similar purpose to the oldResult
class.
- The new
- Added new
reprexlite.config
module andReprexConfig
dataclass for holding configuration values. - Added new
reprexlite.exceptions
module with exception classes that subclass a base exception classReprexliteException
.
- Changed formatting abstractions in
reprexlite.formatting
module.- Rather than
*Reprex
classes that encapsulate reprex data, we now have*Formatter
classes and take a rendered reprex output string as input to aformat
class method that appropriately prepares the reprex output for a venue, such as adding venue-specific markup. - The
venues_dispatcher
dictionary inreprexlite.formatting
is now aformatter_registry
dictionary. - Formatters are added to the registry using a
register_formatter
decorator instead of being hard-coded.
- Rather than
- Removed
reprexlite.code
module. The functionality in this module was reimplemented in the newreprexlite.reprexes
andreprexlite.parsing
modules. - Removed
reprexlite.reprex
module. Thereprex
function has been moved toreprexlite.reprexes
.
- Added an "Alternatives" page to the documentation that documents alternative tools.
- Added a "Venues Formatting" page to the documentation that documents the different formatting options with examples.
- Changed reprexlite to use a pyproject.toml-based build process and metadata declaration.
- Renamed
HISTORY.md
toCHANGELOG.md
.
- Added experimental IPython interactive editor which can be launched via command line with
reprex --ipython
. This modified IPython editor will run every cell automatically as a reprex.
- Added explicit setting of code evaluation namespace's
__name__
to'__reprex__'
. Previously this was unset and would get inferred, and weird things like'builtins'
would turn up. (PR #44)
- Added support for parsing code copied from an interactive Python shell (REPL) with
>>>
prompts. (#29) - Fixed issue where
tests
module was unintentionally included in distribution. (#30) - Fixed missing requirement
importlib_metadata
for Python 3.6 and 3.7. (#31)
- Added missing LICENSE file.
- Added optional IPython extension that enables
%%reprex
cell magic. See documentation for usage. (#21)
- Changed pygments styling to use the "friendly" color scheme, which looks better for dark backgrounds. (#15)
- Changed submodule organization for code related to reprex formatting. This is now in the
formatting
submodule. (#17)
- Removing old results from inputs: (#8)
- Changed reprexes to—by default—remove lines matching the
comment
prefix (#>
by default). This means that if your input code is a previously rendered reprex, the old results will be removed first and you effectively regenerate it. - Added a new option
old_results
that—if set to True—will preserve such lines.
- Changed reprexes to—by default—remove lines matching the
- Fixed a bug that caused intentional blank lines to be removed. (#7)
- Added stdout capturing. Any content printed to stdout will be shown as a result in the reprex. (#10)
- Added exception handling and stacktrace capture. If the input code has an exception, the stacktrace will be shown as a result in the reprex. (#12)
Initial release! 🎉