{ "info": { "author": "Toby Fleming", "author_email": "tobywf@users.noreply.github.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: MacOS X :: Cocoa", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Programming Language :: Objective C", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Desktop Environment", "Topic :: Software Development :: Libraries" ], "description": "Pasteboard\n==========\n\n`Pasteboard`_ exposes Python bindings for reading and writing macOS' AppKit\n`NSPasteboard`_. This allows retrieving different formats (HTML/RTF fragments,\nPDF/PNG/TIFF) and efficient polling of the pasteboard.\n\nInstallation\n------------\n\nObviously, this module will only compile on **macOS**:\n\n.. code-block:: bash\n\n pip install pasteboard\n\nUsage\n-----\n\nGetting the contents\n^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python3\n\n >>> import pasteboard\n >>> pb = pasteboard.Pasteboard()\n >>> pb.get_contents()\n 'pasteboard'\n >>> pb.get_contents(diff=True)\n >>>\n\nUnsurprisingly, ``get_contents`` gets the contents of the pasteboard. This method\ntakes two optional arguments:\n\n**type** - The format to get. Defaults to ``pasteboard.String``, which corresponds\nto `NSPasteboardTypeString`_. See the ``pasteboard`` module members for other\noptions such as HTML fragment, RTF, PDF, PNG, and TIFF. Not all formats of\n`NSPasteboardType`_ are implemented.\n\n**diff** - Defaults to ``False``. When ``True``, only get and return the contents\nif it has changed since the last call. Otherwise, ``None`` is returned.\nThis can be used to efficiently monitor the pasteboard for changes, which must\nbe done by polling (there is no option to subscribe to changes).\n\n``get_contents`` will return the appropriate type, so `str`_ for string types,\nand `bytes`_ for binary types. ``None`` is returned when:\n\n* There is no data of the requested type (e.g. an image was copied but a string was requested).\n* **diff** is ``True``, and the contents has not changed since the last call.\n* An error occurred.\n\nSetting the contents\n^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python3\n\n >>> import pasteboard\n >>> pb = pasteboard.Pasteboard()\n >>> pb.set_contents('pasteboard')\n True\n >>>\n\nAnalogously, ``set_contents`` sets the contents of the pasteboard. This method\ntakes two arguments:\n\n**data** - `str`_ or `bytes-like object`_, required. There is no type checking.\nSo if ``type`` indicates a string type and ``data`` is bytes-like but not UTF-8\nencoded, the behaviour is undefined.\n\n**type** - The format to set. Defaults to ``pasteboard.String``, which corresponds\nto `NSPasteboardTypeString`_. See the ``pasteboard`` module members for other\noptions such as HTML fragment, RTF, PDF, PNG, and TIFF. Not all formats of\n`NSPasteboardType`_ are implemented.\n\n``set_contents`` will return ``True`` if the pasteboard was successfully set;\notherwise, ``False``. It may also throw `RuntimeError`_ if ``data`` can't be\nconverted to an AppKit type.\n\nDevelopment\n-----------\n\n(You don't need to know this if you're not changing ``pasteboard.m`` code.)\n\nIn the repository, I've included a ``Pipfile`` that can be used with `pipenv`_\nto install all dependencies for testing (pasteboard has no Python dependencies\nitself). There are some integration tests in ``tests.py`` to check the module\nworks as designed (using `pytest`_ and `hypothesis`_).\n\n.. code-block:: console\n\n $ pipenv install\n $ pipenv run pytest tests.py --hypothesis-show-statistics\n\nTo clean up:\n\n.. code-block:: console\n\n $ pipenv --rm\n $ rm -rf \\\n .hypothesis/ \\\n .pytest_cache/ \\\n build/ \\\n pasteboard.egg-info/ \\\n __pycache__/ \\\n pasteboard.*.so \\\n Pipfile.lock\n\n.. _Pasteboard: https://pypi.org/project/pasteboard/\n.. _NSPasteboard: https://developer.apple.com/documentation/appkit/nspasteboard\n.. _NSPasteboardTypeString: https://developer.apple.com/documentation/appkit/nspasteboardtypestring?language=objc\n.. _NSPasteboardType: https://developer.apple.com/documentation/appkit/nspasteboardtype?language=objc\n.. _str: https://docs.python.org/3/library/stdtypes.html#str\n.. _bytes: https://docs.python.org/3/library/stdtypes.html#bytes\n.. _bytes-like object: https://docs.python.org/3/glossary.html#term-bytes-like-object\n.. _RuntimeError: https://docs.python.org/3/library/exceptions.html#RuntimeError\n.. _pipenv: https://docs.pipenv.org/\n.. _pytest: https://docs.pytest.org/en/latest/\n.. _hypothesis: https://hypothesis.readthedocs.io/en/latest/\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tobywf/pasteboard", "keywords": "macOS clipboard pasteboard", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "pasteboard", "package_url": "https://pypi.org/project/pasteboard/", "platform": "", "project_url": "https://pypi.org/project/pasteboard/", "project_urls": { "Homepage": "https://github.com/tobywf/pasteboard" }, "release_url": "https://pypi.org/project/pasteboard/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "Pasteboard - Python interface for reading from NSPasteboard (macOS clipboard).", "version": "0.2.0" }, "last_serial": 3889993, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "9539058af76ce3476efc87f601f27f8f", "sha256": "dd1cb085e1d5ec83f10fbc14084aef816509bc6bfa715ca0c126afd878ba629d" }, "downloads": -1, "filename": "pasteboard-0.1.0.tar.gz", "has_sig": false, "md5_digest": "9539058af76ce3476efc87f601f27f8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4906, "upload_time": "2017-12-10T19:26:41", "url": "https://files.pythonhosted.org/packages/1c/b7/997699586d2ea0547f133990a4dcd7083890263411fb40c5f64d18b0103e/pasteboard-0.1.0.tar.gz" } ], "0.1.0.dev1": [ { "comment_text": "", "digests": { "md5": "18985932c6a4ffc3a69640b454877077", "sha256": "c33d3a1c9ade14ab769f53d8873ec1b866db79ee6e052b27f52443571a592721" }, "downloads": -1, "filename": "pasteboard-0.1.0.dev1-cp36-cp36m-macosx_10_12_x86_64.whl", "has_sig": false, "md5_digest": "18985932c6a4ffc3a69640b454877077", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 19795, "upload_time": "2017-12-10T19:56:31", "url": "https://files.pythonhosted.org/packages/09/68/bc470b6bd0d5e165bbbf6730925458d0a8f57268e0beb6b9b53ee93e8fa5/pasteboard-0.1.0.dev1-cp36-cp36m-macosx_10_12_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "5e7272d4e0cbb0d7c776bbc08d3f62bd", "sha256": "9d3e5b83557c31fbdbb18b2afa3bd14f82693103b2e34991e09c7380b439a18d" }, "downloads": -1, "filename": "pasteboard-0.1.0.dev1.tar.gz", "has_sig": false, "md5_digest": "5e7272d4e0cbb0d7c776bbc08d3f62bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16871, "upload_time": "2017-12-10T19:56:34", "url": "https://files.pythonhosted.org/packages/0b/b6/981829580d68f71878d19f85e78c2435386b6198b2bc6064dc1684e1814f/pasteboard-0.1.0.dev1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "eb5f18deeea43baced0ca59a6732ef5b", "sha256": "2ffbcd7f89a5dc9a8b4f8fde387ae1176a8ad379cca1ae1627381fc08b3074a9" }, "downloads": -1, "filename": "pasteboard-0.2.0-cp36-cp36m-macosx_10_12_x86_64.whl", "has_sig": false, "md5_digest": "eb5f18deeea43baced0ca59a6732ef5b", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 19361, "upload_time": "2018-05-23T03:49:30", "url": "https://files.pythonhosted.org/packages/a8/6f/57783ecbeae3aa65d88585875d97a048371927f78d28833283cea91b4f78/pasteboard-0.2.0-cp36-cp36m-macosx_10_12_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "2655b42ca27ed72d67223b6add43e9e6", "sha256": "17859c01e247d23edb83cd3caf51abd6abc89f3795402b069529b2a7dd80b57d" }, "downloads": -1, "filename": "pasteboard-0.2.0.tar.gz", "has_sig": false, "md5_digest": "2655b42ca27ed72d67223b6add43e9e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18097, "upload_time": "2018-05-23T03:49:32", "url": "https://files.pythonhosted.org/packages/a5/ff/52cc670a1cc4d86987c727a545036972ab0441d965aa9dd5becc1ecbb3d7/pasteboard-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eb5f18deeea43baced0ca59a6732ef5b", "sha256": "2ffbcd7f89a5dc9a8b4f8fde387ae1176a8ad379cca1ae1627381fc08b3074a9" }, "downloads": -1, "filename": "pasteboard-0.2.0-cp36-cp36m-macosx_10_12_x86_64.whl", "has_sig": false, "md5_digest": "eb5f18deeea43baced0ca59a6732ef5b", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 19361, "upload_time": "2018-05-23T03:49:30", "url": "https://files.pythonhosted.org/packages/a8/6f/57783ecbeae3aa65d88585875d97a048371927f78d28833283cea91b4f78/pasteboard-0.2.0-cp36-cp36m-macosx_10_12_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "2655b42ca27ed72d67223b6add43e9e6", "sha256": "17859c01e247d23edb83cd3caf51abd6abc89f3795402b069529b2a7dd80b57d" }, "downloads": -1, "filename": "pasteboard-0.2.0.tar.gz", "has_sig": false, "md5_digest": "2655b42ca27ed72d67223b6add43e9e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18097, "upload_time": "2018-05-23T03:49:32", "url": "https://files.pythonhosted.org/packages/a5/ff/52cc670a1cc4d86987c727a545036972ab0441d965aa9dd5becc1ecbb3d7/pasteboard-0.2.0.tar.gz" } ] }