sleap-share 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sleap_share/__init__.py +302 -0
- sleap_share/auth.py +330 -0
- sleap_share/cli.py +462 -0
- sleap_share/client.py +677 -0
- sleap_share/config.py +103 -0
- sleap_share/exceptions.py +127 -0
- sleap_share/models.py +293 -0
- sleap_share-0.1.2.dist-info/METADATA +204 -0
- sleap_share-0.1.2.dist-info/RECORD +11 -0
- sleap_share-0.1.2.dist-info/WHEEL +4 -0
- sleap_share-0.1.2.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sleap-share
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Python client for SLEAP Share - upload and share SLEAP datasets
|
|
5
|
+
Project-URL: Homepage, https://slp.sh
|
|
6
|
+
Project-URL: Documentation, https://github.com/talmolab/sleap-share
|
|
7
|
+
Project-URL: Repository, https://github.com/talmolab/sleap-share
|
|
8
|
+
Project-URL: Issues, https://github.com/talmolab/sleap-share/issues
|
|
9
|
+
Author-email: Talmo Pereira <talmo@salk.edu>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
Keywords: cli,data-sharing,pose-estimation,sleap
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: httpx>=0.25.0
|
|
24
|
+
Requires-Dist: platformdirs>=4.0.0
|
|
25
|
+
Requires-Dist: rich>=13.0.0
|
|
26
|
+
Requires-Dist: typer>=0.9.0
|
|
27
|
+
Provides-Extra: all
|
|
28
|
+
Requires-Dist: fsspec>=2024.0.0; extra == 'all'
|
|
29
|
+
Requires-Dist: keyring>=25.0.0; extra == 'all'
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
36
|
+
Provides-Extra: keyring
|
|
37
|
+
Requires-Dist: keyring>=25.0.0; extra == 'keyring'
|
|
38
|
+
Provides-Extra: lazy
|
|
39
|
+
Requires-Dist: fsspec>=2024.0.0; extra == 'lazy'
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# sleap-share
|
|
43
|
+
|
|
44
|
+
Python client for [SLEAP Share](https://slp.sh) - upload and share SLEAP datasets.
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install sleap-share
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or use with `uvx` for one-off commands:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uvx sleap-share upload labels.slp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Quick Start
|
|
59
|
+
|
|
60
|
+
### Command Line
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Upload a file (no account needed)
|
|
64
|
+
sleap-share upload labels.slp
|
|
65
|
+
# → https://slp.sh/aBcDeF
|
|
66
|
+
|
|
67
|
+
# Download a file
|
|
68
|
+
sleap-share download aBcDeF
|
|
69
|
+
|
|
70
|
+
# Get file info
|
|
71
|
+
sleap-share info aBcDeF
|
|
72
|
+
|
|
73
|
+
# Authenticate for more features
|
|
74
|
+
sleap-share login
|
|
75
|
+
|
|
76
|
+
# List your uploads
|
|
77
|
+
sleap-share list
|
|
78
|
+
|
|
79
|
+
# Delete a file
|
|
80
|
+
sleap-share delete aBcDeF
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Python API
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import sleap_share
|
|
87
|
+
|
|
88
|
+
# Upload (anonymous)
|
|
89
|
+
result = sleap_share.upload("labels.slp")
|
|
90
|
+
print(result.share_url) # https://slp.sh/aBcDeF
|
|
91
|
+
|
|
92
|
+
# Download
|
|
93
|
+
sleap_share.download("aBcDeF", output="./data/")
|
|
94
|
+
|
|
95
|
+
# Get metadata
|
|
96
|
+
metadata = sleap_share.get_metadata("aBcDeF")
|
|
97
|
+
print(f"Labeled frames: {metadata.labeled_frames_count}")
|
|
98
|
+
|
|
99
|
+
# Lazy loading (stream data on-demand without full download)
|
|
100
|
+
import sleap_io
|
|
101
|
+
url = sleap_share.open("aBcDeF")
|
|
102
|
+
labels = sleap_io.load_slp(url) # Only fetches accessed data!
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Authenticated Operations
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# Use stored credentials from `sleap-share login`
|
|
109
|
+
client = sleap_share.Client()
|
|
110
|
+
|
|
111
|
+
# Or provide token directly
|
|
112
|
+
client = sleap_share.Client(token="slpsh_live_...")
|
|
113
|
+
|
|
114
|
+
# List your files
|
|
115
|
+
files = client.list_files()
|
|
116
|
+
|
|
117
|
+
# Delete a file
|
|
118
|
+
client.delete("aBcDeF")
|
|
119
|
+
|
|
120
|
+
# Get user info
|
|
121
|
+
user = client.whoami()
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## CLI Commands
|
|
125
|
+
|
|
126
|
+
| Command | Description |
|
|
127
|
+
|---------|-------------|
|
|
128
|
+
| `login` | Authenticate via browser |
|
|
129
|
+
| `logout` | Clear stored credentials |
|
|
130
|
+
| `whoami` | Show current user |
|
|
131
|
+
| `upload <file>` | Upload a .slp file |
|
|
132
|
+
| `download <id>` | Download a file |
|
|
133
|
+
| `list` | List your uploads |
|
|
134
|
+
| `info <id>` | Show file metadata |
|
|
135
|
+
| `preview <id>` | Download preview image |
|
|
136
|
+
| `delete <id>` | Delete a file |
|
|
137
|
+
| `version` | Show version |
|
|
138
|
+
|
|
139
|
+
### Global Options
|
|
140
|
+
|
|
141
|
+
- `--env staging` - Target staging environment instead of production
|
|
142
|
+
- `--help` - Show help for any command
|
|
143
|
+
|
|
144
|
+
## Environment Variables
|
|
145
|
+
|
|
146
|
+
- `SLEAP_SHARE_ENV` - Default environment (`production` or `staging`)
|
|
147
|
+
|
|
148
|
+
## Token Storage
|
|
149
|
+
|
|
150
|
+
Credentials are stored securely using:
|
|
151
|
+
1. System keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service)
|
|
152
|
+
2. Fallback: `~/.config/sleap-share/credentials` with `0600` permissions
|
|
153
|
+
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
cd client
|
|
158
|
+
|
|
159
|
+
# Install dependencies
|
|
160
|
+
uv sync --all-extras
|
|
161
|
+
|
|
162
|
+
# Run tests
|
|
163
|
+
uv run pytest
|
|
164
|
+
|
|
165
|
+
# Lint and format
|
|
166
|
+
uv run ruff check .
|
|
167
|
+
uv run ruff format .
|
|
168
|
+
|
|
169
|
+
# Type check
|
|
170
|
+
uv run mypy src/sleap_share
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Releasing
|
|
174
|
+
|
|
175
|
+
New versions are published to PyPI via GitHub Releases.
|
|
176
|
+
|
|
177
|
+
### Steps to Release
|
|
178
|
+
|
|
179
|
+
1. **Update version** in `pyproject.toml` and `src/sleap_share/__init__.py`
|
|
180
|
+
|
|
181
|
+
2. **Update CHANGELOG.md** with the new version and release notes
|
|
182
|
+
|
|
183
|
+
3. **Create a GitHub Release:**
|
|
184
|
+
- Go to [Releases](https://github.com/talmolab/sleap-share/releases/new)
|
|
185
|
+
- **Tag:** `client-v{version}` (e.g., `client-v0.2.0`)
|
|
186
|
+
- **Title:** `Python Client v{version}`
|
|
187
|
+
- **Description:** Copy from CHANGELOG.md
|
|
188
|
+
- Click **Publish release**
|
|
189
|
+
|
|
190
|
+
4. The GitHub Action will automatically:
|
|
191
|
+
- Run tests on Python 3.9-3.13
|
|
192
|
+
- Run linting and type checks
|
|
193
|
+
- Build the package
|
|
194
|
+
- Publish to PyPI via OIDC trusted publishing
|
|
195
|
+
|
|
196
|
+
### Version Scheme
|
|
197
|
+
|
|
198
|
+
Tags must start with `client-v` to trigger publishing (e.g., `client-v0.1.0`, `client-v1.0.0`).
|
|
199
|
+
|
|
200
|
+
This prefix distinguishes Python client releases from other releases in the monorepo.
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT License - see [LICENSE](../LICENSE) for details.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
sleap_share/__init__.py,sha256=8cSqjeM_pvWuChEU8D2ft0fxzx58ZRGHYoX0Nq6Hj6U,7777
|
|
2
|
+
sleap_share/auth.py,sha256=FMHQUehbH70lJkgW1AOpn9QaJ1PWQwjsEpZkvBiGZfM,9027
|
|
3
|
+
sleap_share/cli.py,sha256=y2ksttPOMSWnTbdS8fmfUfXXVEGCroR6dVjMJrzULJY,14736
|
|
4
|
+
sleap_share/client.py,sha256=lK9VbsTqW1A2zYb1bEPwi-EXOAAXMtaAnSEndzSvxxM,22608
|
|
5
|
+
sleap_share/config.py,sha256=xB1Kq2nuMK2LGOdhKNWP9MXjkzpN_fzc1NSp0H9S7ZE,2838
|
|
6
|
+
sleap_share/exceptions.py,sha256=FgvEVXVg2oOyw7_p2MIv0hl_IM8oiaN_NFT-w78wKOY,3542
|
|
7
|
+
sleap_share/models.py,sha256=vMZWUlpQLCHwZapewkhzoFDhcOz-A96tFPkNb7VqJ8Q,9868
|
|
8
|
+
sleap_share-0.1.2.dist-info/METADATA,sha256=bIFQboObP9uzJXsgn7W_29xvF4zx5AYglBpDVlO36zo,5172
|
|
9
|
+
sleap_share-0.1.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
10
|
+
sleap_share-0.1.2.dist-info/entry_points.txt,sha256=WuUXF_ot7zCvjYZklS_BXd871gRi-Q86xXpyIrRJJ6Y,52
|
|
11
|
+
sleap_share-0.1.2.dist-info/RECORD,,
|