Skip to main content

Swarmauri Community Clipboard State

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_state_clipboard


Swarmauri State Clipboard

ClipboardState implements Swarmauri's StateBase interface using the system clipboard as storage. Useful for quick demos or sharing state between desktop tools without running an external datastore.

Features

  • Reads/writes clipboard contents via platform commands (clip, pbcopy/pbpaste, xclip).
  • Stores JSON-like dictionaries as string representations; uses ast.literal_eval when reading.
  • Provides write, read, update, reset, and deep_copy helpers.

Prerequisites

  • Python 3.10 or newer.
  • OS clipboard utilities available:
    • Windows: clip (built-in) and PowerShell Get-Clipboard.
    • macOS: pbcopy/pbpaste (built-in).
    • Linux: xclip installed (apt install xclip or equivalent).

Installation

# pip
pip install swarmauri_state_clipboard

# poetry
poetry add swarmauri_state_clipboard

# uv (pyproject-based projects)
uv add swarmauri_state_clipboard

Quickstart

from swarmauri_state_clipboard import ClipboardState

state = ClipboardState()
state.write({"key1": "value1", "counter": 42})
print(state.read())

state.update({"counter": 43})
print(state.read())

state.reset()
print(state.read())  # {}

Deep Copy

state = ClipboardState()
state.write({"session": "abc123"})
clone = state.deep_copy()
clone.update({"session": "xyz789"})

print(state.read())   # {'session': 'abc123'}
print(clone.read())    # {'session': 'xyz789'}

Tips

  • Clipboard overwrites are global; avoid using this state provider in multi-user or production environments where clipboard privacy matters.
  • Contents are stored as Python literal strings—avoid writing untrusted data to the clipboard to prevent evaluation issues (though ast.literal_eval mitigates code execution risks).
  • Ensure required system commands exist before running in CI or containers (install xclip for Linux builds).

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swarmauri_state_clipboard-0.8.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_state_clipboard-0.8.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_state_clipboard-0.8.2.tar.gz.

File metadata

  • Download URL: swarmauri_state_clipboard-0.8.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_state_clipboard-0.8.2.tar.gz
Algorithm Hash digest
SHA256 e59cc27c6ebe16814b0ebf7e06f45ecff859fdfecd79c0a70c2834a68899a5c7
MD5 5a9cda252f70ff72d363574dced959cb
BLAKE2b-256 db5c3421a13b339bd84c5c61bc2e20209ba2a7117102231ffd71ffc03548de20

See more details on using hashes here.

File details

Details for the file swarmauri_state_clipboard-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_state_clipboard-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_state_clipboard-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e39c04627ee66d937962b85825f06e4d5859a7e236b60309611f1f7c3260839f
MD5 175df2ba488d23fa20cb9126ce4072a4
BLAKE2b-256 401b8849010702afee1afbe430dfab65cab74fcb726bd647c1462bee2bec1564

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page