Skip to main content

Python client for SLEAP Share - upload and share SLEAP datasets

Project description

sleap-share

Python client for SLEAP Share - upload and share SLEAP datasets.

Installation

pip install sleap-share

Or use with uvx for one-off commands:

uvx sleap-share upload labels.slp

Quick Start

Command Line

# Upload a file (no account needed)
sleap-share upload labels.slp
# → https://slp.sh/aBcDeF

# Download a file
sleap-share download aBcDeF

# Get file info
sleap-share info aBcDeF

# Authenticate for more features
sleap-share login

# List your uploads
sleap-share list

# Delete a file
sleap-share delete aBcDeF

Python API

import sleap_share

# Upload (anonymous)
result = sleap_share.upload("labels.slp")
print(result.share_url)  # https://slp.sh/aBcDeF

# Download
sleap_share.download("aBcDeF", output="./data/")

# Get metadata
metadata = sleap_share.get_metadata("aBcDeF")
print(f"Labeled frames: {metadata.labeled_frames_count}")

# Lazy loading (stream data on-demand without full download)
import sleap_io
url = sleap_share.open("aBcDeF")
labels = sleap_io.load_slp(url)  # Only fetches accessed data!

Authenticated Operations

# Use stored credentials from `sleap-share login`
client = sleap_share.Client()

# Or provide token directly
client = sleap_share.Client(token="slpsh_live_...")

# List your files
files = client.list_files()

# Delete a file
client.delete("aBcDeF")

# Get user info
user = client.whoami()

CLI Commands

Command Description
login Authenticate via browser
logout Clear stored credentials
whoami Show current user
upload <file> Upload a .slp file
download <id> Download a file
list List your uploads
info <id> Show file metadata
preview <id> Download preview image
delete <id> Delete a file
version Show version

Global Options

  • --env staging - Target staging environment instead of production
  • --help - Show help for any command

Environment Variables

  • SLEAP_SHARE_ENV - Default environment (production or staging)

Token Storage

Credentials are stored securely using:

  1. System keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service)
  2. Fallback: ~/.config/sleap-share/credentials with 0600 permissions

Development

cd client

# Install dependencies
uv sync --all-extras

# Run tests
uv run pytest

# Lint and format
uv run ruff check .
uv run ruff format .

# Type check
uv run mypy src/sleap_share

Releasing

New versions are published to PyPI via GitHub Releases.

Steps to Release

  1. Update version in pyproject.toml and src/sleap_share/__init__.py

  2. Update CHANGELOG.md with the new version and release notes

  3. Create a GitHub Release:

    • Go to Releases
    • Tag: client-v{version} (e.g., client-v0.2.0)
    • Title: Python Client v{version}
    • Description: Copy from CHANGELOG.md
    • Click Publish release
  4. The GitHub Action will automatically:

    • Run tests on Python 3.9-3.13
    • Run linting and type checks
    • Build the package
    • Publish to PyPI via OIDC trusted publishing

Version Scheme

Tags must start with client-v to trigger publishing (e.g., client-v0.1.0, client-v1.0.0).

This prefix distinguishes Python client releases from other releases in the monorepo.

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sleap_share-0.1.2.tar.gz (69.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sleap_share-0.1.2-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file sleap_share-0.1.2.tar.gz.

File metadata

  • Download URL: sleap_share-0.1.2.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sleap_share-0.1.2.tar.gz
Algorithm Hash digest
SHA256 200277ab6e4feaa94a9c1ccf264e45e30a7d766448b4ff87f4fd4e5ed82a751f
MD5 c85c7075f318888877a5ac1b35591a1b
BLAKE2b-256 37160dcf90129a0665941d144bbee7d4f1950491f34a6db3ffd9ff477850b2be

See more details on using hashes here.

File details

Details for the file sleap_share-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: sleap_share-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sleap_share-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a987ffa087a5c63ad8ca99c3b0f70356fcaea78833f4ee10ba574226b5847b6
MD5 a66d2f3edace0f0a7cffd3dfce39284d
BLAKE2b-256 224b2002a6aeebcbf2132b65772163fa023236ea09c236afb4b0c78278c447c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page