Practice Python with colored grids in the IPython Notebook
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demos Add a new demo of making "static" Jul 23, 2017
ipythonblocks Bump development version number Aug 4, 2018
.coveragerc Add coverage configuration to only cover ipythonblocks.py. Mar 8, 2014
.gitignore Updates to README and .gitignore Jul 19, 2017
.travis.yml Stop testing on Python 3.3 Aug 4, 2018
CHANGES.rst Update changelog. Jul 9, 2014
CODE_OF_CONDUCT.md Adding code of conduct from https://github.com/Bantik/contributor_cov… Jun 13, 2014
LICENSE.txt Adding license and readme. Jan 11, 2013
MANIFEST.in
README.rst Switched broken pypip.in badges to shields.io Mar 5, 2018
ez_setup.py Switch to setuptools so we can list requests as a requirement. Feb 13, 2014
setup.cfg
setup.py
test_requirements.txt Add .show_image and .save_image methods for grids Jul 9, 2014

README.rst

ipythonblocks

Travis-CI Coveralls PyPI

ipythonblocks is a teaching tool for use with the IPython Notebook. It provides a BlockGrid object whose representation is an HTML table. Individual table cells are represented by Block objects that have .red, .green, and .blue attributes by which the color of that cell can be specified.

ipythonblocks allows students to experiment with Python flow control concepts and immediately see the effects of their code represented in a colorful, attractive way. BlockGrid objects can be indexed and sliced like 2D NumPy arrays making them good practice for learning how to access arrays.

See these demo notebooks for more on using ipythonblocks:

Install

ipythonblocks can be installed with pip:

pip install ipythonblocks

However, the package is contained in a single .py file and if you prefer you can just grab ipythonblocks.py and copy it to wherever you want to use it (useful for packaging with other teaching materials).

Dependencies

Required dependencies:

Optional dependencies:

Testing dependencies:

  • pytest >= 2.3, (for the test suite, see below)
  • responses >= 0.1
  • mock (dependency of responses)

Demo dependencies:

  • PIL (for starry_night_to_text.ipynb)

Testing

The test suite is written using pytest, so you can run the test suite with:

py.test