# NeuronBridge Python API
[](https://zenodo.org/badge/latestdoi/479832149)
A Python API for the [NeuronBridge](https://github.com/JaneliaSciComp/neuronbridge) neuron similarity search service.

## Installation
This library is available [on PyPI](https://pypi.org/project/neuronbridge-python/), so you can install it like this:
```bash
pip install neuronbridge-python
```
## Usage
The client will automatically select the latest version of the data and fetch it from S3. Here's a simple example of how to get an EM image by id:
```python
from neuronbridge import client
client = client.Client()
em_image = client.get_em_image(636798093)
```
See [this notebook](https://github.com/JaneliaSciComp/neuronbridge-python/blob/main/notebooks/python_api_examples.ipynb) for complete usage examples.
## Development Notes
To build this code you will need to [install UV](https://docs.astral.sh/uv/getting-started/installation/).
Create a new UV virtual environment and install the dependencies:
```bash
uv venv --python 3.11
source .venv/bin/activate
uv pip sync requirements-universal.txt
uv pip install -e .
```
### Running data validation using Ray
You can run validation multithreaded on a single machine like this:
```bash
./neuronbridge/validate_ray.py --dashboard --cores 60
```
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:
```bash
./scripts/launch_validation.sh
```
### Updating requirements
After updating the requirements.txt file, you can sync the requirements-universal.txt file like this:
```bash
uv pip compile requirements.txt --universal --output-file requirements-universal.txt
```
### Regenerate the JSON schemas:
```bash
python neuronbridge/generate_schemas.py
```
### Run the unit tests:
```bash
pixi run test
```
### 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:
```bash
pixi run pypi-build
```
4) Upload to PyPI:
```bash
pixi run pypi-upload
```
Raw data
{
"_id": null,
"home_page": null,
"name": "neuronbridge-python",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "neuroscience, neuron, similarity, search, api",
"author": null,
"author_email": "Konrad Rokicki <rokickik@janelia.hhmi.org>",
"download_url": "https://files.pythonhosted.org/packages/58/61/4d2025ef7d4f9c0c41900e6008a904df67af53fc1036c773af710a933354/neuronbridge_python-3.3.0.tar.gz",
"platform": null,
"description": "# NeuronBridge Python API\n\n[](https://zenodo.org/badge/latestdoi/479832149)\n\nA Python API for the [NeuronBridge](https://github.com/JaneliaSciComp/neuronbridge) neuron similarity search service.\n\n\n\n## Installation\n\nThis library is available [on PyPI](https://pypi.org/project/neuronbridge-python/), so you can install it like this:\n\n```bash\npip install neuronbridge-python\n```\n\n## Usage\n\nThe client will automatically select the latest version of the data and fetch it from S3. Here's a simple example of how to get an EM image by id:\n\n```python\nfrom neuronbridge import client\nclient = client.Client()\nem_image = client.get_em_image(636798093) \n```\n\nSee [this notebook](https://github.com/JaneliaSciComp/neuronbridge-python/blob/main/notebooks/python_api_examples.ipynb) for complete usage examples.\n\n## Development Notes\n\nTo build this code you will need to [install UV](https://docs.astral.sh/uv/getting-started/installation/).\n\nCreate a new UV virtual environment and install the dependencies:\n\n```bash\nuv venv --python 3.11\nsource .venv/bin/activate\nuv pip sync requirements-universal.txt\nuv pip install -e .\n```\n\n### Running data validation using Ray\n\nYou can run validation multithreaded on a single machine like this:\n\n```bash\n./neuronbridge/validate_ray.py --dashboard --cores 60\n```\n\nTo 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:\n\n```bash\n./scripts/launch_validation.sh\n```\n\n### Updating requirements\n\nAfter updating the requirements.txt file, you can sync the requirements-universal.txt file like this:\n\n```bash\nuv pip compile requirements.txt --universal --output-file requirements-universal.txt\n```\n\n### Regenerate the JSON schemas:\n\n```bash\npython neuronbridge/generate_schemas.py\n```\n\n### Run the unit tests:\n\n```bash\npixi run test\n```\n\n### Publishing a new release\n\n1) Update the version in setup.py\n2) Push all changes and tag a release in GitHub\n3) Build PyPI distribution:\n\n```bash\npixi run pypi-build\n```\n\n4) Upload to PyPI:\n\n```bash\npixi run pypi-upload\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Python API for NeuronBridge",
"version": "3.3.0",
"project_urls": {
"Homepage": "https://github.com/JaneliaSciComp/neuronbridge-python/"
},
"split_keywords": [
"neuroscience",
" neuron",
" similarity",
" search",
" api"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2532688cdba3d5176b50c6c365951f442bd04e68bf43904fcf91120dd942636a",
"md5": "d8a9b6b25003d481a764856d62ecdd3f",
"sha256": "eecca87809c1c744078d2b388dda40491cf1957651fbe513e0d6d7fe4bca38b1"
},
"downloads": -1,
"filename": "neuronbridge_python-3.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d8a9b6b25003d481a764856d62ecdd3f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 16917,
"upload_time": "2025-07-29T18:19:23",
"upload_time_iso_8601": "2025-07-29T18:19:23.382468Z",
"url": "https://files.pythonhosted.org/packages/25/32/688cdba3d5176b50c6c365951f442bd04e68bf43904fcf91120dd942636a/neuronbridge_python-3.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "58614d2025ef7d4f9c0c41900e6008a904df67af53fc1036c773af710a933354",
"md5": "4e9b0d5b8fb65fdee9728f7c8cbd6d86",
"sha256": "97a1ccb32a5e29cdb64234694d6a311510630341e45a19d002fa48266624f892"
},
"downloads": -1,
"filename": "neuronbridge_python-3.3.0.tar.gz",
"has_sig": false,
"md5_digest": "4e9b0d5b8fb65fdee9728f7c8cbd6d86",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 16501,
"upload_time": "2025-07-29T18:19:24",
"upload_time_iso_8601": "2025-07-29T18:19:24.207131Z",
"url": "https://files.pythonhosted.org/packages/58/61/4d2025ef7d4f9c0c41900e6008a904df67af53fc1036c773af710a933354/neuronbridge_python-3.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-29 18:19:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JaneliaSciComp",
"github_project": "neuronbridge-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "neuronbridge-python"
}