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.dev10.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.dev10.tar.gz.

File metadata

  • Download URL: swarmauri_state_clipboard-0.8.3.dev10.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.dev10.tar.gz
Algorithm Hash digest
SHA256 0d1d661aa7aa951769edc3e50d442aed0505474e773397df8e128c71c5fcdc71
MD5 b712391cf4f23f64eb756052569ec197
BLAKE2b-256 1c48a27873c3b2f7c65e54a439f07697ef2b90990e066c02b8478ea554091d31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_state_clipboard-0.8.3.dev10-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.dev10-py3-none-any.whl
Algorithm Hash digest
SHA256 fbb7edbc40359205ff50a9704fae3841246621ac11fd3fdc8df7339fb67bc556
MD5 594a93ce95bbcab41a0daf1701996bcd
BLAKE2b-256 1adcda02ded6be66014f5fb9eea9b4c195f39ce329dae5d5f67deb6d79a87837

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