{"id":2208,"library":"pyannote-core","title":"pyannote-core","description":"pyannote.core is an open-source Python library providing advanced data structures for handling temporal segments with attached labels. It serves as the foundational component for the broader pyannote ecosystem, which includes libraries for parsing, metrics, databases, audio, and video processing. The library facilitates the manipulation and visualization of temporal data, especially useful in speech processing and diarization tasks. The current version is 6.0.1, part of an actively developed project with a history of significant updates and breaking changes between major releases.","status":"active","version":"6.0.1","language":"en","source_language":"en","source_url":"https://github.com/pyannote/pyannote-core","tags":["audio processing","speech","temporal data","annotation","diarization","data structures","signal processing"],"install":[{"cmd":"pip install pyannote-core","lang":"bash","label":"Core library"},{"cmd":"pip install pyannote-core[notebook]","lang":"bash","label":"With Jupyter notebook visualization support"}],"dependencies":[{"reason":"Fundamental array manipulation.","package":"numpy","optional":false},{"reason":"Data manipulation and DataFrame integration.","package":"pandas","optional":false},{"reason":"Efficient sorted container implementations.","package":"sortedcontainers","optional":false},{"reason":"For rich display in Jupyter notebooks.","package":"ipython","optional":true},{"reason":"For plotting and visualization in notebooks.","package":"matplotlib","optional":true}],"imports":[{"symbol":"Segment","correct":"from pyannote.core import Segment"},{"symbol":"Timeline","correct":"from pyannote.core import Timeline"},{"symbol":"Annotation","correct":"from pyannote.core import Annotation"},{"symbol":"SlidingWindow","correct":"from pyannote.core import SlidingWindow"},{"symbol":"SlidingWindowFeature","correct":"from pyannote.core import SlidingWindowFeature"}],"quickstart":{"code":"from pyannote.core import Segment, Timeline, Annotation\n\n# 1. Create a Segment (start, end)\ns1 = Segment(0.0, 10.0)\ns2 = Segment(12.5, 15.0)\nprint(f\"Segment 1: {s1}\")\nprint(f\"Duration of s1: {s1.duration:.1f}s\\n\")\n\n# 2. Create a Timeline (ordered set of non-empty segments)\ntimeline = Timeline([s1, s2, Segment(1.0, 5.0)], uri=\"meeting_audio\")\nprint(f\"Initial Timeline: {timeline}\")\ntimeline = timeline.support()\nprint(f\"Unified Timeline support: {timeline}\\n\")\n\n# 3. Create an Annotation (segments with attached labels/tracks)\nannotation = Annotation(uri=\"meeting_audio\")\nannotation[Segment(0.5, 3.0)] = \"Speaker_A\"\nannotation[Segment(2.0, 4.5)] = \"Speaker_B\"\nannotation[Segment(5.0, 7.0), \"music\"] = \"Background_Music\"\nprint(f\"Annotation labels: {annotation.labels()}\")\nprint(f\"Annotation timeline for Speaker_A: {annotation.label_timeline('Speaker_A')}\")\n","lang":"python","description":"This quickstart demonstrates the creation and basic manipulation of the core data structures: Segment, Timeline, and Annotation. It shows how to define temporal intervals, combine them into an ordered set, and attach labels to segments."},"warnings":[{"fix":"Upgrade Python to 3.10 or newer. Check `pyproject.toml` or official documentation for precise import paths, especially if upgrading from very old versions.","message":"Version 6.0.0 introduced breaking changes, including dropping support for Python versions older than 3.10 and switching to a native namespace package structure. Ensure your environment meets the new Python requirement and update import mechanisms if relying on non-standard package structures.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Migrate away from `pyannote.core.Scores`. Consult `pyannote.core` documentation for alternative approaches to score representation, such as `SlidingWindowFeature`.","message":"The `pyannote.core.Scores` class and related functionalities were removed in version 3.3. If your code depends on `pyannote.core.Scores` for handling scores over time, you will need to refactor it, potentially using `pyannote.core.SlidingWindowFeature` or custom data structures.","severity":"breaking","affected_versions":">=3.3, confirmed for 6.x compatibility"},{"fix":"Ensure all segments passed to `Timeline` constructors are non-empty. Update logic that checks the extent of potentially empty timelines to expect `Segment(0.0, 0.0)`.","message":"As of version 4.4, `Timeline.__init__` no longer accepts empty segments (where `start >= end`). Additionally, `Timeline.extent()` now returns `Segment(0.0, 0.0)` for empty timelines, affecting how edge cases for empty data are handled.","severity":"breaking","affected_versions":">=4.4"},{"fix":"Add `Segment.set_precision(ndigits)` (e.g., `Segment.set_precision(5)`) early in your script or module after importing `Segment`.","message":"Floating-point precision issues can lead to inconsistencies when comparing `Segment` instances. It is highly recommended to call `Segment.set_precision(ndigits)` once after importing `pyannote.core.Segment` to globally round start and end timestamps to a consistent precision.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}