Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ome-types: OME dataclasses for python

autogenerated dataclasses for a pythonic interface into the OME data model: http://www.openmicroscopy.org/Schemas/OME/2016-06

It converts the ome.xsd schema into a set of python dataclasses and types.

As an example, the OME/Image model will be rendered as the following dataclass in ome_types/model/image.py

from dataclasses import field
from datetime import datetime
from typing import List, Optional

from pydantic.dataclasses import dataclass

from .annotation_ref import AnnotationRef
from .experiment_ref import ExperimentRef
from .experimenter_group_ref import ExperimenterGroupRef
from .experimenter_ref import ExperimenterRef
from .imaging_environment import ImagingEnvironment
from .instrument_ref import InstrumentRef
from .microbeam_manipulation_ref import MicrobeamManipulationRef
from .objective_settings import ObjectiveSettings
from .pixels import Pixels
from .roi_ref import ROIRef
from .simple_types import ImageID
from .stage_label import StageLabel


@dataclass
class Image:
    id: ImageID
    pixels: Pixels
    acquisition_date: Optional[datetime] = None
    annotation_ref: List[AnnotationRef] = field(default_factory=list)
    description: Optional[str] = None
    experiment_ref: Optional[ExperimentRef] = None
    experimenter_group_ref: Optional[ExperimenterGroupRef] = None
    experimenter_ref: Optional[ExperimenterRef] = None
    imaging_environment: Optional[ImagingEnvironment] = None
    instrument_ref: Optional[InstrumentRef] = None
    microbeam_manipulation_ref: List[MicrobeamManipulationRef] = field(default_factory=list)
    name: Optional[str] = None
    objective_settings: Optional[ObjectiveSettings] = None
    roi_ref: List[ROIRef] = field(default_factory=list)
    stage_label: Optional[StageLabel] = None

ome_autogen.convert_schema(url, target) is the main function. It accepts an xsd file path (only test on an ome.xsd), and a target directory, and writes a human-readable module, that will validate OME XML, provide pythonic method naming, and provides full typing support for IDEs, etc...

Usage

The model is not checked into source, but it is included when you pip install the package (and it will be built automatically at ome_types/model if it doesn't exist the first time you import the package.)

from ome_types import OME  # the root class

# or specific objects
from ome_types.model import Image, Pixels, Plate  # etc...

There is a convenience function that accepts xml, and outputs a validated OME model (if it fails validation, an exception is raised):

from ome_types import from_xml

metadata = from_xml(xml)

where xml in that example can be a path to a file, a URI of a resource, an opened file-like object, an Element instance, an ElementTree instance, or a literal string containing the XML data.

Metadata

Release files for ome-types 0.0.1rc5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ome-types 0.0.1rc5
File Size Uploaded Provenance Actions
ome-types-0.0.1rc5.tar.gz 66.0 kB Without provenance Details for ome-types-0.0.1rc5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ome-types 0.0.1rc5
File Interpreter ABI Platform Actions
ome_types-0.0.1rc5-py3-none-any.whl Python 3 none any Details for ome_types-0.0.1rc5-py3-none-any.whl

Total release size: 124.8 kB

Release files / ome-types-0.0.1rc5.tar.gz

Download URL ome-types-0.0.1rc5.tar.gz
Size 66.0 kB
Tags Source
SHA-256 checksum
How to use checksums
483f351339f1cf8784fda9f74d159713fb449c0b617238dd2b4f66b34fad3843
BLAKE2b-256 checksum
How to use checksums
6e7e3bacfb37229a4740192be749c660c8d7d0b39cf6bb6a6191b8cbeb152acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / ome_types-0.0.1rc5-py3-none-any.whl

Download URL ome_types-0.0.1rc5-py3-none-any.whl
Size 58.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ade64b96c913a278ddfbc006a691184a45a314ea79d98578293a08e788abb823
BLAKE2b-256 checksum
How to use checksums
146e727e5673918ea5f729df76bf39baf94ab13d27153d682f39101d52c469c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Security for ome-types 0.0.1rc5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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