Client for the Turkle REST API
Project description
Turkle Client
This is a client for the Turkle annotation platform. It provides a commandline interface to create and work with users, groups, projects and batches.
Install
Install from pip:
pip install turkle-client
Usage
The commandline client works similar to tools like git where there is a hierarchy of commands. The top level commands are config, users, groups, projects, and batches. Each has sub-commands like retrieve, create, or update.
To get the top level documentation, pass the -h flag:
turkle-client -h
To get documentation on an individual command:
turkle-client batches -h
Configuration
Set the url of the Turkle site and your token:
turkle-client config url https://example.org/
turkle-client config token 41dcbb22264dd60c5232383fc844dbbab4839146
To view your configuration:
turkle-client config print
The token and url can also be specified on the command line:
turkle-client -u https://example.org -t abcdef users list
Users
To list current users:
turkle-client users list
To create users, create a CSV file like this:
username,password,first_name,last_name,email
smithgc1,p@ssw0rd,george,smith,gcs@mail.com
jonesrt1,12345678,roger,jones,jones@mail.com
and then pass it to the client::
turkle-client users create --file new_users.csv
The create command also accepts jsonl files.
Groups
List groups with:
turkle-client groups list
Creating a group requires a jsonl or json file with the name and a list of user IDs:
{"name":"Spanish annotators","users":[3,7,54]}
and then passed to the command:
turkle-client groups create --file spanish.json
Adding users to a group requires a json file with the list of user IDs:
[2,4,17,34]
which is passed to the command with the group id:
turkle-client groups addusers --id 5 --file june_users.json
Projects
A project needs a template html file:
{
"name": "Image Contains",
"filename": "~/templates/image_contains.html"
}
and the json object can have additional optional fields such as allotted_assignment_time and assignments_per_task.
turkle-client projects create --file myproject.json
To get information about the batches that have been published for the project:
turkle-client projects batches --id 8
Batches
To create a batch, you will need the name, project id, and csv file:
{
"name": "Bird Photos",
"project": 20,
"filename": "image_contains.csv",
}
The json object can have additional fields just like creating projects.
turkle-client batches create --file mybatch.json
Getting the progress, the input csv or the results csv all work the same way:
turkle-client batches progress --id 17
turkle-client batches input --id 17
turkle-client batches results --id 17
Developers
Installing
pip install -e .[dev]
Testing
pytest
Releasing
- Update the version in version.py
- Update the changelog
- Create git tag
- Upload to PyPI
- rm -rf dist/ build/ *.egg-info/
- python -m build
- twine upload dist/*
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file turkle_client-0.2.0.tar.gz.
File metadata
- Download URL: turkle_client-0.2.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f9a72e4fc2172249e48b7f0693614ec83fc029cd2effef60998cfee77da0f6b
|
|
| MD5 |
da22d39d397b7504c93064f68b8480e5
|
|
| BLAKE2b-256 |
6de0206a49a9c67498e36a29f660e8ef1bba7a9b6c8134cac2c629f54abe4adf
|
File details
Details for the file turkle_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: turkle_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62640daf2031045eb351e2ca3cd941c9b128e1ca2cd691223f92fd96deb6a307
|
|
| MD5 |
91e97359ec69b540366d4f387c401420
|
|
| BLAKE2b-256 |
5a50e8b9be69d1cf5e44fbe7975123eb0fcb20bb1dc428f0ab23bb9aab11119e
|