Skip to main content

Cross-platform clipboard utilities supporting both binary and text data.

Project description

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

pyperclip3 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)

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 pyperclip3 copy < myfile.text
# same as above, but pipe from another command
some-program | python -m pyperclip3 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 (with xclip)

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 pywin32 package 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 requires xclip to work (which means you must also use X). Install with your package manager, e.g. sudo apt install xclip

Acknowledgements

Big thanks to Howard Mao for donating the PyClip project name on PyPI to this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyclip-0.5.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyclip-0.5.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file pyclip-0.5.0.tar.gz.

File metadata

  • Download URL: pyclip-0.5.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0

File hashes

Hashes for pyclip-0.5.0.tar.gz
Algorithm Hash digest
SHA256 b33637ff77f9c4acd01c80e3d9e7a69a93500bc55ba744b393539a32e67a1d88
MD5 d6486049488eb133844d026451c7a4ac
BLAKE2b-256 8909f0678b5c40e33885880d11258619237e060c5644d023e65f396d78450ef3

See more details on using hashes here.

File details

Details for the file pyclip-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pyclip-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0

File hashes

Hashes for pyclip-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5bfff7deafbd74c86cf8ded741c0cf61a34564387ee7a2a694f8966b97df9b4
MD5 4688773524562e8c9ef3e6ce68c5720b
BLAKE2b-256 c00e4ef9cd6b1092ad056e5da83e01bfbf12909afd4b06b017f5bd42d47e74cb

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