Skip to content

Commit

Permalink
Refer to Rust rather than C bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Aug 7, 2024
1 parent a107e66 commit 92749cd
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
5 changes: 2 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/performance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

5 changes: 4 additions & 1 deletion dulwich/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion dulwich/diff_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def changes_with_renames(
_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,
Expand Down
4 changes: 2 additions & 2 deletions dulwich/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -1666,7 +1666,7 @@ def _get_extra(self):
_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
2 changes: 1 addition & 1 deletion tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ def do_sort(entries):

# 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)
Expand Down

0 comments on commit 92749cd

Please sign in to comment.