Skip to main content

Python client to interact with Cytomine.

Project description

Cytomine Python client

Cytomine-python-client is an open-source Cytomine client written in Python. This client is a Python wrapper around Cytomine REST API gateway.

GitHub release

Overview

All data available from the Cytomine graphical interface can be manipulated programmatically from your computer. This page introduces the key concepts on how to interact with Cytomine without this graphical interface. Cytomine is a RESTful application. It means that the data stored and managed by Cytomine can be obtained through specific URLs. Contrary to the graphical interface, these URLs only provide relevant information data. To ease interaction with Cytomine, the Cytomine API client for Python encapsulates all the technical details relative to the HTTP API so that you can manipulate Cytomine resources without complexity.

Requirements

  • Python >=3.10, <3.13

Installation

cytomine-python-client is available on PyPi using pip:

pip install cytomine-python-client

For versions lower than 2.3.4, refer to manual installation guide.

Usage

See detailed usage documentation for the complete documentation.

Basic example

Three parameters are required to connect:

  • HOST: The full URL of Cytomine core (e.g. “http://demo.cytomine.be”).
  • PUBLIC_KEY: Your cytomine public key.
  • PRIVATE_KEY: Your cytomine private key.

First, the connection object has to be initialised.

from cytomine import Cytomine

host = "demo.cytomine.be"
public_key = "XXX" # check your own keys from your account page in the web interface
private_key = "XXX"

cytomine = Cytomine.connect(host, public_key, private_key)

The next sample code should print “Hello {username}” where {username} is replaced by your Cytomine username and print the list of available projects.

from cytomine.models import ProjectCollection

print(f"Hello {cytomine.current_user}")
projects = ProjectCollection().fetch()
print(projects)
for project in projects:
    print(project)

Other examples

License

Apache-2.0

Project details


Download files

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

Source Distribution

cytomine_python_client-4.1.0.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cytomine_python_client-4.1.0-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

Details for the file cytomine_python_client-4.1.0.tar.gz.

File metadata

  • Download URL: cytomine_python_client-4.1.0.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cytomine_python_client-4.1.0.tar.gz
Algorithm Hash digest
SHA256 7eccab72a3b06ce6b5c943d76872c605064b8ad5d69368a1c4fc46affa0117ba
MD5 05bf52072e3877c52ffea946d22eeeba
BLAKE2b-256 31eb0b6855fd3ae421eb9c7ac9372c8c2e65445bca4aaa4e8be4b47495aa3fe1

See more details on using hashes here.

File details

Details for the file cytomine_python_client-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: cytomine_python_client-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cytomine_python_client-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb56fad3d9ef885196b2213508f5ea0ef79ec78bcadbe26d23d3abb8074ebc9b
MD5 d713bf2e01a78a81eca705bef48f43f5
BLAKE2b-256 4a5d18f127032d8c33a0f66b8133224c1c0449a89af7f1d9639455a33f00c48e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page