Skip to content

[BUG]: Expose correct python interfaces#267

Merged
1a1a11a merged 1 commit intodevelopfrom
hxia/pyi
Jul 16, 2025
Merged

[BUG]: Expose correct python interfaces#267
1a1a11a merged 1 commit intodevelopfrom
hxia/pyi

Conversation

@haochengxia
Copy link
Copy Markdown
Collaborator

Expose Python methods rather than unwrapped C++ bindings.

@haochengxia haochengxia changed the title Fix: expose correct python interfaces [BUG]: Expose correct python interfaces Jul 16, 2025
@haochengxia haochengxia requested a review from Copilot July 16, 2025 01:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Python interface to expose proper Python classes instead of C++ binding functions, replacing individual *_init functions with object-oriented cache policy classes that inherit from a common base class.

  • Replaces C++ binding functions (e.g., FIFO_init, LRU_init) with proper Python classes (FIFO, LRU, etc.)
  • Introduces EvictionPolicyBase as a common base class for all cache policies
  • Adds new utility functions process_trace and process_trace_python_hook for trace processing
Comments suppressed due to low confidence (3)

libCacheSim-python/libcachesim/init.pyi:53

  • Parameter type references PythonHookCache but the class is defined as PythonHookCachePolicy. This should be PythonHookCachePolicy to match the class definition.
    cache: PythonHookCache,

libCacheSim-python/libcachesim/init.pyi:149

  • [nitpick] Parameter name ain_size_ratio is inconsistent with the original Ain_size_ratio (capitalized). Consider using Ain_size_ratio to maintain consistency with the original API.
    def __init__(self, cache_size: int, ain_size_ratio: float = 0.25, aout_size_ratio: float = 0.5) -> None: ...

libCacheSim-python/libcachesim/init.pyi:149

  • [nitpick] Parameter name aout_size_ratio is inconsistent with the original Aout_size_ratio (capitalized). Consider using Aout_size_ratio to maintain consistency with the original API.
    def __init__(self, cache_size: int, ain_size_ratio: float = 0.25, aout_size_ratio: float = 0.5) -> None: ...

@haochengxia haochengxia requested a review from 1a1a11a July 16, 2025 01:50
Copy link
Copy Markdown
Owner

@1a1a11a 1a1a11a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread libCacheSim-python/libcachesim/__init__.pyi
@1a1a11a 1a1a11a merged commit 9f55885 into develop Jul 16, 2025
11 checks passed
@haochengxia haochengxia deleted the hxia/pyi branch July 16, 2025 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants