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.3.dev5.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.

File details

Details for the file swarmauri_state_clipboard-0.8.3.dev5.tar.gz.

File metadata

  • Download URL: swarmauri_state_clipboard-0.8.3.dev5.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.3.dev5.tar.gz
Algorithm Hash digest
SHA256 ac9a34b53d4a2d4c942403c02636f01a5fd40776e92b7e345464267b528b1d4c
MD5 6605b6962aca106233f42ad3ebde14b2
BLAKE2b-256 1e672583354597f21941c78b7cf2608ca1960fcbf67635634dfb3f860c436c88

See more details on using hashes here.

File details

Details for the file swarmauri_state_clipboard-0.8.3.dev5-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_state_clipboard-0.8.3.dev5-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.3.dev5-py3-none-any.whl
Algorithm Hash digest
SHA256 5253dfb720b3f9b11ed80ac0f20c6ee8eb7cfb15218c1111ab0e4c86da1b4861
MD5 079af2d7309abbf6466d873bda7d0acb
BLAKE2b-256 5cd852aca3779241459b8ce83426a2bbd487f96f19e57cbe7cc0220c0e1a3788

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