Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .flake8
Empty file.
29 changes: 29 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: linting
# Linting tools use `pyproject.toml` and `setup.cfg` for config.

on:
- pull_request

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.7"
- name: Install requirements
run: pip install -r requirements-dev.txt
- name: isort
run: isort .
- name: black
run: black .
- name: flake8
run: flake8 .
- name: mypy
run: mypy .
- name: bandit
run: bandit .
- name: safety
run: safety check
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: tests

on:
- pull_request

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install requirements
run: |
python -m pip install -U pip
python -m pip install -r requirements-test.txt
- name: Run tests
run: |
python -m pytest .
169 changes: 150 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,152 @@
*.class
*.o
*.pyc
*.sqlite3
*.sw[op]
*~
.DS_Store
bin-debug/*
bin-release/*
bin/*
tags
*.beam
*.dump
env/
.env/
*egg-info*
misc/
dist/
Icon?
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
4 changes: 4 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3.7.12
3.8.12
3.9.10
3.10.2
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.5.0 (unreleased)
* Remove support for older Python versions (3.7+ from now on).
* Add `sort_dict` option (thanks @gergelyk).
* Use `pytest` instead of `nose` (thanks @pgajdos).
* Use GitHub Actions instead of Travis.
* Security: `safety` and `bandit`.

0.4.0
* Add IPython plugin (thanks @roee30;
https://github.com/wolever/pprintpp/pull/20)
Expand Down
20 changes: 7 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
``pprint++``: a drop-in replacement for ``pprint`` that's actually pretty
=========================================================================

.. image:: https://travis-ci.org/wolever/pprintpp.svg?branch=master
:target: https://travis-ci.org/wolever/pprintpp

Now with Python 3 support!

Installation
------------


``pprint++`` can be installed with Python 2 or Python 3 using ``pip`` or
``easy_install``::
``pprint++`` can be installed using ``pip`` or ``easy_install``::

$ pip install pprintpp
- OR -
Expand Down Expand Up @@ -42,14 +36,14 @@ Usage
3. As an `ipython <https://github.com/ipython/ipython>`_ extension::

In [1]: %load_ext pprintpp

This will use pprintpp for ipython's output.

To load this extension when ipython starts, put the previous line in your `startup file <https://ipython.org/ipython-doc/1/config/overview.html#startup-files>`_.

You can change the indentation level like so::
In [2]: %config PPrintPP.indentation = 4

In [2]: %config PPrintPP.indentation = 4

4. To monkeypatch ``pprint``::

Expand Down Expand Up @@ -218,7 +212,7 @@ Without ``printpp``::
>>> pprint.pprint(["Hello", np.array([[1,2],[3,4]])])
['Hello', array([[1, 2],
[3, 4]])]
>>> tweet = {'coordinates': None, 'created_at': 'Mon Jun 27 19:32:19 +0000 2011', 'entities': {'hashtags': [], 'urls': [{'display_url': 'tumblr.com/xnr37hf0yz', 'expanded_url': 'http://tumblr.com/xnr37hf0yz', 'indices': [107, 126], 'url': 'http://t.co/cCIWIwg'}], 'user_mentions': []}, 'place': None, 'source': '<a href="http://www.tumblr.com/" rel="nofollow">Tumblr</a>', 'truncated': False, 'user': {'contributors_enabled': True, 'default_profile': False, 'entities': {'hashtags': [], 'urls': [], 'user_mentions': []}, 'favourites_count': 20, 'id_str': '6253282', 'profile_link_color': '0094C2'}}
>>> tweet = {'coordinates': None, 'created_at': 'Mon Jun 27 19:32:19 +0000 2011', 'entities': {'hashtags': [], 'urls': [{'display_url': 'tumblr.com/xnr37hf0yz', 'expanded_url': 'http://tumblr.com/xnr37hf0yz', 'indices': [107, 126], 'url': 'http://t.co/cCIWIwg'}], 'user_mentions': []}, 'place': None, 'source': '<a href="http://www.tumblr.com/" rel="nofollow">Tumblr</a>', 'truncated': False, 'user': {'contributors_enabled': True, 'default_profile': False, 'entities': {'hashtags': [], 'urls': [], 'user_mentions': []}, 'favourites_count': 20, 'id_str': '6253282', 'profile_link_color': '0094C2'}}
>>> pprint.pprint(tweet)
{'coordinates': None,
'created_at': 'Mon Jun 27 19:32:19 +0000 2011',
Expand Down
3 changes: 1 addition & 2 deletions pp/README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
``pp``: an alias for pprint++
=============================

``pp`` can be installed with Python 2 or Python 3 using ``pip`` or
``easy_install``::
``pp`` can be installed with using ``pip`` or ``easy_install``::

$ pip install pprintpp pp-ez
- OR -
Expand Down
2 changes: 1 addition & 1 deletion pp/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def fmt(self, *args, **kwargs):
return self.pformat(*args, **kwargs)

def __repr__(self):
return "<module '%s' (pp_magic_module with pprint_mod=%r)>" %(
return "<module '%s' (pp_magic_module with pprint_mod=%r)>" % (
self.__name__,
self.pprint_mod.__name__,
)
Expand Down
32 changes: 18 additions & 14 deletions pp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="pp-ez",
version="0.2.0",
version="0.3.0",
url="https://github.com/wolever/pprintpp",
author="David Wolever",
author_email="david@wolever.net",
Expand All @@ -23,17 +23,21 @@
py_modules=["pp"],
install_requires=[],
license="BSD",
classifiers=[ x.strip() for x in """
Development Status :: 3 - Alpha
Environment :: Console
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Topic :: Software Development
Topic :: Utilities
""".split("\n") if x.strip() ],
classifiers=[
x.strip()
for x in """
Environment :: Console
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Topic :: Software Development
Topic :: Utilities
""".split(
"\n"
)
if x.strip()
],
)
Loading