Metadata-Version: 2.5
Name: yousleep_common
Version: 31.0.0
Summary: YouSleep Common
Project-URL: Homepage, https://yousleep.ai
Project-URL: Source, https://github.com/yousleep-ai/common
Project-URL: Issues, https://github.com/yousleep-ai/common/issues
Author-email: Mathias Perslev <mp@yousleep.ai>
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: api-client,edf,eeg,polysomnography,sdk,sleep
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic[email]>=2.12.5
Requires-Dist: pyyaml>=6.0.3
Provides-Extra: docs-build
Requires-Dist: gitpython>=3.1.47; extra == 'docs-build'
Requires-Dist: mkdocs-gen-files>=0.6.0; extra == 'docs-build'
Provides-Extra: system
Requires-Dist: nvidia-ml-py>=13.590.44; extra == 'system'
Description-Content-Type: text/markdown

# yousleep-common

The [youSleep Portal](https://portal.yousleep.ai) for Python: a typed, asynchronous
client for the REST API, the models every request and response is made of, and
the tools an analysis container uses to read its manifest and write its result.

```bash
pip install yousleep-common
```

```python
from yousleep_common.client import AsyncClient
from yousleep_common.models import UserAuthentication

client = await AsyncClient.from_credentials(
    base_url="https://api.yousleep.ai",
    credentials=UserAuthentication(email="you@example.com", password="…"),
)
async with client:
    result = await client.workflows.analyze_file(
        file="night.edf", analysis_config_id="u-sleep-research-v2"
    )
    print(result.biomarkers.biomarkers.tst_min, len(result.events))
```

One call uploads the recording, submits the analysis, waits for it and returns
the events and statistics it produced. `analyze_files` does the same for a
batch, one outcome per file; the namespaced endpoints (`client.projects`,
`client.analyses`, …) are the same operations one level down.

**Documentation:** [docs.yousleep.ai](https://docs.yousleep.ai/)
carries the SDK guides, the generated API reference, and how to package an
analysis to run on the platform. The installed package resolves every
signature offline, so `help()` and an IDE work without it.

**Command line.** `yousleep-init` starts an analysis project that passes the
conformance check as generated, `yousleep-verify` runs that check on an image,
and `yousleep-manifest` writes the manifest a container reads for a hand run.

**Python 3.11 or later.** Every GitHub release also attaches the wheel as an
asset, the copy to install from when PyPI's index has not caught up.

**Research use.** youSleep is for research and other non-commercial use;
nothing here is a medical device.

Licensed under [Apache-2.0](LICENSE). Contact: [contact@yousleep.ai](mailto:contact@yousleep.ai).
