entitysdk
entitysdk is a Python library for interacting with the entitycore service, providing a type-safe and intuitive interface for managing scientific entities, and their associated assets.
Requirements
- Python 3.11 or higher
- Network access to entitycore service endpoints
Installation
pip install entitysdk
Obtaining a valid access token
An access token can be retrieved easily using the obi-auth helper library.
pip install obi-auth
from obi_auth import get_token
token = get_token(environment="staging")
Quick Start
from uuid import UUID
from entitysdk import Client, ProjectContext, models
# Initialize client
client = Client(
project_context=ProjectContext(
project_id=UUID("your-project-id"),
virtual_lab_id=UUID("your-lab-id")
),
environment="staging",
token_manager=token
)
# Search for morphologies
iterator = client.search_entity(
entity_type=models.CellMorphology,
query={"mtype__pref_label": "L5_TPC:A"},
limit=1,
)
morphology = next(iterator)
# Upload an asset
client.upload_file(
entity_id=morphology.id,
entity_type=models.CellMorphology,
file_path="path/to/file.swc",
file_content_type="application/swc",
)
Authentication
- Valid Keycloak access token
- Project context with:
- Valid project ID (UUID)
- Valid virtual lab ID (UUID)
Example configuration:
from uuid import UUID
from entitysdk import ProjectContext
project_context = ProjectContext(
project_id=UUID("12345678-1234-1234-1234-123456789012"),
virtual_lab_id=UUID("87654321-4321-4321-4321-210987654321")
)
Development
Requirements
- tox/tox-uv
Clone and run tests
# Clone the repository
git clone https://github.com/your-org/entitysdk.git
# Run linting, tests, and check-packaging
tox
Auto-generate server schemas
Server schemas at src/entitysdk/_server_schemas.py, which are currently used for importing enum types, can be updated with the following tox command:
tox -e generate-server-schemas
Auto-update json payloads
The json payloads in tests/unit/models/data/extracted can be automatically updated from entitycore by executing:
tox -e update-traces
The command will checkout a clean copy of entitycore, execute tests, extract the traces, and move them to the expected location in entitysdk.
It's possible to set a different ENTITYCORE_BRANCH_OR_TAG and ENTITYCORE_CHECKOUT_DIR if desired.
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
Copyright (c) 2025 Open Brain Institute
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Release files for entitysdk 0.19.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| entitysdk-0.19.21.tar.gz | 96.7 kB | Details |
Release files / entitysdk-0.19.21.tar.gz
| Download URL | entitysdk-0.19.21.tar.gz |
|---|---|
| Size | 96.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5484d93b75d8e7950e98501f10f7de34bbc949313b1020ce39edd0db5b3dad7
|
|
BLAKE2b-256 checksum How to use checksums |
d0833862f4d5eac8bda6c52b7d5e522fbf14e994b3015d20df86c3cd3db5ae6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log