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.9.0.dev4.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.9.0.dev4.tar.gz.

File metadata

  • Download URL: swarmauri_state_clipboard-0.9.0.dev4.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.9.0.dev4.tar.gz
Algorithm Hash digest
SHA256 36d3e1c1e5b6296df4810fb5cbeced5623d598d20add742d158db8b3a8186a40
MD5 c79b87ae5c1cf3391f0a4b498854e0f7
BLAKE2b-256 c4a07fec95d60d9cc249885e7d41503a4c2e9172194e6db7574689d61c55f9d5

See more details on using hashes here.

File details

Details for the file swarmauri_state_clipboard-0.9.0.dev4-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_state_clipboard-0.9.0.dev4-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.9.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 40a4068ee56ecb653db09a9939661d5b6047de924f7a6edf93698364eb0e4592
MD5 e3e96a0a471d1866dd6c8aecb60a345d
BLAKE2b-256 cfffd09c1cec42d05a6ea6be08126b7698346b8677b114a6bf1021df48d9b511

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