Metadata-Version: 2.1
Name: neuronbridge-python
Version: 3.1.1
Summary: Python API for NeuronBridge
Home-page: https://github.com/JaneliaSciComp/neuronbridge-python/
Author: Konrad Rokicki
Author-email: rokickik@janelia.hhmi.org
License: BSD 3-Clause
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: Pillow (~=9.1.0)
Requires-Dist: pydantic (~=1.10.2)
Requires-Dist: requests (~=2.27.1)
Requires-Dist: pymongo (~=3.12.0)
Requires-Dist: python-rapidjson (~=1.5)
Requires-Dist: ray (~=1.12.0)
Requires-Dist: pytest (~=7.1.3)
Requires-Dist: setuptools (~=62.0.0)
Requires-Dist: blend-modes (~=2.1.0)

# NeuronBridge Python API

[![DOI](https://zenodo.org/badge/479832149.svg)](https://zenodo.org/badge/latestdoi/479832149)

A Python API for the [NeuronBridge](https://github.com/JaneliaSciComp/neuronbridge) neuron similarity search service.

See [this notebook](notebooks/python_api_examples.ipynb) for usage examples.

![Data Model Diagram](model_diagram.png)


## Development Notes

Create a conda env with all the dependencies including Jupyter:

    conda env create -f environment.yml
    conda activate neuronbridge-python

Then install it as a Jupyter kernel:
    
    python -m ipykernel install --user --name=neuronbridge-python


### Install for development

You can install the module for development like this:

    conda create --name neuronbridge-python python=3.8
    conda activate neuronbridge-python
    pip install -e .


### Useful shell commands

To update conda_requirements.txt:

    conda env export --from-history --file conda_requirements.txt

To update requirements.txt:

    pipreqs --savepath=requirements.txt && pip-compile

Regenerate the JSON schemas:

    python neuronbridge/generate_schemas.py

Run the unit tests:

    pytest tests


### Publishing a new release

1) Update the version in setup.py
2) Push all changes and tag a release in GitHub
3) Build PyPI distribution:

    python setup.py sdist bdist_wheel

4) Upload to PyPI:

    twine upload dist/*


### Running validation using Ray

You can run validation multithreaded on a single machine like this:

    ./neuronbridge/validate_ray.py

To run the validation script in a distributed manner on the Janelia cluster, you must first install [ray-janelia](https://github.com/JaneliaSciComp/ray-janelia) in a sister directory to where this code base is cloned. Then run a script to bsub the Ray cluster:

    ./scripts/launch_validation.sh


