philiprehberger-clipboard
Cross-platform clipboard copy and paste in one function call.
Installation
pip install philiprehberger-clipboard
Usage
from philiprehberger_clipboard import copy, paste
copy("Hello, clipboard!")
text = paste()
print(text) # Hello, clipboard!
Clearing and checking
from philiprehberger_clipboard import clear, copy, equals
copy("secret")
equals("secret") # True
equals("other") # False
clear()
equals("") # True
Detect availability
from philiprehberger_clipboard import copy, is_available
if is_available():
copy("hello")
else:
print("install xclip / xsel / wl-clipboard to enable copy")
CLI
Copy text from stdin:
echo "Hello" | python -m philiprehberger_clipboard copy
Paste clipboard contents to stdout:
python -m philiprehberger_clipboard paste
Or use the installed script:
echo "Hello" | clipboard copy
clipboard paste
API
| Function | Description |
|---|---|
copy(text: str) -> None |
Copy a string to the system clipboard |
paste() -> str |
Read a string from the system clipboard |
is_available() -> bool |
Return True if a clipboard backend is detected on the current platform |
clear() -> None |
Clear the clipboard (equivalent to copy("")) |
equals(text: str) -> bool |
Return True if the clipboard contains exactly text; non-destructive, returns False when backend is unavailable |
ClipboardError |
Raised when clipboard tool is unavailable or operation fails |
Platform support
| Platform | Copy | Paste |
|---|---|---|
| Windows | clip.exe |
PowerShell Get-Clipboard |
| macOS | pbcopy |
pbpaste |
| Linux (X11) | xclip or xsel |
xclip or xsel |
| Linux (Wayland) | wl-copy |
wl-paste |
Development
pip install -e .
python -m pytest tests/ -v
Support
If you find this project useful:
License
Metadata
Release files for philiprehberger-clipboard 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| philiprehberger_clipboard-0.3.0.tar.gz | 182.7 kB | Without provenance | Details for philiprehberger_clipboard-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| philiprehberger_clipboard-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for philiprehberger_clipboard-0.3.0-py3-none-any.whl |
Total release size: 188.3 kB
Release files / philiprehberger_clipboard-0.3.0.tar.gz
| Download URL | philiprehberger_clipboard-0.3.0.tar.gz |
|---|---|
| Size | 182.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e3ac545f8ce7c9bd9143205a20b382cfb61a26025f4f875cbfc76259ad1256c
|
|
BLAKE2b-256 checksum How to use checksums |
d6df9714a19803b0bafc74a279af02fc2f7cf39962bb30ba6db241802ff4d62d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / philiprehberger_clipboard-0.3.0-py3-none-any.whl
| Download URL | philiprehberger_clipboard-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b323ede95238090025be6543b3e63524ed3e3f17c25454be844e3275bc00f360
|
|
BLAKE2b-256 checksum How to use checksums |
1a59e4133e9dcaebbce9ea859c44c12079dc5132b267dd7e9e739c9ea54ac132
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for philiprehberger-clipboard 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.