Skip to content

Commit c950afd

Browse files
Copilotbasejumpa
andcommitted
Create bodyloop-sdk project boilerplate
Co-authored-by: basejumpa <8762228+basejumpa@users.noreply.github.com>
1 parent a5d3d30 commit c950afd

File tree

10 files changed

+312
-0
lines changed

10 files changed

+312
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "bodyloop-sdk",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.12",
4+
"features": {
5+
"ghcr.io/astral-sh/uv/devcontainer-feature/uv:latest": {}
6+
},
7+
"postCreateCommand": "uv sync",
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-python.python",
12+
"ms-python.vscode-pylance",
13+
"GitHub.copilot",
14+
"GitHub.copilot-chat"
15+
],
16+
"settings": {
17+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
18+
"editor.formatOnSave": true,
19+
"[python]": {
20+
"editor.defaultFormatter": "ms-python.python"
21+
}
22+
}
23+
}
24+
}
25+
}

.github/copilot-instructions.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# GitHub Copilot Instructions
2+
3+
## Project Overview
4+
5+
`bodyloop-sdk` is a Python SDK for the BodyLoop API. It follows
6+
**Spec-Driven Development (SDD)**: write a clear docstring/spec first, then
7+
implement, then test.
8+
9+
## Spec-Driven Development Workflow
10+
11+
1. **Spec** – Write a detailed docstring describing the function/class contract
12+
(inputs, outputs, raised exceptions, edge cases) before any implementation.
13+
2. **Implement** – Ask Copilot to generate the implementation that satisfies the spec.
14+
3. **Test** – Ask Copilot to generate `pytest` tests covering the spec.
15+
4. **Review** – Verify Copilot output matches the spec; adjust as needed.
16+
17+
## Code Style
18+
19+
- Python ≥ 3.11; use type hints on all public APIs.
20+
- Keep the `src/bodyloop_sdk/` layout; add new modules inside that package.
21+
- Use `snake_case` for functions/variables, `PascalCase` for classes.
22+
- Keep public APIs small and composable; prefer pure functions.
23+
24+
## Testing
25+
26+
- All tests live in `tests/`; mirror the source module structure.
27+
- Every public function must have at least one happy-path test and one
28+
error/edge-case test.
29+
- Run tests with: `uv run pytest`
30+
31+
## Dependency Management
32+
33+
- Manage dependencies with `uv`; edit `pyproject.toml` directly.
34+
- Add runtime deps: `uv add <package>`
35+
- Add dev deps: `uv add --dev <package>`
36+
37+
## Release Process
38+
39+
- Bump `__version__` in `src/bodyloop_sdk/__init__.py`.
40+
- Create a GitHub release tagged `vX.Y.Z`.
41+
- The `release.yml` workflow will build and publish to PyPI automatically.

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: Test (Python ${{ matrix.python-version }})
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.11", "3.12", "3.13"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up uv
25+
uses: astral-sh/setup-uv@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: uv sync
31+
32+
- name: Run tests
33+
run: uv run pytest

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
id-token: write # required for PyPI trusted publishing
9+
10+
jobs:
11+
build:
12+
name: Build distribution
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up uv
19+
uses: astral-sh/setup-uv@v5
20+
21+
- name: Build package
22+
run: uv build
23+
24+
- name: Upload distribution artifacts
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: dist
28+
path: dist/
29+
30+
publish:
31+
name: Publish to PyPI
32+
runs-on: ubuntu-latest
33+
needs: build
34+
environment:
35+
name: pypi
36+
url: https://pypi.org/project/bodyloop-sdk/
37+
38+
steps:
39+
- name: Download distribution artifacts
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: dist
43+
path: dist/
44+
45+
- name: Publish to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*.pyo
5+
*.pyd
6+
.Python
7+
*.egg
8+
*.egg-info/
9+
dist/
10+
build/
11+
eggs/
12+
parts/
13+
var/
14+
sdist/
15+
develop-eggs/
16+
.installed.cfg
17+
lib/
18+
lib64/
19+
20+
# Virtual environments
21+
.venv/
22+
venv/
23+
ENV/
24+
25+
# uv
26+
.uv/
27+
28+
# pytest
29+
.pytest_cache/
30+
.coverage
31+
htmlcov/
32+
33+
# Editors
34+
.vscode/settings.json
35+
.idea/
36+
*.swp
37+
*.swo
38+
39+
# OS
40+
.DS_Store
41+
Thumbs.db

pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[project]
2+
name = "bodyloop-sdk"
3+
version = "0.1.0"
4+
description = "Python SDK for the BodyLoop API for seamless ecosystem integration"
5+
readme = "README.md"
6+
license = { file = "LICENSE" }
7+
requires-python = ">=3.11"
8+
dependencies = []
9+
10+
[project.urls]
11+
Homepage = "https://github.com/BodyLoop/bodyloop-pypi"
12+
Repository = "https://github.com/BodyLoop/bodyloop-pypi"
13+
Issues = "https://github.com/BodyLoop/bodyloop-pypi/issues"
14+
15+
[build-system]
16+
requires = ["hatchling"]
17+
build-backend = "hatchling.build"
18+
19+
[tool.hatch.build.targets.wheel]
20+
packages = ["src/bodyloop_sdk"]
21+
22+
[tool.pytest.ini_options]
23+
testpaths = ["tests"]
24+
25+
[dependency-groups]
26+
dev = [
27+
"pytest>=8.0.0",
28+
]

src/bodyloop_sdk/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""BodyLoop SDK – Python client for the BodyLoop API."""
2+
3+
__version__ = "0.1.0"

tests/__init__.py

Whitespace-only changes.

tests/test_bodyloop_sdk.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""Tests for the bodyloop_sdk package."""
2+
3+
import bodyloop_sdk
4+
5+
6+
def test_version_exists():
7+
"""The package exposes a __version__ string."""
8+
assert hasattr(bodyloop_sdk, "__version__")
9+
assert isinstance(bodyloop_sdk.__version__, str)
10+
11+
12+
def test_version_format():
13+
"""__version__ follows semver major.minor.patch format."""
14+
parts = bodyloop_sdk.__version__.split(".")
15+
assert len(parts) == 3
16+
assert all(part.isdigit() for part in parts)

uv.lock

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)