Progress Bar Tracker SDK
A powerful Python SDK for tracking and managing progress bars with granular permission control.
Features
- 🔐 Three-tier Permission System: Read, Write, and Admin keys
- 📊 Easy Progress Tracking: Simple API for creating and updating progress items
- 🔄 Real-time Updates: Monitor long-running tasks with live progress updates
- 🎯 Ownership Control: Write keys can only modify their own items
- 🚀 Auto-detection: Automatically detects API key permissions
- 💪 Type Safe: Full type hints support
Installation
pip install progressbar-tracker
Quick Start
from progressbar_tracker import ProgressBar
# Initialize with your API endpoint and key
pb = ProgressBar(
api_url="http://your-server:8989",
api_key="your-api-key"
)
# Create a new progress item
pb.create(
item_id="video-encoding-001",
title="Encoding Video",
description="Processing 4K video file",
value=0.0,
weight=100 # Higher weight = higher priority in display
)
# Update progress
pb.update(
item_id="video-encoding-001",
title="Encoding Video",
description="50% complete",
value=0.5,
weight=100
)
# Get all items
items = pb.get_all()
for item in items:
print(f"{item['title']}: {item['value']*100:.0f}%")
# Delete when done
pb.delete("video-encoding-001")
API Key Types
Read Key
- ✅ View all progress items
- ❌ Cannot create, update, or delete
pb = ProgressBar(api_url="http://server:8989", api_key="readonly-key-123")
items = pb.get_all() # Works
pb.create(...) # Raises PermissionError
Write Key
- ✅ View all progress items
- ✅ Create new items
- ✅ Update own items only
- ✅ Delete own items only
pb = ProgressBar(api_url="http://server:8989", api_key="write-key-456")
pb.create("my-task", "Task", "Processing...", 0.5) # Works
pb.update("my-task", "Task", "Almost done", 0.9) # Works
pb.update("other-task", ...) # Raises PermissionError
Admin Key
- ✅ Full access to all operations
- ✅ Can modify any item
- ✅ Can delete any item
pb = ProgressBar(api_url="http://server:8989", api_key="admin-key-789")
pb.update("any-task", ...) # Works on any item
pb.delete("any-task") # Can delete any item
Advanced Usage
Check Permissions
pb = ProgressBar(api_url="http://server:8989", api_key="your-key")
if pb.is_admin():
print("You have full admin access")
elif pb.can_write():
print("You can create and modify items")
elif pb.is_read_only():
print("You can only view items")
Error Handling
from progressbar_tracker import ProgressBar, PermissionError
pb = ProgressBar(api_url="http://server:8989", api_key="write-key")
try:
pb.create("task-1", "Task 1", "Running", 0.5)
except PermissionError as e:
print(f"Permission denied: {e}")
except ValueError as e:
print(f"Validation error: {e}")
Disable Auto-detection
# Skip permission detection on initialization (faster)
pb = ProgressBar(
api_url="http://server:8989",
api_key="your-key",
auto_detect=False
)
API Reference
ProgressBar(api_url, api_key, auto_detect=True)
Initialize the SDK client.
Parameters:
api_url(str): Base URL of the progress bar serverapi_key(str): Your API keyauto_detect(bool): Auto-detect key permissions (default: True)
get_all() -> List[Dict]
Retrieve all progress items.
Returns: List of progress item dictionaries
Raises: PermissionError if key lacks read permission
create(item_id, title, description, value, weight=0)
Create a new progress item.
Parameters:
item_id(str): Unique identifiertitle(str): Display titledescription(str): Status descriptionvalue(float): Progress value (0.0 to 1.0)weight(int): Sort priority (default: 0)
Raises:
PermissionErrorif key lacks create permissionValueErrorif item already exists
update(item_id, title, description, value, weight=0)
Update an existing progress item.
Parameters: Same as create()
Raises:
PermissionErrorif key lacks update permissionValueErrorif item doesn't exist
delete(item_id)
Delete a progress item.
Parameters:
item_id(str): ID of item to delete
Raises: PermissionError if key lacks delete permission
Permission Helpers
is_admin() -> bool: Check if key is adminis_read_only() -> bool: Check if key is read-onlycan_write() -> bool: Check if key can create/updatecan_delete() -> bool: Check if key can delete
Real-world Examples
Video Encoding Pipeline
from progressbar_tracker import ProgressBar
import time
pb = ProgressBar(api_url="http://server:8989", api_key="write-key")
# Start encoding
pb.create("video-001", "Encoding: movie.mp4", "Initializing...", 0.0, weight=100)
for progress in range(0, 101, 10):
time.sleep(1)
pb.update(
"video-001",
"Encoding: movie.mp4",
f"Processing frame {progress*10}/1000",
progress / 100.0,
weight=100
)
pb.delete("video-001")
print("✓ Encoding complete!")
Batch Processing
from progressbar_tracker import ProgressBar
pb = ProgressBar(api_url="http://server:8989", api_key="write-key")
files = ["file1.txt", "file2.txt", "file3.txt"]
for i, filename in enumerate(files):
pb.create(
f"process-{i}",
f"Processing {filename}",
"In queue",
0.0,
weight=len(files) - i # Higher weight for earlier files
)
# Process and update
for i, filename in enumerate(files):
# ... do work ...
pb.update(f"process-{i}", f"Processing {filename}", "Complete", 1.0)
pb.delete(f"process-{i}")
Server Setup
This SDK requires a Progress Bar Tracker server. You can deploy one using Docker:
docker run -d \
-p 8989:8080 \
-e ADMIN_USERNAME=admin \
-e ADMIN_PASSWORD=your-password \
progressbar-server:latest
Or see the full documentation for setup instructions.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details.
Links
Metadata
Release files for progressbar-tracker 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| progressbar_tracker-1.0.0.tar.gz | 7.2 kB | Without provenance | Details for progressbar_tracker-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| progressbar_tracker-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for progressbar_tracker-1.0.0-py3-none-any.whl |
Total release size: 14.2 kB
Release files / progressbar_tracker-1.0.0.tar.gz
| Download URL | progressbar_tracker-1.0.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
015e6118eaccbf494729058927f500cf40219fe27c783ec3589ec051d25a7f02
|
|
BLAKE2b-256 checksum How to use checksums |
ba2a2a21719c684ca7dafe579fe2d5c43d45feaf8cc494d18c5de67e15840061
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / progressbar_tracker-1.0.0-py3-none-any.whl
| Download URL | progressbar_tracker-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d9fe49d6ed50b0c97158d793652b92bf1ea44d020d9038ae4388dce84af821d
|
|
BLAKE2b-256 checksum How to use checksums |
db1ec2dd7270f1e64e4f63a0713f4390969a256893fed067a6da0959d2141b79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for progressbar-tracker 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.