unitlab 2.3.48__tar.gz → 2.4.0__tar.gz
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.
- unitlab-2.4.0/.claude/settings.local.json +38 -0
- unitlab-2.4.0/.gitignore +165 -0
- unitlab-2.4.0/PKG-INFO +204 -0
- unitlab-2.4.0/QUICKSTART.MD +24 -0
- unitlab-2.4.0/README.md +167 -0
- unitlab-2.4.0/assets/logo.png +0 -0
- unitlab-2.4.0/assets/unitlabDoc.png +0 -0
- unitlab-2.4.0/pyproject.toml +67 -0
- unitlab-2.4.0/src/unitlab/__init__.py +7 -0
- unitlab-2.4.0/src/unitlab/__main__.py +3 -0
- unitlab-2.4.0/src/unitlab/_config.py +52 -0
- unitlab-2.3.48/src/unitlab/main.py → unitlab-2.4.0/src/unitlab/cli.py +29 -16
- {unitlab-2.3.48 → unitlab-2.4.0}/src/unitlab/client.py +149 -66
- {unitlab-2.3.48 → unitlab-2.4.0}/src/unitlab/exceptions.py +16 -12
- unitlab-2.3.48/PKG-INFO +0 -31
- unitlab-2.3.48/README.md +0 -36
- unitlab-2.3.48/setup.cfg +0 -8
- unitlab-2.3.48/setup.py +0 -36
- unitlab-2.3.48/src/unitlab/__init__.py +0 -11
- unitlab-2.3.48/src/unitlab/__main__.py +0 -3
- unitlab-2.3.48/src/unitlab/utils.py +0 -65
- unitlab-2.3.48/src/unitlab.egg-info/PKG-INFO +0 -31
- unitlab-2.3.48/src/unitlab.egg-info/SOURCES.txt +0 -16
- unitlab-2.3.48/src/unitlab.egg-info/dependency_links.txt +0 -1
- unitlab-2.3.48/src/unitlab.egg-info/entry_points.txt +0 -2
- unitlab-2.3.48/src/unitlab.egg-info/requires.txt +0 -6
- unitlab-2.3.48/src/unitlab.egg-info/top_level.txt +0 -1
- {unitlab-2.3.48 → unitlab-2.4.0}/LICENSE.md +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(pip install:*)",
|
|
5
|
+
"Bash(unitlab configure:*)",
|
|
6
|
+
"Bash(python -m build:*)",
|
|
7
|
+
"Bash(twine upload:*)",
|
|
8
|
+
"Bash(git log:*)",
|
|
9
|
+
"Bash(make fmt:*)",
|
|
10
|
+
"Bash(make lint:*)",
|
|
11
|
+
"Bash(make test:*)",
|
|
12
|
+
"Bash(twine check:*)",
|
|
13
|
+
"Bash(unitlab project upload:*)",
|
|
14
|
+
"Bash(unitlab dataset download:*)",
|
|
15
|
+
"Bash(unitlab project members:*)",
|
|
16
|
+
"Bash(unitlab dataset list:*)",
|
|
17
|
+
"Bash(make check:*)",
|
|
18
|
+
"Bash(sudo add-apt-repository:*)",
|
|
19
|
+
"Bash(uv python install:*)",
|
|
20
|
+
"Bash(uv run:*)",
|
|
21
|
+
"Bash(for ver in 3.10 3.11 3.12 3.13)",
|
|
22
|
+
"Bash(do echo \"=== Python $ver ===\")",
|
|
23
|
+
"Bash(unitlab --help:*)",
|
|
24
|
+
"Bash(unitlab project --help:*)",
|
|
25
|
+
"Bash(unitlab dataset --help:*)",
|
|
26
|
+
"Bash(uv pip install:*)",
|
|
27
|
+
"Bash(UNITLAB_API_KEY=test-key python:*)",
|
|
28
|
+
"Bash(pip show:*)",
|
|
29
|
+
"Bash(git add:*)",
|
|
30
|
+
"Bash(git commit:*)",
|
|
31
|
+
"Bash(git branch:*)",
|
|
32
|
+
"Bash(git reset:*)",
|
|
33
|
+
"Bash(git rm:*)",
|
|
34
|
+
"Bash(git status:*)",
|
|
35
|
+
"Bash(git push:*)"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
unitlab-2.4.0/.gitignore
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
Pipfile
|
|
96
|
+
Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
111
|
+
.pdm.toml
|
|
112
|
+
|
|
113
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
114
|
+
__pypackages__/
|
|
115
|
+
|
|
116
|
+
# Celery stuff
|
|
117
|
+
celerybeat-schedule
|
|
118
|
+
celerybeat.pid
|
|
119
|
+
|
|
120
|
+
# SageMath parsed files
|
|
121
|
+
*.sage.py
|
|
122
|
+
|
|
123
|
+
# Environments
|
|
124
|
+
.env
|
|
125
|
+
.venv
|
|
126
|
+
env/
|
|
127
|
+
venv/
|
|
128
|
+
ENV/
|
|
129
|
+
env.bak/
|
|
130
|
+
venv.bak/
|
|
131
|
+
|
|
132
|
+
# Spyder project settings
|
|
133
|
+
.spyderproject
|
|
134
|
+
.spyproject
|
|
135
|
+
|
|
136
|
+
# Rope project settings
|
|
137
|
+
.ropeproject
|
|
138
|
+
|
|
139
|
+
# mkdocs documentation
|
|
140
|
+
/site
|
|
141
|
+
|
|
142
|
+
# mypy
|
|
143
|
+
.mypy_cache/
|
|
144
|
+
.dmypy.json
|
|
145
|
+
dmypy.json
|
|
146
|
+
|
|
147
|
+
# Pyre type checker
|
|
148
|
+
.pyre/
|
|
149
|
+
|
|
150
|
+
# pytype static type analyzer
|
|
151
|
+
.pytype/
|
|
152
|
+
|
|
153
|
+
# Cython debug symbols
|
|
154
|
+
cython_debug/
|
|
155
|
+
|
|
156
|
+
# PyCharm
|
|
157
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
158
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
159
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
160
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
161
|
+
.idea/
|
|
162
|
+
.vscode/
|
|
163
|
+
|
|
164
|
+
# Downloaded artifacts
|
|
165
|
+
*.zip
|
unitlab-2.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unitlab
|
|
3
|
+
Version: 2.4.0
|
|
4
|
+
Summary: Python SDK for the Unitlab.ai data annotation platform
|
|
5
|
+
Project-URL: Homepage, https://unitlab.ai
|
|
6
|
+
Project-URL: Documentation, https://docs.unitlab.ai
|
|
7
|
+
Project-URL: Repository, https://github.com/teamunitlab/unitlab-sdk
|
|
8
|
+
Author-email: "Unitlab Inc." <team@unitlab.ai>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE.md
|
|
11
|
+
Keywords: annotation,data-labeling,machine-learning,sdk,unitlab
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: aiofiles>=23.0
|
|
23
|
+
Requires-Dist: aiohttp>=3.9
|
|
24
|
+
Requires-Dist: requests>=2.28
|
|
25
|
+
Requires-Dist: tqdm>=4.60
|
|
26
|
+
Requires-Dist: typer>=0.9
|
|
27
|
+
Requires-Dist: validators>=0.20
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: aioresponses>=0.7; extra == 'dev'
|
|
30
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: responses>=0.23; extra == 'dev'
|
|
34
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
35
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<br>
|
|
40
|
+
<img src="assets/logo.png" width="400"/>
|
|
41
|
+
<br>
|
|
42
|
+
<p>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="https://pypi.org/project/unitlab/">
|
|
46
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/unitlab">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://pypi.org/project/unitlab/">
|
|
49
|
+
<img alt="Python" src="https://img.shields.io/pypi/pyversions/unitlab">
|
|
50
|
+
</a>
|
|
51
|
+
<a href="https://github.com/teamunitlab/unitlab-sdk">
|
|
52
|
+
<img alt="Downloads" src="https://img.shields.io/pypi/dm/unitlab">
|
|
53
|
+
</a>
|
|
54
|
+
<a href="https://github.com/teamunitlab/unitlab-sdk/blob/main/LICENSE.md">
|
|
55
|
+
<img alt="License" src="https://img.shields.io/pypi/l/unitlab">
|
|
56
|
+
</a>
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
[Unitlab.ai](https://unitlab.ai/) is an AI-driven data annotation platform that automates the collection of raw data, facilitating collaboration with human annotators to produce highly accurate labels for your machine learning models. With our service, you can optimize work efficiency, improve data quality, and reduce costs.
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
63
|
+
# Unitlab Python SDK
|
|
64
|
+
|
|
65
|
+
Python SDK and CLI for the [Unitlab.ai](https://unitlab.ai/) data annotation platform. Manage projects, upload data, and download datasets programmatically or from the command line.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install --upgrade unitlab
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Requires Python 3.10+.
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
Get your API key from [unitlab.ai](https://unitlab.ai/) and configure the CLI:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Set API key
|
|
81
|
+
unitlab configure --api-key YOUR_API_KEY
|
|
82
|
+
|
|
83
|
+
# Set a custom API URL
|
|
84
|
+
unitlab configure --api-url https://api.unitlab.ai
|
|
85
|
+
|
|
86
|
+
# Set both at once
|
|
87
|
+
unitlab configure --api-key YOUR_API_KEY --api-url https://api.unitlab.ai
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or set environment variables:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
export UNITLAB_API_KEY=YOUR_API_KEY
|
|
94
|
+
|
|
95
|
+
# Optional: point to a custom API server (e.g. self-hosted)
|
|
96
|
+
export UNITLAB_API_URL=https://api.unitlab.ai
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Python SDK
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from unitlab import UnitlabClient
|
|
103
|
+
|
|
104
|
+
# Initialize with an explicit key
|
|
105
|
+
client = UnitlabClient(api_key="YOUR_API_KEY")
|
|
106
|
+
|
|
107
|
+
# Or read from UNITLAB_API_KEY env var / config file
|
|
108
|
+
client = UnitlabClient()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The client can also be used as a context manager:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
with UnitlabClient() as client:
|
|
115
|
+
projects = client.projects()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Projects
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
# List all projects
|
|
122
|
+
projects = client.projects()
|
|
123
|
+
|
|
124
|
+
# Get project details
|
|
125
|
+
project = client.project("PROJECT_ID")
|
|
126
|
+
|
|
127
|
+
# Get project members
|
|
128
|
+
members = client.project_members("PROJECT_ID")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Upload data
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
client.project_upload_data(
|
|
135
|
+
project_id="PROJECT_ID",
|
|
136
|
+
directory="./images",
|
|
137
|
+
)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Additional options for specific project types:
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
# Text projects
|
|
144
|
+
client.project_upload_data("PROJECT_ID", "./docs", sentences_per_chunk=10)
|
|
145
|
+
|
|
146
|
+
# Video projects
|
|
147
|
+
client.project_upload_data("PROJECT_ID", "./videos", fps=30.0)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Datasets
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
# List all datasets
|
|
154
|
+
datasets = client.datasets()
|
|
155
|
+
|
|
156
|
+
# Download annotations (COCO, YOLOv8, YOLOv5, etc.)
|
|
157
|
+
path = client.dataset_download("DATASET_ID", export_type="COCO", split_type="train")
|
|
158
|
+
|
|
159
|
+
# Download raw files
|
|
160
|
+
folder = client.dataset_download_files("DATASET_ID")
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## CLI
|
|
164
|
+
|
|
165
|
+
### Projects
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# List projects
|
|
169
|
+
unitlab project list
|
|
170
|
+
|
|
171
|
+
# Project details
|
|
172
|
+
unitlab project detail PROJECT_ID
|
|
173
|
+
|
|
174
|
+
# Project members
|
|
175
|
+
unitlab project members PROJECT_ID
|
|
176
|
+
|
|
177
|
+
# Upload data to a project
|
|
178
|
+
unitlab project upload PROJECT_ID --directory ./images
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Datasets
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# List datasets
|
|
185
|
+
unitlab dataset list
|
|
186
|
+
|
|
187
|
+
# Download annotations
|
|
188
|
+
unitlab dataset download DATASET_ID --export-type COCO --split-type train
|
|
189
|
+
|
|
190
|
+
# Download raw files
|
|
191
|
+
unitlab dataset download DATASET_ID --download-type files
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
## Documentation
|
|
196
|
+
|
|
197
|
+
See the [full documentation](https://docs.unitlab.ai/) for detailed guides:
|
|
198
|
+
|
|
199
|
+
- [CLI reference](https://docs.unitlab.ai/cli-python-sdk/unitlab-cli)
|
|
200
|
+
- [Python SDK quickstart](https://docs.unitlab.ai/cli-python-sdk/unitlab-python-sdk)
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
First install the Unitlab.ai Python SDK using pip:
|
|
2
|
+
pip install --upgrade unitlab
|
|
3
|
+
|
|
4
|
+
Import the necessary packages, and initialize the Unitlab client using your API key:
|
|
5
|
+
from unitlab import UnitlabClient
|
|
6
|
+
|
|
7
|
+
#An API key can be created https://app.unitlab.ai/UnitlabAI/api-keys.
|
|
8
|
+
api_key = "YOUR API KEY"
|
|
9
|
+
client = UnitlabClient(api_key)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Let's get a list of your projects programmatically using client.projects().
|
|
13
|
+
Note that this list will be retrieved under the user account corresponding to the API key.
|
|
14
|
+
#Result:
|
|
15
|
+
[{'pk': '0ed69772-fd28-471b-b91c-2a57368c0dfb', 'name': '', 'parent_name': None, 'invoice': {'price': '0.00', 'images': 0}, 'annotator_progress': 0.0, 'reviewer_progress': 0.0, 'creator': 'user@gmail.com', 'created': '2023-04-11T11:00:23.737326+05:00'}, {'pk': '34738aec-b69b-4d30-9763-653017a68c02', 'name': 'human', 'parent_name': 'Red Blood Cell', 'invoice': {'price': '100.00', 'images': 1}, 'annotator_progress': 0.0, 'reviewer_progress': 0.0, 'creator': 'user@gmail.com', 'created': '2023-04-11T16:57:01.767677+05:00'},]
|
|
16
|
+
|
|
17
|
+
Add images to the project.
|
|
18
|
+
Now let's add images to the project which has not been created yet completely using client.project_upload_data():
|
|
19
|
+
#Code
|
|
20
|
+
project_id = 'project_id' # a project id.
|
|
21
|
+
folder = '/home/user/DirOfPics/' # you can upload pictures(.jpg, .png) locally.
|
|
22
|
+
sample = client.project_upload_data(project_id, folder)
|
|
23
|
+
|
|
24
|
+
We can verify them using client.project('project_id') when project is fully created and images will be added to your images to do the project.
|
unitlab-2.4.0/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<br>
|
|
3
|
+
<img src="assets/logo.png" width="400"/>
|
|
4
|
+
<br>
|
|
5
|
+
<p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/unitlab/">
|
|
9
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/unitlab">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://pypi.org/project/unitlab/">
|
|
12
|
+
<img alt="Python" src="https://img.shields.io/pypi/pyversions/unitlab">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/teamunitlab/unitlab-sdk">
|
|
15
|
+
<img alt="Downloads" src="https://img.shields.io/pypi/dm/unitlab">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/teamunitlab/unitlab-sdk/blob/main/LICENSE.md">
|
|
18
|
+
<img alt="License" src="https://img.shields.io/pypi/l/unitlab">
|
|
19
|
+
</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
[Unitlab.ai](https://unitlab.ai/) is an AI-driven data annotation platform that automates the collection of raw data, facilitating collaboration with human annotators to produce highly accurate labels for your machine learning models. With our service, you can optimize work efficiency, improve data quality, and reduce costs.
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
# Unitlab Python SDK
|
|
27
|
+
|
|
28
|
+
Python SDK and CLI for the [Unitlab.ai](https://unitlab.ai/) data annotation platform. Manage projects, upload data, and download datasets programmatically or from the command line.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install --upgrade unitlab
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Python 3.10+.
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
Get your API key from [unitlab.ai](https://unitlab.ai/) and configure the CLI:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Set API key
|
|
44
|
+
unitlab configure --api-key YOUR_API_KEY
|
|
45
|
+
|
|
46
|
+
# Set a custom API URL
|
|
47
|
+
unitlab configure --api-url https://api.unitlab.ai
|
|
48
|
+
|
|
49
|
+
# Set both at once
|
|
50
|
+
unitlab configure --api-key YOUR_API_KEY --api-url https://api.unitlab.ai
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or set environment variables:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
export UNITLAB_API_KEY=YOUR_API_KEY
|
|
57
|
+
|
|
58
|
+
# Optional: point to a custom API server (e.g. self-hosted)
|
|
59
|
+
export UNITLAB_API_URL=https://api.unitlab.ai
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Python SDK
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from unitlab import UnitlabClient
|
|
66
|
+
|
|
67
|
+
# Initialize with an explicit key
|
|
68
|
+
client = UnitlabClient(api_key="YOUR_API_KEY")
|
|
69
|
+
|
|
70
|
+
# Or read from UNITLAB_API_KEY env var / config file
|
|
71
|
+
client = UnitlabClient()
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The client can also be used as a context manager:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
with UnitlabClient() as client:
|
|
78
|
+
projects = client.projects()
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Projects
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
# List all projects
|
|
85
|
+
projects = client.projects()
|
|
86
|
+
|
|
87
|
+
# Get project details
|
|
88
|
+
project = client.project("PROJECT_ID")
|
|
89
|
+
|
|
90
|
+
# Get project members
|
|
91
|
+
members = client.project_members("PROJECT_ID")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Upload data
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
client.project_upload_data(
|
|
98
|
+
project_id="PROJECT_ID",
|
|
99
|
+
directory="./images",
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Additional options for specific project types:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
# Text projects
|
|
107
|
+
client.project_upload_data("PROJECT_ID", "./docs", sentences_per_chunk=10)
|
|
108
|
+
|
|
109
|
+
# Video projects
|
|
110
|
+
client.project_upload_data("PROJECT_ID", "./videos", fps=30.0)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Datasets
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
# List all datasets
|
|
117
|
+
datasets = client.datasets()
|
|
118
|
+
|
|
119
|
+
# Download annotations (COCO, YOLOv8, YOLOv5, etc.)
|
|
120
|
+
path = client.dataset_download("DATASET_ID", export_type="COCO", split_type="train")
|
|
121
|
+
|
|
122
|
+
# Download raw files
|
|
123
|
+
folder = client.dataset_download_files("DATASET_ID")
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## CLI
|
|
127
|
+
|
|
128
|
+
### Projects
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# List projects
|
|
132
|
+
unitlab project list
|
|
133
|
+
|
|
134
|
+
# Project details
|
|
135
|
+
unitlab project detail PROJECT_ID
|
|
136
|
+
|
|
137
|
+
# Project members
|
|
138
|
+
unitlab project members PROJECT_ID
|
|
139
|
+
|
|
140
|
+
# Upload data to a project
|
|
141
|
+
unitlab project upload PROJECT_ID --directory ./images
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Datasets
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# List datasets
|
|
148
|
+
unitlab dataset list
|
|
149
|
+
|
|
150
|
+
# Download annotations
|
|
151
|
+
unitlab dataset download DATASET_ID --export-type COCO --split-type train
|
|
152
|
+
|
|
153
|
+
# Download raw files
|
|
154
|
+
unitlab dataset download DATASET_ID --download-type files
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## Documentation
|
|
159
|
+
|
|
160
|
+
See the [full documentation](https://docs.unitlab.ai/) for detailed guides:
|
|
161
|
+
|
|
162
|
+
- [CLI reference](https://docs.unitlab.ai/cli-python-sdk/unitlab-cli)
|
|
163
|
+
- [Python SDK quickstart](https://docs.unitlab.ai/cli-python-sdk/unitlab-python-sdk)
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
[MIT](LICENSE.md)
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "unitlab"
|
|
7
|
+
version = "2.4.0"
|
|
8
|
+
description = "Python SDK for the Unitlab.ai data annotation platform"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{ name = "Unitlab Inc.", email = "team@unitlab.ai" }]
|
|
13
|
+
keywords = ["unitlab", "annotation", "machine-learning", "data-labeling", "sdk"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"aiohttp>=3.9",
|
|
27
|
+
"aiofiles>=23.0",
|
|
28
|
+
"requests>=2.28",
|
|
29
|
+
"tqdm>=4.60",
|
|
30
|
+
"typer>=0.9",
|
|
31
|
+
"validators>=0.20",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
dev = [
|
|
36
|
+
"pytest>=7.0",
|
|
37
|
+
"pytest-asyncio>=0.21",
|
|
38
|
+
"responses>=0.23",
|
|
39
|
+
"aioresponses>=0.7",
|
|
40
|
+
"ruff>=0.4",
|
|
41
|
+
"build>=1.0",
|
|
42
|
+
"twine>=5.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
unitlab = "unitlab.cli:app"
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
Homepage = "https://unitlab.ai"
|
|
50
|
+
Documentation = "https://docs.unitlab.ai"
|
|
51
|
+
Repository = "https://github.com/teamunitlab/unitlab-sdk"
|
|
52
|
+
|
|
53
|
+
[tool.hatch.build.targets.wheel]
|
|
54
|
+
packages = ["src/unitlab"]
|
|
55
|
+
|
|
56
|
+
[tool.ruff]
|
|
57
|
+
target-version = "py310"
|
|
58
|
+
line-length = 88
|
|
59
|
+
|
|
60
|
+
[tool.ruff.lint]
|
|
61
|
+
select = ["E", "F", "I", "N", "W", "UP", "B", "SIM", "RUF"]
|
|
62
|
+
|
|
63
|
+
[tool.ruff.format]
|
|
64
|
+
quote-style = "double"
|
|
65
|
+
|
|
66
|
+
[tool.pytest.ini_options]
|
|
67
|
+
testpaths = ["tests"]
|