commit 92749cd5a91f95334ab35a06479ecf6d2e89d0f8 from: Jelmer Vernooij date: Wed Aug 07 17:00:34 2024 UTC Refer to Rust rather than C bindings commit - a107e66a92bfcb253e3bd002d87c33927b126d39 commit + 92749cd5a91f95334ab35a06479ecf6d2e89d0f8 blob - 2fc0c2979b814029ff6f71f90065aa944cd71ccc blob + 8dbb1fa20714b6caaae5bc094fb58261d742e49b --- CONTRIBUTING.rst +++ 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. blob - 926141ec7155bb82c74d682f1eb1e6cb71b2c78d blob + 2abb9de16227bc1ebc030c7ecc0503ac4938030b --- README.rst +++ 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. blob - d2fd817f88027cd9c96bd7f8e026784cf85d2c83 blob + e5c04260cf10ed610fbf7f0cd6e0a6925b4c378f --- docs/performance.txt +++ 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 blob - 61dae810d378fc0c2f1fc530fb60b8c82c675c88 blob + 58b3cadebb283d765494edf4f3523577de485b4a --- dulwich/client.py +++ 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. blob - aada776d6239309fa009b4ada5dfdf453289483b blob + eeec9d48ddd89b5ccde8d4bed038590f2f69586a --- dulwich/diff_tree.py +++ 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, blob - 27c24013803e7a09146c6f060f43769e36d21bbb blob + 04e392508e73f6ba9c69b70206d8e4b030314dd7 --- dulwich/objects.py +++ 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 blob - 0d907f1e1b9529f39144093d2d8e354aae42278e blob + 8c6d18f5f2a31fea5682244f90281a0373b5b5ff --- tests/test_objects.py +++ 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)