Files
pygeoapi/docs/source/development.rst
T
2020-04-13 10:07:25 -04:00

72 lines
2.0 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.. _developmenrt:
Development
===========
Codebase
--------
The pygeoapi codebase exists at https://github.com/geopython/pygeoapi.
Testing
-------
pygeoapi uses `pytest <https://docs.pytest.org>`_ for managing its automated tests. Tests
exist in ``/tests`` and are developed for providers, formatters, processes, as well as the
overall API.
Tests can be run locally as part of development workflow. They are also run on pygeoapis
`Travis setup`_ against all commits and pull requests to the code repository.
To run all tests, simply run ``pytest`` in the repository. To run a specific test file,
run ``pytest tests/test_api.py``, for example.
Working with Spatialite on OSX
------------------------------
Using pyenv
^^^^^^^^^^^
It is common among OSX developers to use the package manager homebrew for the installation of pyenv to being able to manage multiple versions of Python.
They can encounter errors about the load of some SQLite extensions that pygeoapi uses for handling spatial data formats. In order to run properly the server
you are required to follow these steps below carefully.
Make Homebrew and pyenv play nicely together:
.. code-block:: bash
# see https://github.com/pyenv/pyenv/issues/106
alias brew='env PATH=${PATH//$(pyenv root)\/shims:/} brew'
Install python with the option to enable SQLite extensions:
.. code-block:: bash
LDFLAGS="-L/usr/local/opt/sqlite/lib -L/usr/local/opt/zlib/lib" CPPFLAGS="-I/usr/local/opt/sqlite/include -I/usr/local/opt/zlib/include" PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.7.6
Configure SQLite from Homebrew over that one shipped with the OS:
.. code-block:: bash
export PATH="/usr/local/opt/sqlite/bin:$PATH"
Install Spatialite from Homebrew:
.. code-block:: bash
brew update
brew install spatialite-tools
brew libspatialite
Set the variable for the Spatialite library under OSX:
.. code-block:: bash
SPATIALITE_LIBRARY_PATH=/usr/local/lib/mod_spatialite.dylib
.. _`Travis setup`: https://github.com/geopython/pygeoapi/blob/master/.travis.yml