Skip to main content

You can easily add numpy.ndarray.shape information to your script as comments.

Project description

Shape Commentator

CircleCI

About

You can easily add numpy.ndarray.shape information to your script as comments.

Installation

pip install shape_commentator

Tested Python Version

Test script must be written in these version of Python.

  • 3.6.6
  • 3.5.6
  • 3.4.9
  • 2.7.15

Usage

CLI

  1. Run this script as a module with argument of script name. Command line arguments to the target script are available.

python -m shape_commentator src.py

python -m shape_commentator src.py arg1 arg2

  1. You get the commented script. For example, you execute shape_commentator to src.py, you get src.py.commented.py.
    src
    src_commented

IPython / Jupyter Notebook

  1. Execute the cell that you want to see shape.
  2. Run the cell below, and the commented source code will be outputted.
import shape_commentator
shape_commentator.comment(In[len(In)-2],globals(),locals())

jupyter

Development

Python Main Version in Development

  • 3.6.6

Prerequisities

pip install numpy
sudo apt install bats

Test

python -m doctest shape_commentator/shape_commentator.py
bats tests/test_all.bats

Try Master Branch

The package of shape_commentator in TestPyPI is the HEAD of master branch.
You can try newest (but under development) version by running commands below.

yes | pip uninstall shape-commentator
pip install --index-url https://test.pypi.org/simple/ shape-commentator

Sample

python shape_commentator/shape_commentator.py tests/input_scripts/numpy_compute.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shape_commentator-0.2.4.tar.gz (4.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page