Developing

To develop, clone the repository and include git submodules recursively:

git clone --recursive https://github.com/sidewalklabs/s2sphere

Tests require pip install numpy and a build of the original C++ library:

# build and install the C++ library
cd tests/s2-geometry/geometry
cmake .
make -j4
make install

# build the C++ library's Python bindings
cd python
cmake .  # see comment below for OSX
make -j4
make install

# verify Python bindings
python -v -c 'import s2'

OSX requires extra setup:

# point to Brew's OpenSSL installation
export OPENSSL_ROOT_DIR=$(brew --prefix openssl)

# tell the Python cmake which libraries to use
cmake -DPYTHON_LIBRARY=$(python-config --prefix)/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=$(python-config --prefix)/include/python2.7 .

Then install this module with the dependencies needed for running tests and generating docs:

# install
pip install -e .[tests,docs]

Documentation

cd docs/sphinx
make html

Tests

# run tests that don't require the C library
flake8
nosetests -vv

# tests that compare C and Python implementations
python tests/compare_implementations.py -vv