python-bitcoin-utils icon indicating copy to clipboard operation
python-bitcoin-utils copied to clipboard

Improve Type Checking, Proxy Implementation, and Documentation

Open JAGADISHSUNILPEDNEKAR opened this issue 10 months ago • 2 comments

This PR addresses several TODO items related to type checking, proxy implementation, and documentation:

Type Checking Improvements

  • Added necessary type annotations and casting to proxy.py to ensure mypy compatibility
  • Updated mypy.ini configuration for Python 3.12 compatibility
  • Fixed issues with return type annotations to eliminate "Returning Any from function declared to return specific type" errors
  • Used explicit casting with cast() to ensure type safety while maintaining code clarity

Proxy Implementation Enhancements

  • Completely revamped the NodeProxy class with:
    • Comprehensive support for all major Bitcoin Core RPC methods
    • Better error handling with custom RPCError class
    • Full type annotations for better IDE integration
    • Detailed docstrings for all methods
    • Configurable connection parameters (host, port, timeout, HTTPS)
    • Backward compatibility with existing code

Documentation Improvements

  • Added comprehensive documentation for key modules:
    • Documentation for Address functionality (addresses.rst)
    • Documentation for SegWit functionality (segwit.rst)
    • Enhanced documentation for the Proxy module (proxy.rst)
  • Updated index.rst to include the new documentation files
  • Added Jupyter notebooks for interactive documentation:
    • keys_and_addresses.ipynb
    • proxy.ipynb

This PR is a significant step toward improving code quality, developer experience, and documentation as outlined in our TODO list. Would love to hear your feedback @karask

All tests pass Screenshot 2025-04-03 at 3 01 39 AM

JAGADISHSUNILPEDNEKAR avatar Apr 02 '25 21:04 JAGADISHSUNILPEDNEKAR

@karask As everything is related to documentation improvement and creation of Jupyter notebooks I have included them in the same PR No functional changes have been made( except the test_proxy.py file {which also has been handled properly}) Let me know if you are okay with this approach or need any other changes I would be happy to make it

JAGADISHSUNILPEDNEKAR avatar Apr 03 '25 11:04 JAGADISHSUNILPEDNEKAR

If you want I can split it into Multiple PRs Let me know how you want me to split it into as in what part you want in a particular PR

I was thinking of splitting it into 4 PRs

Documentation improvements (addresses.rst, segwit.rst, updated proxy.rst, index.rst updates) Type checking improvements (mypy.ini updates, type annotations in proxy.py) Proxy implementation enhancements (NodeProxy class revamp) Jupyter notebooks

let me know if you find this PR suitable or you want me to go ahead with this approach or anything which you might suggest Once again Thank you for your guidance

JAGADISHSUNILPEDNEKAR avatar Apr 05 '25 17:04 JAGADISHSUNILPEDNEKAR