Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Improved Python bindings #3829

Merged
merged 9 commits into from
Oct 16, 2024
Merged

WIP: Improved Python bindings #3829

merged 9 commits into from
Oct 16, 2024

Commits on Oct 14, 2024

  1. WIP: update interface file

    ahankinson committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    68a00c4 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2024

  1. Fixed: Typo

    ahankinson committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    9d3c682 View commit details
    Browse the repository at this point in the history
  2. New: Enable "fastdeps" in SWIG

    This option generates a Python binding that executes the proxied C++ code faster.
    
    Adding the "olddeps" option generates a Python proxy with the correct method signatures so that calling code can treat it like Python, but the actual call is done with the proxied property.
    
    Note that another option, "builtin" was also tried, but this broke existing implementations so it was not suitable.
    
    For a comparison of the different methods see: https://www.swig.org/Doc4.2/Python.html#Python_optimization
    ahankinson committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    e821671 View commit details
    Browse the repository at this point in the history
  3. New: Type hints for Verovio

    Unlike the verovio.i file, where the type hints were in the proxy, but no other "direct" methods were typed, the .pyi file contains type hints for all the methods in the Python Verovio binding.
    
    The py.typed file signals that this package is typed. See: https://peps.python.org/pep-0561/
    ahankinson committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    2d90bda View commit details
    Browse the repository at this point in the history
  4. Fixed: Modify the SWIG bindings

    - Added a few methods to ignore that were anyway broken in the Python package and that used ostream arguments (difficult to know what type of data Python expects here)
    - The first argument for class methods is, by convention, 'self'. Modified this since the .pyi file used self for the "automatically" proxied code, and "toolkit" for the ones from the .i file.
    - Made "xml_id" consistent with "xmlId" arguments in the automatically-proxied code.
    - Added a proxy for "ValidatePAEFile" that turns the return string into a Python dictionary (same as "ValidatePAE")
    ahankinson committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    442ed3e View commit details
    Browse the repository at this point in the history
  5. Correct type annotation

    ahankinson committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    3d69d1f View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    d1fcace View commit details
    Browse the repository at this point in the history
  7. Remove obsolete c_wrapper

    As far as we know, this is no longer necessary?
    ahankinson committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    4be3859 View commit details
    Browse the repository at this point in the history
  8. Add py.typed to setup.py

    ahankinson committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    4068b7d View commit details
    Browse the repository at this point in the history