This is the online repository for the book Elegant SciPy, written by Juan Nunez-Iglesias (@jni), Harriet Dashnow (@hdashnow), and Stéfan van der Walt (@stefanv), and published by O'Reilly Media:
Using this book.
The text of the book (inside the
markdown folder) is available under the
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International
Public License (see
All code is available under the BSD 3-clause license (see
LICENSE-CODE.md). This includes:
- Python code embedded in the text of the book.
- Python code inside
The authors also encourage educators to use this book in their own classrooms for noncommercial instructional uses (i.e. for slide presentations in a university lecture), provided that there is proper attribution to the O’Reilly edition in each instance.
If you are unsure whether your use falls outside fair use or the permissions given above, contact us at firstname.lastname@example.org.
Pre-built Jupyter notebooks
You can find the pre-compiled Jupyter notebooks corresponding to the latest version of this repo at:
This includes the necessary data in the data folder.
Or, if you are feeling adventurous, you can compile the notebooks yourself by following the instructions below.
Building the IPython notebooks
This book was written in markdown, with
jupyter nbconvert used
to build the book. To recreate the book contents, install the dependencies,
(see below), then run
make all from this directory (assuming you are using
Mac OS X or Linux).
For interactive exploration you probably don't want to pre-run all the code, but rather create the notebooks with pre-populated input cells. To do this, run, for example:
notedown --match python /markdown/ch5.markdown --output ch5.ipynb
to build a Jupyter notebook containing Chapter 5, which you can then step through by starting a notebook session in this directory:
First, we build an isolated environment as not to interrupt any existing setup you may have. This can be done using, e.g., Conda:
Install conda or Anaconda
Build an isolated environment called "elegant-scipy" and install the necessary dependencies:
conda env create --name elegant-scipy -f /path/to/elegant-scipy/environment.yml
- Activate the environment with
conda activate elegant-scipy(or
source activate elegant-scipyif using conda 4.3.x or earlier, or
activate elegant-scipyon Windows)
To build the full book on Windows, you will at a minimum need the following additional software:
Building the book on Windows is likely to be challenging because we developed the build process on Mac and Linux. However, you should still be able to create conda environments (see "Installing dependencies", above), and run notedown, to make the Jupyter notebooks (see "Building the IPython notebooks", above).
If you encounter any problems, please raise an issue!
Building the complete book
We are using
notedown to convert a markdown file to an IPython
notebook, run it, and then convert to html. For ease of use, this is
done using a Makefile.
You can use
make to build all the chapters:
$ make all
Or to build just an individual chapter, specify the file you wish to create:
$ make html/ch1.html
To generate a zip file containing html of all chapters along with a table of contents (for easy sharing):
$ make zip
brew install npm(macOS) or
sudo apt-get install npm(Ubuntu/Debian)
npm install -g htmlbook
brew install blahtexmlor
sudo apt-get install blahtexml
The results can be checked in to
and built at https://atlas.oreilly.com/oreillymedia/elegant-scipy
Building with Docker
- Install Docker
- Switch to the directory containing this file