Questions tagged [pweave]

Pweave is a Python library for creating documents that capture the results of Python computations.

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.

Features:

  • Python 2.7 and 3.4 compatibility
  • 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, HTML or markdown for document chunks
  • Publish reports from Python scripts. Similar to R markdown.
  • Run from command line or interpreter.
  • Support also for Octave and Matlab code.

http://mpastell.com/pweave/

20 questions
8
votes
1 answer

print(tabulate(...)) to pretty print multiIndex pandas ?

Say i have a pandas data frame: import numpy as np import pandas as pd from tabulate import tabulate A = pd.DataFrame(np.random.randint(0,10,(3,6)), index= ['uno', 'dos', 'tres']) A.columns = ['A','B','C','D','E','F'] A.index.names =…
Cy Bu
  • 1,401
  • 2
  • 22
  • 33
5
votes
0 answers

Pweave resulting in MultipleInstanceError after updating anaconda

After updating to the current version of Anacondo (Anaconda3-5.0.0-Windows-x86_64), my pweave code has run into some issues. When running for example pweave.weave('example.texw', doctype = 'tex') I get the MultipleInstanceError with the traceback…
5
votes
1 answer

Using an R Markdown style document (.Rmd) as input for Pweave

I'm trying to run a basic R Markdown document (that calls python in code chunks) through Pweave. In the Pweave documentation it states that you can declare code chunks using the style ```{python}. However when I try to compile using, for example,…
James Owers
  • 7,948
  • 10
  • 55
  • 71
4
votes
1 answer

echo=False by default in pweave

How can I set the flag echo=False by default to all code, when precessing a python-script file with pweave. Minimal example: #' # Minimal example. #' This is a minimal example, which #' says 'hello' to you. #+ echo=False print('Hello') #' The…
Thomas Möbius
  • 1,702
  • 2
  • 17
  • 23
3
votes
1 answer

Emacs polymode for Markdown and Python

I use the python3 pweave library (http://mpastell.com/pweave/usage.html) for literate programming. pweave uses as text mode markdown, as code mode python3, and it is possible to use noweb (https://en.wikipedia.org/wiki/Noweb) literate programming…
bue
  • 333
  • 2
  • 12
2
votes
2 answers

Can Pweave play nice with Ruffus?

I am interested in developing self-documenting pipelines. Can I wrap Ruffus tasks in Pweave chunks? Pweave and Ruffus ============================================================== **Let's see if Pweave and ruffus can play…
Jeremy Leipzig
  • 1,914
  • 3
  • 21
  • 26
2
votes
1 answer

Pweave cannot import local module

I'm trying to import code from a local module into a pweave document, and I can't get it to work. I have the following files - foo.pmd - bar.py - __init__.py Contents of foo.pmd: ```python import bar bar.foobar() ``` Contents of bar.py: def…
pteehan
  • 807
  • 9
  • 19
2
votes
1 answer

Pweave - putting LaTeX output within python functions

I'm putting together a fairly complex python script with functions that may or may not be called depending on the data that's being analysed. In pure python, all works well. As soon as I break out of the code block to create a LaTeX section for the…
Yssybyl
  • 75
  • 8
2
votes
2 answers

How to specify the size of a figure with Pweave (using a .py script)

I am trying to specify the size of a figure with Pweave inside a 'Pweave-compatible' .py script: #' do the imports import matplotlib.pyplot as plt #' normal figure plt.figure(1) plt.plot(range(30), color='k', linestyle='dashed', marker='o') #'…
bobleponge
  • 151
  • 1
  • 5
1
vote
1 answer

How to setup up Pweave on Atom for Python 3?

I want to get into literate programming on my code editor, so I decided to try to set up Pweave for Atom (the code editor) by following the steps on this website: http://protips.maxmasnick.com/literate-python-setup-with-pweave-and-atom. But it still…
1
vote
1 answer

Using Pweave tool from within Pycharm

I am trying to use a Pweave tool with Pycharm Professional 2018.2 Inspired by this blog-post, I tried to create and publish Python scripts, but I don't understand how to make Pycharm "play" with External Tools and how to trigger and run with…
Tim Mironov
  • 849
  • 8
  • 22
1
vote
1 answer

pweave module not generating figures

Having recently switched from R to Python, I am exploring Pweave as a substitute to Sweave. The example files (http://mpastell.com/pweave/examples/index.html) look great so I have started building on those. Using the command pweave -f tex…
1
vote
1 answer

Python Pweave to LaTeX

I am trying to get Pweave to generate a LaTeX file in a form other than verbatim so that I can add a few features to the doc (logo, footnotes etc...). So far as much as I love Pweave for the ease of use and convenience, I have been unable to do so. …
Cy Bu
  • 1,401
  • 2
  • 22
  • 33
1
vote
2 answers

Python: Document results and figures into tex document

I currently have written a script that produces several figures. I was wondering if there is a way to publish these figures directly into a tex file, say in eps format without including all of the python code verbatim. I also want to include the…
1
vote
1 answer

Using a global variable in Pweave template

Looking at the documentation for pweave here, it appears to be possible to access any data generated inside a template by the calling program, by setting the returnglobals variable. Is it possible to do the opposite?, i.e. have the template…
Luciano
  • 2,388
  • 1
  • 22
  • 33
1
2