README.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. Dulwich
  2. =======
  3. This is the Dulwich project.
  4. It aims to provide an interface to git repos (both local and remote) that
  5. doesn't call out to git directly but instead uses pure Python.
  6. **Main website**: <https://www.dulwich.io/>
  7. **License**: Apache License, version 2 or GNU General Public License, version 2 or later.
  8. SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
  9. The project is named after the part of London that Mr. and Mrs. Git live in
  10. the particular Monty Python sketch.
  11. Differences with other Python Git libraries
  12. -------------------------------------------
  13. Unlike other Python Git libraries, Dulwich is available as a standalone
  14. package that doesn't depend on git (like GitPython) being installed or any
  15. native code (like pygit2).
  16. This comes at the cost of speed, but makes it easier to deploy in environments
  17. where git isn't available or where it's important to have a pure Python
  18. implementation.
  19. To improve performance, Dulwich includes optional Rust bindings that can be
  20. used to speed up low-level operations.
  21. Installation
  22. ------------
  23. By default, Dulwich' setup.py will attempt to build and install the optional Rust
  24. extensions. The reason for this is that they significantly improve the performance
  25. since some low-level operations that are executed often are much slower in CPython.
  26. If you don't want to install the Rust bindings, specify the --pure argument to setup.py::
  27. $ python setup.py --pure install
  28. or if you are installing from pip::
  29. $ pip install --no-binary dulwich dulwich --config-settings "--build-option=--pure"
  30. Note that you can also specify --build-option in a
  31. `requirements.txt <https://pip.pypa.io/en/stable/reference/requirement-specifiers/>`_
  32. file, e.g. like this::
  33. dulwich --config-settings "--build-option=--pure"
  34. Getting started
  35. ---------------
  36. Dulwich comes with both a lower-level API and higher-level plumbing ("porcelain").
  37. For example, to use the lower level API to access the commit message of the
  38. last commit::
  39. >>> from dulwich.repo import Repo
  40. >>> r = Repo('.')
  41. >>> r.head()
  42. '57fbe010446356833a6ad1600059d80b1e731e15'
  43. >>> c = r[r.head()]
  44. >>> c
  45. <Commit 015fc1267258458901a94d228e39f0a378370466>
  46. >>> c.message
  47. 'Add note about encoding.\n'
  48. And to print it using porcelain::
  49. >>> from dulwich import porcelain
  50. >>> porcelain.log('.', max_entries=1)
  51. --------------------------------------------------
  52. commit: 57fbe010446356833a6ad1600059d80b1e731e15
  53. Author: Jelmer Vernooij <jelmer@jelmer.uk>
  54. Date: Sat Apr 29 2017 23:57:34 +0000
  55. Add note about encoding.
  56. Further documentation
  57. ---------------------
  58. The dulwich documentation can be found in docs/ and built by running ``make
  59. doc``. It can also be found `on the web <https://www.dulwich.io/docs/>`_.
  60. Help
  61. ----
  62. There is a *#dulwich* IRC channel on the `OFTC <https://www.oftc.net/>`_, and
  63. a `dulwich-discuss <https://groups.google.com/forum/#!forum/dulwich-discuss>`_
  64. mailing list.
  65. Contributing
  66. ------------
  67. For a full list of contributors, see the git logs or `AUTHORS <AUTHORS>`_.
  68. If you'd like to contribute to Dulwich, see the `CONTRIBUTING <CONTRIBUTING.rst>`_
  69. file and `list of open issues <https://github.com/dulwich/dulwich/issues>`_.
  70. Supported versions of Python
  71. ----------------------------
  72. At the moment, Dulwich supports (and is tested on) CPython 3.9 and later and
  73. Pypy.