Menu

Experimental Python CFFI bindings

Developers
2019-10-26
2020-10-04
  • Dimiter Naydenov

    Hello!

    Thank you for the great tool! I've been using it a lot for XML processing from Python, as an external tool. Lately I've been looking for a way to use it more efficiently, and managed to get working CFFI-based Python extension that allows direct access to the main functions of all commands from Python.

    Here's the repository: https://github.com/dimitern/xmlstarlet
    There seems to be some issues to publish Linux binary wheels on https://pypi.org, but locally it works on Linux and Mac OS X at least.

    I'll send updates once it's up and can be used.

    Cheers,
    Dimiter

     
  • Dimiter Naydenov

    It's working - I have binary wheels published for Linux and MacOSX, as well as the source distribution. It took some time to get all the details right, but I'm happy to report it works as expected.

     
    • Dimiter Naydenov

      Just a heads-up.
      The last release (xmlstarlet v1.6.6) I just pushed to https://pypi.org/project/xmlstarlet works quite nicely.
      I'm happy to say (after a lot of trial and error) I got the building of binary wheels for Python 3.6+ on Linux, MacOS, and Windows automated.

      P.S.
      Building on Windows proved quite challenging, I have to say. I got a MingGW64-based build to work using the master branch's mingw/GNUmakefile as a starting point, modified to use pre-built binaries of libxml2 / libxslt for x86_64 (for speed). I couldn't get rid of the msys-2.0 runtime dependency. Then I spent a couple of days adapting the win32 native build process of libxslt (using JScript configure.js) to produce NMAKE Makefile and compile with VS 2015 MSVC and produce a truly native binary with statically linked libxml2, lib(e)xslt.

      I'll be happy to contribute the build process for MSVC back to this project, if there's interest in a simple Windows native build process. If you're interested, check the sources in https://github.com/dimitern/xmlstarlet/tree/master/xmlstarlet (build_msvc.bat and win32*).

      Best,
      Dimiter

       

Log in to post a comment.