METADATA 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. Metadata-Version: 2.3
  2. Name: rpds-py
  3. Version: 0.18.1
  4. Classifier: Development Status :: 3 - Alpha
  5. Classifier: Intended Audience :: Developers
  6. Classifier: License :: OSI Approved :: MIT License
  7. Classifier: Operating System :: OS Independent
  8. Classifier: Programming Language :: Rust
  9. Classifier: Programming Language :: Python :: 3.8
  10. Classifier: Programming Language :: Python :: 3.9
  11. Classifier: Programming Language :: Python :: 3.10
  12. Classifier: Programming Language :: Python :: 3.11
  13. Classifier: Programming Language :: Python :: 3.12
  14. Classifier: Programming Language :: Python :: 3
  15. Classifier: Programming Language :: Python :: Implementation :: CPython
  16. Classifier: Programming Language :: Python :: Implementation :: PyPy
  17. License-File: LICENSE
  18. Summary: Python bindings to Rust's persistent data structures (rpds)
  19. Keywords: data structures,rust,persistent
  20. Author-email: Julian Berman <Julian+rpds@GrayVines.com>
  21. License: MIT
  22. Requires-Python: >=3.8
  23. Description-Content-Type: text/x-rst; charset=UTF-8
  24. Project-URL: Documentation, https://rpds.readthedocs.io/
  25. Project-URL: Homepage, https://github.com/crate-py/rpds
  26. Project-URL: Issues, https://github.com/crate-py/rpds/issues/
  27. Project-URL: Funding, https://github.com/sponsors/Julian
  28. Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-rpds-py?utm_source=pypi-rpds-py&utm_medium=referral&utm_campaign=pypi-link
  29. Project-URL: Source, https://github.com/crate-py/rpds
  30. ===========
  31. ``rpds.py``
  32. ===========
  33. |PyPI| |Pythons| |CI|
  34. .. |PyPI| image:: https://img.shields.io/pypi/v/rpds-py.svg
  35. :alt: PyPI version
  36. :target: https://pypi.org/project/rpds-py/
  37. .. |Pythons| image:: https://img.shields.io/pypi/pyversions/rpds-py.svg
  38. :alt: Supported Python versions
  39. :target: https://pypi.org/project/rpds-py/
  40. .. |CI| image:: https://github.com/crate-py/rpds/workflows/CI/badge.svg
  41. :alt: Build status
  42. :target: https://github.com/crate-py/rpds/actions?query=workflow%3ACI
  43. .. |ReadTheDocs| image:: https://readthedocs.org/projects/referencing/badge/?version=stable&style=flat
  44. :alt: ReadTheDocs status
  45. :target: https://referencing.readthedocs.io/en/stable/
  46. Python bindings to the `Rust rpds crate <https://docs.rs/rpds/>`_ for persistent data structures.
  47. What's here is quite minimal (in transparency, it was written initially to support replacing ``pyrsistent`` in the `referencing library <https://github.com/python-jsonschema/referencing>`_).
  48. If you see something missing (which is very likely), a PR is definitely welcome to add it.
  49. Installation
  50. ------------
  51. The distribution on PyPI is named ``rpds.py`` (equivalently ``rpds-py``), and thus can be installed via e.g.:
  52. .. code:: sh
  53. $ pip install rpds-py
  54. Note that if you install ``rpds-py`` from source, you will need a Rust toolchain installed, as it is a build-time dependency.
  55. An example of how to do so in a ``Dockerfile`` can be found `here <https://github.com/bowtie-json-schema/bowtie/blob/e77fd93598cb6e7dc1b8b1f53c00e5aa410c201a/implementations/python-jsonschema/Dockerfile#L1-L8>`_.
  56. If you believe you are on a common platform which should have wheels built (i.e. and not need to compile from source), feel free to file an issue or pull request modifying the GitHub action used here to build wheels via ``maturin``.
  57. Usage
  58. -----
  59. Methods in general are named similarly to their ``rpds`` counterparts (rather than ``pyrsistent``\ 's conventions, though probably a full drop-in ``pyrsistent``\ -compatible wrapper module is a good addition at some point).
  60. .. code:: python
  61. >>> from rpds import HashTrieMap, HashTrieSet, List
  62. >>> m = HashTrieMap({"foo": "bar", "baz": "quux"})
  63. >>> m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37})
  64. True
  65. >>> m.remove("foo") == HashTrieMap({"baz": "quux"})
  66. True
  67. >>> s = HashTrieSet({"foo", "bar", "baz", "quux"})
  68. >>> s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"})
  69. True
  70. >>> s.remove("foo") == HashTrieSet({"bar", "baz", "quux"})
  71. True
  72. >>> L = List([1, 3, 5])
  73. >>> L.push_front(-1) == List([-1, 1, 3, 5])
  74. True
  75. >>> L.rest == List([3, 5])
  76. True