No project description provided
Project description
workspacex
workspacex is a Python library for managing AIGC (AI-Generated Content) artifacts. It provides a collaborative workspace environment for handling multiple artifacts with features like version control, update notifications, and artifact management. The library supports various artifact types and includes an observer pattern for event handling.
Features
- Artifact Management: Create, update, and manage different types of artifacts (text, code, etc.)
- Version Control: Track changes and maintain version history for artifacts
- Workspace Organization: Group related artifacts in collaborative workspaces
- Event Handling: Observer pattern for artifact creation and updates
- Storage: Local storage support with extensible repository system
- Type Safety: Built with Pydantic for robust data validation
- Async Support: Asynchronous operations for better performance
- [-] Remote Storeage
- [-] MCP supported
Project Structure
workspacex/
src/
workspacex/ # Main package code
examples/ # Example scripts
Environment Setup
- Install dependencies
poetry install
Add dependencies
poetry add <package-name>
Usage
- To run example scripts, use:
python -m workspacex.<module>
or set thePYTHONPATH:export PYTHONPATH=src python src/examples/your_example.py
examples:
import asyncio
import logging
from workspacex import WorkSpace
from workspacex import ArtifactType
from workspacex.observer import on_artifact_create, get_observer
@on_artifact_create
async def handle_artifact_create(artifact):
logging.info(f"Artifact created: {artifact.artifact_id}")
@on_artifact_create(workspace_id="demo", filters={"artifact_type": "text"})
async def handle_specific_artifacts(artifact, **kwargs):
logging.info(f"text artifact created in specific workspace {kwargs['workspace_id']}: {artifact.artifact_id}")
class DemoClass:
def __init__(self):
observer = get_observer()
observer.register_create_handler(
self.artifact_create,
instance=self,
workspace_id="demo"
)
async def artifact_create(self, artifact, **kwargs):
logging.info(f"DemoClass : text artifact created in specific workspace {kwargs['workspace_id']}: {artifact.artifact_id}")
if __name__ == '__main__':
DemoClass()
workspace = WorkSpace.from_local_storages(workspace_id="demo")
asyncio.run(workspace.create_artifact(ArtifactType.TEXT, "artifact_001"))
you can see it in data/workspaces
❯ tree .
.
└── workspaces
└── demo
├── artifact_e4114394ca07a57fea465936b5c80d69e7754c75674521dd07cad9d8e77d3036.json
├── index.json
└── workspace_67b60981fd59b82e1c50826d15af5449fb6dcd53017aa7a2e31ade4df88a4b76.json
Notes
- All source code is under
src/. - Make sure to activate the correct conda environment before using Poetry commands or running code.
- If you see
ModuleNotFoundError: No module named 'workspacex', ensure yourPYTHONPATHincludessrc.
Project details
Release history Release notifications | RSS feed
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 workspacex-0.1.0.tar.gz.
File metadata
- Download URL: workspacex-0.1.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.16 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a565249d9716f8d67fa54b6b46369861ee88c3b6c9e4d8d09cff9ffe2cc20a3c
|
|
| MD5 |
456361d0576bb6012cd1f56df588a001
|
|
| BLAKE2b-256 |
3962b21e1cf0b6883fba94c5f9d5a5fe219198868cfc87884b7778f205974ed5
|
File details
Details for the file workspacex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: workspacex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.16 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a87373124086470da999cf828e582e6024ac971a05a66205e020a689bff960ce
|
|
| MD5 |
4f8f7f2f08de37c04051bbd0a44bea7d
|
|
| BLAKE2b-256 |
140db5af5ac4bda6189e3f7367f5b524d7d4f50150fc99409b8c1769fd9b13b2
|