Metadata-Version: 2.4
Name: bodyloop-sdk
Version: 2026.5.12.3
Summary: Python SDK for the BodyLoop API for seamless ecosystem integration
Project-URL: Homepage, https://github.com/BodyLoop/bodyloop-pypi
Project-URL: Repository, https://github.com/BodyLoop/bodyloop-pypi
Project-URL: Issues, https://github.com/BodyLoop/bodyloop-pypi/issues
License: MIT License
        
        Copyright (c) 2026 BodyLoop
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: attrs>=25.4.0
Requires-Dist: dotenv>=0.9.9
Requires-Dist: httpx>=0.28.1
Requires-Dist: python-dateutil>=2.9.0.post0
Description-Content-Type: text/markdown

# BodyLoop SDK for Python

Python SDK for the BodyLoop API for seamless ecosystem integration

The URL of the source repository <https://github.com/bodyloop/bodyloop-sdk-python> has suffix `python` to enable adding SDKs for other lanuages such as JavaScript/TypeScript, C/C++, Rust, etc.

The distribution name (install) of the Python Package name is `bodyloop-sdk` and is available in the global Package Index PyPi at <https://pypi.org/project/bodyloop-sdk>. It omits the suffix since PyPi already tells us that we are in the Python ecosystem.

Examples how to get the package are:

```bash
pip install bodyloop-sdk

poetry add bodyloop-sdk

uv add bodyloop-sdk

pipx install bodyloop-sdk

uv tool install bodyloop-sdk
```

The top-level import of the package is the Python module `bodyloop`.

Usage:

```python
from bodyloop_sdk.client import AuthenticatedClient

base_url = "https://bodyloop-control-pc"
api_token = "<YOUR_API_TOKEN_HERE>"

# Create Auth Client with Access Token
client = AuthenticatedClient(
    base_url=base_url,
    verify_ssl=False,
    token=api_token,
    timeout=10.0
)

from functools import partial
from bodyloop_sdk.client.api.probands import get_probands_api_v2_probands_get

get_probands = partial(get_probands_api_v2_probands_get.sync_detailed, client=client)
probands_response = get_probands()

print(probands_response.status_code)
```

## Contribute

Local workflow

```bash
git clone git@github.com:BodyLoop/bodyloop-sdk-python.git
cd bodyloop-sdk-python

uv sync
uv run pytest
uv build
```

## Working on both bodyloop-sdk and another project

In the project which depends on the bodyloop-sdk-python, you can install the SDK in editable mode. This allows you to work on both projects simultaneously without needing to publish the SDK to PyPI.

There you do (assumed that the bodyloop-sdk-python is located at `/d/github/bodyloop/bodyloop-sdk-python`):

```bash
uv sync --no-install-project  --inexact

uv pip install -e /d/github/bodyloop/bodyloop-sdk-python

uv run --no-sync python some_script.py
```

Mind the `--no-sync` flag in the last command, which prevents the SDK from being reinstalled from PyPi.

## Release Procedure

The release / publish workflow is defined as:

- Push to the `main` branch
- Create a new tag `vYYYY.MM.DD.r` where `YYYY.MM.DD` is the current date and `r` is the sequential release number we increment over all releases, independent of the date and push the tag as well.
- Create a new GitHub release based on that tag, baptize the release identical to the tag and add release notes.
- Triggered by the release creation the GitHub Action `publish.yml` will build the package and publish it to PyPi.

Update the API client

The API generator <https://pypi.org/project/openapi-python-client/> is used.

```bash
./generate_api_client.sh <ip_or_hostname_of_my_bodyloop_instance>
```

Use the experiments to get your feet wet:

```bash
touch .env
echo "BODYLOOP_BASE_URL='https://bodyloop-control-pc'" >> .env
echo "BODYLOOP_API_TOKEN='your_api_token_here'" >> .env

uv run experiments/a_create_client.py
uv run experiments/b_load_probands.py
```

### Actions

- Make sure that you are on the `main` branch and that all changes are committed and pushed.
- Create a new tag `vYYYY.MM.DD.r` where `YYYY.MM.DD` is the current date and `r` is the sequential release number we increment over all releases, independent of the date and push the tag as well.

```bash
git checkout main
git pull origin main

git tag | tail -1

git tag v2026.04.13.2
git push --tags
```

- Create a new GitHub release based on that tag, baptize the release identical to the tag and add release notes. You can use the web frontend or the GitHub CLI:

```bash
gh release create v2026.04.13.2 --title "v2026.04.13.2" --notes "Release notes here"
```

## License

See [LICENSE](LICENSE)
