Skip to main content

Scientific reports with embedded python computations with reST, LaTeX or markdown

Project description

https://travis-ci.org/mpastell/Pweave.svg?branch=master

About Pweave

Pweave is a scientific report generator and a literate programming tool for Python. Pweave can capture the results and plots from data analysis and works well with numpy, scipy and matplotlib. Pweave is inspired by Sweave, an excellent tool for R programmers, and the syntax is mostly compatible with it. Pweave supports reST, Sphinx, Latex, and Pandoc markdown markups.

Pweave uses the noweb syntax for separating code from documentation, but it also supports ERB style evaluation of inline code. Pweave is able to weave a python code between <<>>= and @ blocks and include the results and capture matplotlib plots in the document. Inline code in documentation chunks is marked using <% %> (code will be evaluated in place) and <%= %> (result of expression will be printed) tags. Pweave is good for creating reports and tutorials. It can also be used to make websites together with Sphinx or rest2web.

Features:

  • Supports Python 2 and Python 3. Tested with 2.7 and 3.4. as of release 0.22.

  • Execute python code in the chunks and capture input and output to a report.

  • Use hidden code chunks, i.e. code is executed, but not printed in the output file.

  • Capture matplotlib graphics.

  • Evaluate inline code in documentation chunks

  • Cache all code and results from previous runs for fast report generation when you are only working with documentation. Inline code will be hidden in documentation mode.

  • Supports reST, LaTeX or Pandoc markdown for document chunks

  • Run from command line or interpreter

Install:

pip install --upgrade Pweave

If you use conda::

conda install -c https://conda.binstar.org/mpastell pweave

Or download the source package and run::

python setup.py install

Documentation

Pweave documentation can be found from the website http://mpastell.com/pweave

Release Notes

Release 0.23.1

  • Fix for multiline indented blocks by @abukaj

  • Pypublish missing begin{document} problem fixed by @abukaj

  • Fix for pandoc 1.14 - tightlist not defined @trsaunders

Release 0.23

  • New Python option --shell eshell, runs python as subprocess and is not affected by Pweave imports.

  • Pweave can now be used to weave Octave, Matlab and Julia code using --shell option. Have a look at the examples on Github.

Release 0.22.2

  • Figure and cache directory are now handled relative to weaved document

  • Fixed caching

  • Improved error reporting and exception handling

Release 0.22.1

  • Fixed a bug with inline code chunks.

Release 0.22

  • Package global options moved to pweave.rcParams. This is a breaking change if you have used Pweb class to modify Pweave options. Should not affect commandline usage.

  • Renamed pweave.pweave to pweave.weave, pweave.ptangle to pweave.tangle

  • Python 3 compatibilty, Thanks to Grant Goodyear https://github.com/g2boojum

  • Publishing of scripts from command line : pypublish script

  • Conversion between input formats and markups: Pweave-convert script

  • Possibility to run shell code from Pweave. See engine chunk option.

  • New input formats:

    • Script

    • IPython notebook

  • Bugfix: setting figure format from command line fixed.

  • Ipython terminal

  • Source option for chunks

    • Read from module

    • Read from file

  • Multichunk blocks: complete option

  • rst format uses .. codeblock:: python directive for code chunks.

  • Output formats:

    • Leanpub markdown

  • New options for figures

    • f_size ( (8,6) ) Saved figure size in inches a tuple (w, h)

    • f_env (None) Environment that goes around figure e.g. sidefigure

    • f_spines (True) removes spines from figure right and top if False.

    • complete (False)

    • source: Read chunk source from file or python module or file

    • engine: Choose engine running the code. “python” or “shell”

Release notes for previous versions are in: http://mpastell.com/pweave/release.html

License information

See the file “LICENSE” for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.

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

Pweave-0.23.1.tar.gz (25.0 kB view details)

Uploaded Source

File details

Details for the file Pweave-0.23.1.tar.gz.

File metadata

  • Download URL: Pweave-0.23.1.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Pweave-0.23.1.tar.gz
Algorithm Hash digest
SHA256 11c6a349aeb8445ff1bd50f9859d748c043acec4e81d410d2f8ba4287f80099b
MD5 67329e19c96e4d7f2d83c945fecfbe2c
BLAKE2b-256 ee5e9a1a42beb86cde7216a1c5ac0f1a1755888236b845b5f0dc0b1a5bb7014e

See more details on using hashes here.

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