<commit_before>===========
Maintenance
===========

JSON Schema Repo
================

pydvid includes the `dvidschema`_ repo as a `git subtree` located at prefix pydvid/dvidschema.  
Older versionos of git do not include the ``subtree`` command, so you may need to upgrade git and/or 
manually install the ``subtree`` command into your git installation.

Changes to the dvidschema repo must be pulled into pydvid using ``git subtree pull``.  For example:

.. code-block:: bash

    # Add the dvidschema repo as a remote if you haven't yet...
    git remote add -f janelia-dvidschema https://github.com/janelia-flyem/dvidschema
    
    # Pull the most recent changes from dvidschema into our own repo's subtree
    git fetch janelia-dvidschema
    git subtree pull --prefix pydvid/dvidschema janelia-dvidschema master

.. _dvidschema: https://github.com/janelia-flyem/dvidschema


Testing
=======

The test suite requires the following additional dependencies:

* `nosetests <https://nose.readthedocs.org/en/latest/>`_
* `h5py <http://www.h5py.org/>`_

Here's how to run the test suite:

.. code-block:: bash

    cd tests
    PYTHONPATH=.. nosetests .

Note that pydvid uses its own "mock server" for testing purposes, which mimics the real responses provided by the DVID server.
This means that you cannot have DVID running while running the test suite, as it would conflict with the mock server in the test suite.

Mock Server
-----------
For test purposes, a mock DVID server is implemented in the ``mockserver`` directory.
It serves up HDF5 datasets over http using the `DVID REST API`_.

.. _DVID REST API: http://godoc.org/github.com/janelia-flyem/dvid/datatype/voxels#pkg-constants

The mock server pulls its data from an hdf5 file with a special structure.
The ``H5MockServerDataFile`` utility class can be used to generate the file:

.. code-block:: python<commit_msg>docs: Fix remote repo url for schema subtree.<commit_after>===========
Maintenance
===========

JSON Schema Repo
================

pydvid includes the `service-contracts`_ repo as a `git subtree` located at prefix pydvid/dvidschema.  
Older versionos of git do not include the ``subtree`` command, so you may need to upgrade git and/or 
manually install the ``subtree`` command into your git installation.

Changes to the dvidschema repo must be pulled into pydvid using ``git subtree pull``.  For example:

.. code-block:: bash

    # Add the dvidschema repo as a remote if you haven't yet...
    git remote add -f janelia-service-contracts https://github.com/janelia-flyem/service-contracts
    
    # Pull the most recent changes from service-contracts into our own repo's subtree
    git fetch janelia-service-contracts
    git subtree pull --prefix pydvid/dvidschemas janelia-service-contracts master

.. _service-contracts: https://github.com/janelia-flyem/service-contracts


Testing
=======

The test suite requires the following additional dependencies:

* `nosetests <https://nose.readthedocs.org/en/latest/>`_
* `h5py <http://www.h5py.org/>`_

Here's how to run the test suite:

.. code-block:: bash

    cd tests
    PYTHONPATH=.. nosetests .

Note that pydvid uses its own "mock server" for testing purposes, which mimics the real responses provided by the DVID server.
This means that you cannot have DVID running while running the test suite, as it would conflict with the mock server in the test suite.

Mock Server
-----------
For test purposes, a mock DVID server is implemented in the ``mockserver`` directory.
It serves up HDF5 datasets over http using the `DVID REST API`_.

.. _DVID REST API: http://godoc.org/github.com/janelia-flyem/dvid/datatype/voxels#pkg-constants

The mock server pulls its data from an hdf5 file with a special structure.
The ``H5MockServerDataFile`` utility class can be used to generate the file:

.. code-block:: python
{'fraction_non_alphanumeric': 0.10449701065765532, 'fraction_numerical': 0.0025994281258123215, 'mean_word_length': 3.9019108280254775, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '745263', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1103, 'n_words': 476}