Skip to content

Commit b45b253

Browse files
committed
feat: initial import
0 parents  commit b45b253

File tree

9 files changed

+817
-0
lines changed

9 files changed

+817
-0
lines changed

.github/workflows/release.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution 📦
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
fetch-depth: 0
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v5
17+
with:
18+
enable-cache: true
19+
cache-dependency-glob: uv.lock
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version-file: ".python-version"
24+
- name: Build
25+
run: uv build
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
publish-to-pypi:
33+
name: >-
34+
Publish Python 🐍 distribution 📦 to PyPI
35+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
permissions:
42+
id-token: write
43+
steps:
44+
- name: Download all the dists
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: python-package-distributions
48+
path: dist/
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v5
51+
with:
52+
enable-cache: true
53+
cache-dependency-glob: uv.lock
54+
- name: Publish distribution 📦 to PyPI
55+
run: uv publish --trusted-publishing always --publish-url https://upload.pypi.org/legacy/
56+
57+
58+
github-release:
59+
name: >-
60+
Sign the Python 🐍 distribution 📦 with Sigstore
61+
and upload them to GitHub Release
62+
needs:
63+
- publish-to-pypi
64+
runs-on: ubuntu-latest
65+
66+
permissions:
67+
contents: write # IMPORTANT: mandatory for making GitHub Releases
68+
id-token: write # IMPORTANT: mandatory for sigstore
69+
70+
steps:
71+
- name: Download all the dists
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: python-package-distributions
75+
path: dist/
76+
- name: Sign the dists with Sigstore
77+
uses: sigstore/gh-action-sigstore-python@v3.0.0
78+
with:
79+
inputs: >-
80+
./dist/*.tar.gz
81+
./dist/*.whl
82+
- name: Create GitHub Release
83+
env:
84+
GITHUB_TOKEN: ${{ github.token }}
85+
run: >-
86+
gh release create
87+
"$GITHUB_REF_NAME"
88+
--repo "$GITHUB_REPOSITORY"
89+
--notes ""
90+
- name: Upload artifact signatures to GitHub Release
91+
env:
92+
GITHUB_TOKEN: ${{ github.token }}
93+
# Upload to GitHub Release using the `gh` CLI.
94+
# `dist/` contains the built packages, and the
95+
# sigstore-produced signatures and certificates.
96+
run: >-
97+
gh release upload
98+
"$GITHUB_REF_NAME" dist/**
99+
--repo "$GITHUB_REPOSITORY"

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## Version 0.1.0a0 (2025-03-05)
4+
5+
- *Hello world!*

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<p align="center">
2+
<a href="https://pyannote.ai/" target="blank"><img src="https://avatars.githubusercontent.com/u/162698670" width="64" /></a>
3+
</p>
4+
5+
<div align="center">
6+
<h1>Official Python `pyannoteAI` SDK </h1>
7+
</div>
8+
9+
10+
## Installation
11+
12+
```bash
13+
$ pip install pyannoteAI
14+
```
15+
16+
Then head over to [`dashboard.pyannote.ai`](https://dashboard.pyannote.ai) and create an API key.
17+
18+
## Speaker diarization
19+
20+
```python
21+
# instantiate client
22+
from pyannoteai import Client
23+
client = Client("your-api-key")
24+
25+
# upload conversation file
26+
media_url = client.upload('/path/to/conversation.wav')
27+
# submit a diarization job
28+
job_id = client.diarize(media_url)
29+
# retrieve diarization
30+
diarization = client.retrieve(job_id)
31+
# diarization['output']['diarization'] contains diarization output
32+
```
33+
34+
Use `help(client.diarize)` to learn about options.
35+
36+
## Speaker identification
37+
38+
```python
39+
# create a voiceprint from a sample of Lex's voice
40+
lex_url = client.upload('/path/to/lex.wav')
41+
job_id = client.voiceprint(lex_url)
42+
lex = client.retrieve(job_id)
43+
# lex['output']['voiceprint'] contains Lex's voiceprint
44+
45+
# create a voiceprint from a sample of Mark's voice
46+
mark_url = client.upload('/path/to/mark.wav')
47+
job_id = client.voiceprint(mark_url)
48+
mark = client.retrieve(job_id)
49+
# mark['output']['voiceprint'] contains Mark's voiceprint
50+
51+
# use those voiceprints to track Lex and Mark in the conversation
52+
voiceprints = {'lex': lex['output']['voiceprint'], 'mark': mark['output']['voiceprint']}
53+
job_id = client.identify('/path/to/conversation.wav', voiceprints)
54+
identification = client.retrieve(job_id)
55+
# identification['output']['identification'] contains identification output
56+
```
57+
58+
Use `help(client.identify)` to learn about options.

pyproject.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[project]
2+
name = "pyannoteAI"
3+
description = "Official pyannoteAI Python SDK"
4+
readme = "README.md"
5+
authors = [
6+
{ name = "Hervé BREDIN", email = "herve@pyannote.ai" }
7+
]
8+
requires-python = ">=3.10"
9+
10+
dynamic = [
11+
"version",
12+
]
13+
14+
dependencies = [
15+
"requests>=2.32.3",
16+
]
17+
18+
[build-system]
19+
requires = ["hatchling", "hatch-vcs"]
20+
build-backend = "hatchling.build"
21+
22+
[tool.hatch.version]
23+
source = "vcs"

src/pyannoteai/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .client import Client
2+
3+
__all__ = ['Client']

0 commit comments

Comments
 (0)