PyClip
Cross-platform clipboard utilities supporting both binary and text data.
Some key features include:
- A cross-platform API (supports MacOS, Windows, Linux)
- Can handle arbitrary binary data
- On Windows, some additional clipboard formats are supported
Installation
Requires python 3.7+
pip install pyclip
Usage
pyclip can be used in Python code
import pyclip
pyclip.copy("hello clipboard") # copy data to the clipboard
cb_data = pyclip.paste() # retrieve clipboard contents
print(cb_data) # b'hello clipboard'
cb_text = pyclip.paste(text=True) # paste as text
print(cb_text) # 'hello clipboard'
pyclip.clear() # clears the clipboard contents
assert not pyclip.paste()
Or a CLI
# paste clipboard contents to stdout
python -m pyclip paste
# load contents to the clipboard from stdin
python -m pyclip copy < myfile.text
# same as above, but pipe from another command
some-program | python -m pyclip copy
Installing via pip also provides the console script pyclip:
pyclip copy < my_file.txt
This library implements functionality for several platforms and clipboard utilities.
- MacOS
- Windows
- Linux on x11 (with
xclip) - Linux on wayland (with
wl-clipboard)
If there is a platform or utility not currently listed, please request it by creating an issue.
Platform specific notes/issues
Windows
- On Windows, the
pywin32package is installed as a requirement. - On Windows, additional clipboard formats are supported, including copying from a file (like if you right-click copy from File Explorer)
MacOS
MacOS has support for multiple backends. By default, the pasteboard package is used.
pbcopy/pbpaste can also be used as a backend, but does not support arbitrary binary data, which may lead to
data being lost on copy/paste. This backend may be removed in a future release.
Linux
Linux on X11 requires xclip to work. Install with your package manager, e.g. sudo apt install xclip
Linux on Wayland requires wl-clipboard to work. Install with your package manager, e.g. sudo apt install wl-clipboard
Acknowledgements
Big thanks to Howard Mao for donating the PyClip project name on PyPI to this project.
Metadata
Release files for pyclip 0.7.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 |
|---|---|---|---|---|
| pyclip-0.7.0.tar.gz | 13.6 kB | Without provenance | Details for pyclip-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyclip-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for pyclip-0.7.0-py3-none-any.whl |
Total release size: 32.5 kB
Release files / pyclip-0.7.0.tar.gz
| Download URL | pyclip-0.7.0.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57602047a4ceab709bdcd42f3dde6449a3349b95c16154cfdce27376a2072491
|
|
BLAKE2b-256 checksum How to use checksums |
658a98ed02d81dea4b2211a4746724d7a271264b701c991fed503c246de52864
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / pyclip-0.7.0-py3-none-any.whl
| Download URL | pyclip-0.7.0-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7b7ea2cfad2dd61e86a529af588d006070d3eb0bd32981afaee5215f4604fec
|
|
BLAKE2b-256 checksum How to use checksums |
7d4f4b02e2c232ddf694bca0baea3049b886eeb80ee3d89c415067f5191596c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for pyclip 0.7.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.