pyclip


Namepyclip JSON
Version 0.7.0 PyPI version JSON
download
home_pagehttps://github.com/spyoungtech/pyclip
SummaryCross-platform clipboard utilities supporting both binary and text data.
upload_time2022-10-31 21:13:34
maintainer
docs_urlNone
authorSpencer Young
requires_python
licenseApache
keywords pyperclip clipboard cross-platform binary bytes files
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # PyClip

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

[![Docs](https://readthedocs.org/projects/pyclip/badge/?version=latest)](https://pyclip.readthedocs.io/en/latest/?badge=latest)
![Build](https://img.shields.io/github/checks-status/spyoungtech/pyclip/main?label=build) 
![Coverage](https://img.shields.io/codecov/c/gh/spyoungtech/pyclip/main) 
![PyPI Version](https://img.shields.io/pypi/v/pyclip?color=blue)
![Python Versions](https://img.shields.io/pypi/pyversions/pyclip) 
[![Download Stats](https://pepy.tech/badge/pyclip)](https://pepy.tech/project/pyclip)


Some key features include:

- A cross-platform API (supports MacOS, Windows, Linux)
- Can handle arbitrary binary data
- On Windows, some additional [clipboard formats](https://docs.microsoft.com/en-us/windows/win32/dataxchg/standard-clipboard-formats) 
are supported

## Installation

Requires python 3.7+

```bash
pip install pyclip
```

## Usage

pyclip can be used in Python code
```python
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

```bash
# 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`:

```bash
pyclip copy < my_file.txt
```

This library implements functionality for several platforms and clipboard utilities. 

- [x] MacOS
- [x] Windows
- [x] Linux on x11 (with `xclip`)
- [x] 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 `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 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](https://github.com/zhemao) for donating the PyClip project name on PyPI to 
this project.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/spyoungtech/pyclip",
    "name": "pyclip",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pyperclip clipboard cross-platform binary bytes files",
    "author": "Spencer Young",
    "author_email": "spencer.young@spyoung.com",
    "download_url": "https://files.pythonhosted.org/packages/65/8a/98ed02d81dea4b2211a4746724d7a271264b701c991fed503c246de52864/pyclip-0.7.0.tar.gz",
    "platform": null,
    "description": "# PyClip\n\nCross-platform clipboard utilities supporting both binary and text data.\n\n[![Docs](https://readthedocs.org/projects/pyclip/badge/?version=latest)](https://pyclip.readthedocs.io/en/latest/?badge=latest)\n![Build](https://img.shields.io/github/checks-status/spyoungtech/pyclip/main?label=build) \n![Coverage](https://img.shields.io/codecov/c/gh/spyoungtech/pyclip/main) \n![PyPI Version](https://img.shields.io/pypi/v/pyclip?color=blue)\n![Python Versions](https://img.shields.io/pypi/pyversions/pyclip) \n[![Download Stats](https://pepy.tech/badge/pyclip)](https://pepy.tech/project/pyclip)\n\n\nSome key features include:\n\n- A cross-platform API (supports MacOS, Windows, Linux)\n- Can handle arbitrary binary data\n- On Windows, some additional [clipboard formats](https://docs.microsoft.com/en-us/windows/win32/dataxchg/standard-clipboard-formats) \nare supported\n\n## Installation\n\nRequires python 3.7+\n\n```bash\npip install pyclip\n```\n\n## Usage\n\npyclip can be used in Python code\n```python\nimport pyclip\n\npyclip.copy(\"hello clipboard\") # copy data to the clipboard\ncb_data = pyclip.paste() # retrieve clipboard contents \nprint(cb_data)  # b'hello clipboard'\ncb_text = pyclip.paste(text=True)  # paste as text\nprint(cb_text)  # 'hello clipboard'\n\npyclip.clear() # clears the clipboard contents\nassert not pyclip.paste()\n```\n\nOr a CLI\n\n```bash\n# paste clipboard contents to stdout\npython -m pyclip paste\n\n# load contents to the clipboard from stdin\npython -m pyclip copy < myfile.text\n# same as above, but pipe from another command\nsome-program | python -m pyclip copy\n```\n\nInstalling via pip also provides the console script `pyclip`:\n\n```bash\npyclip copy < my_file.txt\n```\n\nThis library implements functionality for several platforms and clipboard utilities. \n\n- [x] MacOS\n- [x] Windows\n- [x] Linux on x11 (with `xclip`)\n- [x] Linux on wayland (with `wl-clipboard`)\n\nIf there is a platform or utility not currently listed, please request it by creating an issue.\n\n## Platform specific notes/issues\n\n### Windows\n\n- On Windows, the `pywin32` package is installed as a requirement.\n- On Windows, additional clipboard formats are supported, including copying from a file \n(like if you right-click copy from File Explorer)\n\n### MacOS\n\nMacOS has support for multiple backends. By default, the `pasteboard` package is used.\n\n`pbcopy`/`pbpaste` can also be used as a backend, but does not support arbitrary binary data, which may lead to \ndata being lost on copy/paste. This backend may be removed in a future release.\n\n### Linux\n\nLinux on X11 requires `xclip` to work. Install with your package manager, e.g. `sudo apt install xclip`\nLinux on Wayland requires `wl-clipboard` to work. Install with your package manager, e.g. `sudo apt install wl-clipboard`\n\n# Acknowledgements\n\nBig thanks to [Howard Mao](https://github.com/zhemao) for donating the PyClip project name on PyPI to \nthis project.\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "Cross-platform clipboard utilities supporting both binary and text data.",
    "version": "0.7.0",
    "project_urls": {
        "Homepage": "https://github.com/spyoungtech/pyclip"
    },
    "split_keywords": [
        "pyperclip",
        "clipboard",
        "cross-platform",
        "binary",
        "bytes",
        "files"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7d4f4b02e2c232ddf694bca0baea3049b886eeb80ee3d89c415067f5191596c1",
                "md5": "608a174777858ef9dd737b040745ccd1",
                "sha256": "a7b7ea2cfad2dd61e86a529af588d006070d3eb0bd32981afaee5215f4604fec"
            },
            "downloads": -1,
            "filename": "pyclip-0.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "608a174777858ef9dd737b040745ccd1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18864,
            "upload_time": "2022-10-31T21:13:33",
            "upload_time_iso_8601": "2022-10-31T21:13:33.459636Z",
            "url": "https://files.pythonhosted.org/packages/7d/4f/4b02e2c232ddf694bca0baea3049b886eeb80ee3d89c415067f5191596c1/pyclip-0.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "658a98ed02d81dea4b2211a4746724d7a271264b701c991fed503c246de52864",
                "md5": "6f03fc99b9885686b8868798e027fd8e",
                "sha256": "57602047a4ceab709bdcd42f3dde6449a3349b95c16154cfdce27376a2072491"
            },
            "downloads": -1,
            "filename": "pyclip-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6f03fc99b9885686b8868798e027fd8e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13639,
            "upload_time": "2022-10-31T21:13:34",
            "upload_time_iso_8601": "2022-10-31T21:13:34.952553Z",
            "url": "https://files.pythonhosted.org/packages/65/8a/98ed02d81dea4b2211a4746724d7a271264b701c991fed503c246de52864/pyclip-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-10-31 21:13:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "spyoungtech",
    "github_project": "pyclip",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "pyclip"
}
        
Elapsed time: 0.18810s