You can easily add numpy.ndarray.shape information to your script as comments.
Project description
Shape Commentator
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
- 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
- You get the commented script. For example, you execute shape_commentator to
src.py
, you getsrc.py.commented.py
.
IPython / Jupyter Notebook
- Execute the cell that you want to see shape.
- Run the cell below, and the commented source code will be outputted.
import shape_commentator
shape_commentator.comment(In[len(In)-2],globals(),locals())
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
sh tests/install_for_dev.sh
bats tests/test_all.bats
python setup.py develop --uninstall
Changing Test Scripts
Remove remove_tested_scripts
in tests/test_all.bats
and run bats tests/test_all.bats
, and you get new test script in tests/input_scripts/
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
sh tests/install_for_dev.sh
# Module Mode
python -m shape_commentator tests/input_scripts/numpy_compute.py
# Method Mode
python tests/comment_method.py tests/input_scripts/numpy_compute.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.