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

File metadata

  • Download URL: swarmauri_state_clipboard-0.9.0.dev5.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.dev5.tar.gz
Algorithm Hash digest
SHA256 bb95041eb32ecbda8c524b58bc4696cbf6561846b9fd8e7e19586f686283fb18
MD5 81bb1865e02effc090e91177fba476e3
BLAKE2b-256 2d9907d15d436314c130a61c89312a0aa8a390b8543d5c130cfbe8f6a5af1584

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_state_clipboard-0.9.0.dev5-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.dev5-py3-none-any.whl
Algorithm Hash digest
SHA256 d1bb61b7eeacec776971e58d6f6d5e9b683beade8c072dd97406ae773885f61b
MD5 8bf2b26819ab5f7b83d117671de635ed
BLAKE2b-256 d8a0c40cff5d95a88ba0b97fde40feffde986af9523e455f8f1b0e402d886e67

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