METADATA 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. Metadata-Version: 2.4
  2. Name: Send2Trash
  3. Version: 2.1.0
  4. Summary: Send file to trash natively under Mac OS X, Windows and Linux
  5. Author-email: Andrew Senetar <arsenetar@voltaicideas.net>
  6. License-Expression: BSD-3-Clause
  7. Project-URL: Homepage, https://github.com/arsenetar/send2trash
  8. Project-URL: Repository, https://github.com/arsenetar/send2trash.git
  9. Project-URL: Issues, https://github.com/arsenetar/send2trash/issues
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: Intended Audience :: Developers
  12. Classifier: Operating System :: MacOS :: MacOS X
  13. Classifier: Operating System :: Microsoft :: Windows
  14. Classifier: Operating System :: POSIX
  15. Classifier: Programming Language :: Python :: 3
  16. Classifier: Programming Language :: Python :: 3.8
  17. Classifier: Programming Language :: Python :: 3.9
  18. Classifier: Programming Language :: Python :: 3.10
  19. Classifier: Programming Language :: Python :: 3.11
  20. Classifier: Programming Language :: Python :: 3.12
  21. Classifier: Programming Language :: Python :: 3.13
  22. Classifier: Programming Language :: Python :: 3.14
  23. Classifier: Topic :: Desktop Environment :: File Managers
  24. Requires-Python: >=3.8
  25. Description-Content-Type: text/x-rst
  26. License-File: LICENSE
  27. Provides-Extra: test
  28. Requires-Dist: pytest>=8; extra == "test"
  29. Provides-Extra: nativelib
  30. Requires-Dist: pywin32>=305; sys_platform == "win32" and extra == "nativelib"
  31. Requires-Dist: pyobjc>=9.0; sys_platform == "darwin" and extra == "nativelib"
  32. Dynamic: license-file
  33. ==================================================
  34. Send2Trash -- Send files to trash on all platforms
  35. ==================================================
  36. Send2Trash is a small package that sends files to the Trash (or Recycle Bin) *natively* and on
  37. *all platforms*. On OS X, it uses native ``FSMoveObjectToTrashSync`` Cocoa calls or can use pyobjc
  38. with NSFileManager. On Windows, it uses native ``IFileOperation`` call if on Vista or newer and
  39. pywin32 is installed or falls back to ``SHFileOperation`` calls. On other platforms, if `PyGObject`_
  40. and `GIO`_ are available, it will use this. Otherwise, it will fallback to its own implementation of
  41. the `trash specifications from freedesktop.org`_.
  42. ``ctypes`` is used to access native libraries, so no compilation is necessary.
  43. Send2Trash supports Python 3 (versions before 2.x support Python 2).
  44. Status: Additional Help Welcome
  45. -------------------------------
  46. Additional help is welcome for supporting this package. Specifically help with the OSX and Linux
  47. issues and fixes would be most appreciated.
  48. Installation
  49. ------------
  50. You can download it with pip:
  51. python -m pip install -U send2trash
  52. To install with pywin32 or pyobjc required specify the extra `nativeLib`:
  53. python -m pip install -U send2trash[nativeLib]
  54. or download the source from https://github.com/arsenetar/send2trash and install it with:
  55. python -m pip install -e .
  56. On systems where Python enforces PEP 668 (e.g., recent Linux distributions),
  57. installing packages into the system Python may be restricted.
  58. Use a virtual environment:
  59. python -m venv .venv
  60. GNU/Linux / macOS:
  61. source .venv/bin/activate
  62. Windows:
  63. .venv\Scripts\activate
  64. Usage
  65. -----
  66. >>> from send2trash import send2trash
  67. >>> send2trash('some_file')
  68. >>> send2trash(['some_file1', 'some_file2'])
  69. On Freedesktop platforms (Linux, BSD, etc.), you may not be able to efficiently
  70. trash some files. In these cases, an exception ``send2trash.TrashPermissionError``
  71. is raised, so that the application can handle this case. This inherits from
  72. ``PermissionError``. Specifically, this affects
  73. files on a different device to the user's home directory, where the root of the
  74. device does not have a ``.Trash`` directory, and we don't have permission to
  75. create a ``.Trash-$UID`` directory.
  76. For any other problem, ``OSError`` is raised.
  77. .. _PyGObject: https://wiki.gnome.org/PyGObject
  78. .. _GIO: https://developer.gnome.org/gio/
  79. .. _trash specifications from freedesktop.org: http://freedesktop.org/wiki/Specifications/trash-spec/