- Improve prettyprinting of builtin bound methods. by @anntzer
- Fix test suite compatibility with hypothesis4. by @anntzer
- Use $COLORFGBG to help decide whether to use a dark or light style by @crowsonkb
- Truncate numpy arrays with ndim >= 2 so that the total printed does not exceed max_seq_len by @crowsonkb
- Fixed ipython_repr_pretty extra raising an exception when printing Mock instances (GH #61)
- Added support for pretty printing types.SimpleNamespace (GH #60)
- Fixed dictionary pretty printing indentation when the value had a comment on the line above (GH #59)
- Add prettyprinter for numpy ndarrays. by @anntzer
- Add helper to apply default config. by @anntzer
- A number of docs and CI improvements: #43, #44, #45 .Thanks @anntzer
- Add support for functools.partialmethod. by @anntzer
- Fix typo in changelog. Thanks @Vlad-Shcherbina
- Adds a new extra for numpy. The extra currently registers pretty printers for numpy scalar types. Enable it with
import prettyprinter; prettyprinter.install_extras(['numpy'])
. Thanks @anntzer - C-API named tuples are now automatically prettyprinted. C-API named tuples are returned from expressions such as
sys.flags
,time.strptime(...)
, andos.stat(...)
. The fieldname of each tuple element is annotated using a comment in the output.
This release brings bugfixes, an enhancement to pathlib prettyprinting (thanks @anntzer ) and a nice performance boost. There was an redundant subtree call in a tree normalization procedure that caused exponential runtime, worsening quickly if data was highly nested. That extra call is now removed.
- Fix exponential runtime in highly nested data
- Fix infinite loop when rendering strings in highly nested data
- Only split Path prettyprints on "/", not on "-" or other nonword chars. , thanks @anntzer
- Add vim swapfiles to gitignore , thanks @anntzer
- Fix typo , thanks @anntzer
Most likely no breaking changes.
- Added definitions for
pathlib
standard library module thanks to GitHub userRazerM
- Fixed unexpected error output inside Jupyter notebooks thanks to GitHub user
jdanbrown
- Fixed missing commas in
setup.py
requirements list
No breaking changes.
- Fixed the dataclasses pretty printer that had regressed after changes to the dataclasses API. Fix was contributed by GitHub user
dangirsh
.
No breaking changes.
- Fixed GH issue #17 where Django models showed an incorrect display name for fields with choices.
No breaking changes.
- Added definitions for the
ast
standard library module thanks to GitHub userjohnnoone
.
No breaking changes.
- Added a definition for classes that look like they were built with
collections.namedtuple
- If a pretty printer raises an exception, it is caught and emitted as a warning, and the default repr implementation will be used instead.
- Added definitions for
collections.ChainMap
,collections.defaultdict
,collections.deque
,functools.partial
, and for exception objects. - Made pretty printers for primitive types (dict, list, set, etc.) render a subclass constructor around them
No breaking changes.
- Added Python 3.5 support
- Added
pretty_call_alt
function that doesn't depend ondict
maintaining insertion order - Fixed bug in
set_default_config
where most configuration values were not updated - Added
get_default_config
No breaking changes.
- Fixed regression with types.MappingProxyType not being properly registered.
No breaking changes.
- Added support for deferred printer registration, where instead of a concrete type value, you can pass a qualified path to a type as a
str
toregister_pretty
. For an example, see the deferred printer registration for uuid.UUID
No breaking changes.
- Added pretty printer definition for
types.MappingProxyType
thanks to GitHub user Cologler - Added support for
_repr_pretty_
in the extraipython_repr_pretty
.
- Fixed issue #7 where having a
str
value for IPython'shighlighting_style
setting was not properly handled inprettyprinter
's IPython integration, and raised an exception when trying to print data.
Breaking changes:
- by default,
dict
keys are printed in the default order (insertion order in CPython 3.6+). Previously they were sorted like in thepprint
standard library module. To let the user control this, an additional keyword argumentsort_dict_keys
was added tocpprint
,pprint
, andpformat
. Pretty printer definitions can controldict
key sorting with thePrettyContext
instance passed to each pretty printer function.
Non-breaking changes:
- Improved performance of rendering colorized output by caching colors.
- Added
prettyprinter.pretty_repr
that is assignable to__repr__
dunder methods, so you don't need to write it separately from the pretty printer definition. - Deprecated use of
PrettyContext.set
in favor of less misleadingPrettyContext.assoc
- Defined pretty printing for instances of
type
, i.e. classes. - Defined pretty printing for functions
Breaking change: instances of lists, sets, frozensets, tuples and dicts will be truncated to 1000 elements by default when printing.
- Added pretty printing definitions for
dataclasses
- Improved performance of splitting strings to multiple lines by ~15%
- Added a maximum sequence length that applies to subclasses of lists, sets, frozensets, tuples and dicts. The default is 1000. There is a trailing comment that indicates the number of truncated elements. To remove truncation, you can set
max_seq_len
toNone
usingset_default_config
explained below. - Added ability to change the default global configuration using
set_default_config
. The functions accepts zero to many keyword arguments and replaces those values in the global configuration with the ones provided.
from prettyprinter import set_default_config
set_default_config(
style='dark',
max_seq_len=1000,
width=79,
ribbon_width=71,
depth=None,
)
No backwards incompatible changes.
- Added pretty printer definitions for the
requests
library. To use it, include'requests'
in yourinstall_extras
call:prettyprinter.install_extras(include=['requests'])
.
No backwards incompatible changes.
- Added integration for the default Python shell
- Wrote docs to explain integration with the default Python shell
- Check
install_extras
arguments for unknown extras
- Revised
comment
to accept both normal Python values and Docs, and reversed the argument order to be more Pythonic
- Add
set_default_style
function, improve docs on working with a light background
- Numerous API changes and improvements.
- First release on PyPI.