Browse Source

Refer to Rust rather than C bindings

Jelmer Vernooij 7 months ago
parent
commit
92749cd5a9
7 changed files with 12 additions and 10 deletions
  1. 2 3
      CONTRIBUTING.rst
  2. 1 1
      README.rst
  3. 1 1
      docs/performance.txt
  4. 4 1
      dulwich/client.py
  5. 1 1
      dulwich/diff_tree.py
  6. 2 2
      dulwich/objects.py
  7. 1 1
      tests/test_objects.py

+ 2 - 3
CONTRIBUTING.rst

@@ -1,7 +1,6 @@
-All functionality should be available in pure Python. Optional C
+All functionality should be available in pure Python. Optional Rust
 implementations may be written for performance reasons, but should never
-replace the Python implementation. The C implementations should follow the
-kernel/git coding style.
+replace the Python implementation.
 
 Where possible include updates to NEWS along with your improvements.
 

+ 1 - 1
README.rst

@@ -16,7 +16,7 @@ in the particular Monty Python sketch.
 Installation
 ------------
 
-By default, Dulwich' setup.py will attempt to build and install the optional C
+By default, Dulwich' setup.py will attempt to build and install the optional Rust
 extensions. The reason for this is that they significantly improve the performance
 since some low-level operations that are executed often are much slower in CPython.
 

+ 1 - 1
docs/performance.txt

@@ -6,6 +6,6 @@ Possible areas for improvement
 
 Places for improvement, ordered by difficulty / effectiveness:
 
-* read_zlib() should have a C equivalent (~ 4% overhead atm)
+* read_zlib() should have a Rust equivalent (~ 4% overhead atm)
 * unpack_object() should have a C equivalent
 

+ 4 - 1
dulwich/client.py

@@ -1657,7 +1657,10 @@ class LocalGitClient(GitClient):
     """Git Client that just uses a local on-disk repository."""
 
     def __init__(
-        self, thin_packs=True, report_activity=None, config: Optional[Config] = None
+        self,
+        thin_packs: bool = True,
+        report_activity=None,
+        config: Optional[Config] = None,
     ) -> None:
         """Create a new LocalGitClient instance.
 

+ 1 - 1
dulwich/diff_tree.py

@@ -644,7 +644,7 @@ _is_tree_py = _is_tree
 _merge_entries_py = _merge_entries
 _count_blocks_py = _count_blocks
 try:
-    # Try to import C versions
+    # Try to import Rust versions
     from dulwich._diff_tree import (  # type: ignore
         _count_blocks,
         _is_tree,

+ 2 - 2
dulwich/objects.py

@@ -1020,7 +1020,7 @@ def sorted_tree_items(entries, name_order: bool):
         key_func = key_entry
     for name, entry in sorted(entries.items(), key=key_func):
         mode, hexsha = entry
-        # Stricter type checks than normal to mirror checks in the C version.
+        # Stricter type checks than normal to mirror checks in the Rust version.
         mode = int(mode)
         if not isinstance(hexsha, bytes):
             raise TypeError(f"Expected bytes for SHA, got {hexsha!r}")
@@ -1666,7 +1666,7 @@ for cls in OBJECT_CLASSES:
 _parse_tree_py = parse_tree
 _sorted_tree_items_py = sorted_tree_items
 try:
-    # Try to import C versions
+    # Try to import Rust versions
     from dulwich._objects import parse_tree, sorted_tree_items  # type: ignore
 except ImportError:
     pass

+ 1 - 1
tests/test_objects.py

@@ -890,7 +890,7 @@ class TreeTests(ShaFileCheckTests):
 
         # C/Python implementations may differ in specific error types, but
         # should all error on invalid inputs.
-        # For example, the C implementation has stricter type checks, so may
+        # For example, the Rust implementation has stricter type checks, so may
         # raise TypeError where the Python implementation raises
         # AttributeError.
         errors = (TypeError, ValueError, AttributeError)