Skip to main content

Build status License Code coverage CodeQL PyPI

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

entitysdk-0.19.4.tar.gz (91.6 kB view details)

Uploaded Source

File details

Details for the file entitysdk-0.19.4.tar.gz.

File metadata

  • Download URL: entitysdk-0.19.4.tar.gz
  • Upload date:
  • Size: 91.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for entitysdk-0.19.4.tar.gz
Algorithm Hash digest
SHA256 e50e70e7e3b5128b3218b958a85309aaed952a3b78f2f0bc39af1fbb3d5a68e6
MD5 cb3813b92b3cd22118aa74436c25bdbe
BLAKE2b-256 c99b32f672e1c4061bf46f8eb6f5e0c1cd4fc2dcaa7ac5ad7e7f727a13d546ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for entitysdk-0.19.4.tar.gz:

Publisher: sdist.yml on openbraininstitute/entitysdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.19.19

1 file

0.19.18

1 file

0.19.17

1 file

0.19.16

1 file

0.19.15

1 file

0.19.14

1 file

0.19.13

1 file

0.19.12

1 file

0.19.11

1 file

0.19.10

1 file

0.19.9

1 file

0.19.8

1 file

0.19.7

1 file

0.19.6

1 file

0.19.5

1 file

This release

0.19.4 This release

1 file

0.19.3

1 file

0.19.2

1 file

0.19.1

1 file

0.19.0

1 file

0.18.0

1 file

0.17.2

1 file

0.17.1

1 file

0.17.0

1 file

0.16.1

1 file

0.16.0

1 file

0.15.9

1 file

0.15.8

1 file

0.15.7

1 file

0.15.6

1 file

0.15.5

1 file

0.15.4

1 file

0.15.3

1 file

0.15.2

1 file

0.15.1

1 file

0.15.0

1 file

0.14.5

1 file

0.14.4

1 file

0.14.3

1 file

0.14.2

1 file

0.14.1

1 file

0.14.0

1 file

0.13.3

1 file

0.13.2

1 file

0.13.1

1 file

0.13.0

1 file

0.12.4

1 file

0.12.3

1 file

0.12.2

1 file

0.12.1

1 file

0.12.0

1 file

0.11.4

1 file

0.11.3

1 file

0.11.2

1 file

0.11.1

1 file

0.11.0

1 file

0.10.8

1 file

0.10.7

1 file

0.10.6

1 file

0.10.5

1 file

0.10.4

1 file

0.10.3

1 file

0.10.2

1 file

0.10.1

1 file

0.10.0

1 file

0.9.1

1 file

0.9.0

1 file

0.8.7

1 file

0.8.6

1 file

0.8.5

1 file

0.8.4

1 file

0.8.3

1 file

0.8.2

1 file

0.8.1

1 file

0.8.0

1 file

0.7.11

1 file

0.7.10

1 file

0.7.9

1 file

0.7.8

1 file

0.7.7

1 file

0.7.6

1 file

0.7.5

1 file

0.7.4

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7.0

1 file

0.6.2

1 file

0.6.1

1 file

0.6.0

1 file

0.5.1

1 file

0.5.0

1 file

0.4.0

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.5

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page