Python Cellular Sheaf Library
Clone or download


PySheaf: Sheaf-theoretic toolbox

This repository consists of Python 2.7 libraries for manipulating cell complexes and sheaves of sets or vector spaces on cell complexes [1], [2], [3], [4], [5], [6]


Full documentation is at


You can install by cloning this repo (there is no PyPI package). For Linux, you can do:

$ git clone
$ pip install pysheaf

See the documentation for full details! (Though it's a bit out of date...)


The general plan of usage is

  1. First (usually on paper!) lay out the cell complex that will serve as the base for your sheaf. Label each cell with a unique index, starting from zero.
  2. Determine all of the stalks over each cell, and the restriction maps from lower dimension to higher. Restriction maps can be a mixture of numpy matrices or instances of LinearMorphism, SetMorphism, or SheafMorphism.
  3. Construct a Sheaf instance from a list of SheafCell instances, all at once using the information from the previous two steps.
  4. Analyze the resulting sheaf:
    1. If you have data, you can build Assignment instances whose list of AssignmentCell instances refer to your sheaf.
    2. You can compute cohomology of the Sheaf instance as well.

Have a look at the pysheaf/tests folder for some examples!

This code is under active development, so not everything works as it should. If you find anything that you can correct, feel free to send me suggestions!

Michael Robinson
American University
[3]Cliff Joslyn, Emilie Hogan, Michael Robinson, "Towards a topological framework for integrating semantic information sources," Semantic Technologies for Intelligence, Defense, and Security (STIDS), 2014.
[4]Michael Robinson, "Sheaves are the canonical datastructure for information integration," Information Fusion, 36 (2017), pp. 208-224. (preprint version is
[5]Michael Robinson, "Sheaf and cosheaf methods for analyzing multi-model systems,"
[6]Michael Robinson, Topological Signal Processing, Springer, 2014.