Deprecating pyreplace and pymlreplace

  • Dave Brotherstone

    As you may have read, I've been working on a way long overdue new version of Python Script that will fix various minor bugs, and most importantly overhaul the replace functionality. The plan is that editor.replace will do the standard (non-regex) replacements, and editor.rereplace will take over all regex replacements. You can use a python function or lambda as the replacement, just as you could in pyreplace. It also has much better Unicode handling - you can give a Unicode string as the search and/or replace string, and it will work correctly on UTF-8/UCS-2 files and on ANSI. It's also way faster, and works reliably. Two features the old version sadly didn't have.

    What this means is pyreplace and pymlreplace will become deprecated.

    I'd like to just throw an error advising you to change to rereplace, but that does mean changing your scripts. The rereplace always works on the whole document, not on a line by line basis, so there /could/ be some logic changes to make in your scripts.

    A wrapper for pyreplace could be written, but given the changes to scripts should be minimal, I don't think it's worth it, as it would be quite a lot of work, just to support old scripts. If you've another opinion, post your comments here.


  • Ron Jensen

    Ron Jensen - 2014-03-03

    Hi Dave,

    I've been checking these pages from time to time waiting to see if this update is ready for beta testing yet?


    Ron Jensen

    • Dave Brotherstone

      Hi, and thanks for your interest.

      TL;DR: it's probably going to be another week or so.

      I had hoped to get it out before last weekend, but not everything was
      complete. The status so far is:
      search and replace has been rewritten from the ground up and is tested
      and working
      callbacks have been reworked so they're stable and tested
      the newest scintilla has been used to regenerate the bindings, and the
      new callbacks have been added
      Python has been updated to 2.7.6, and the old patch for N++ compatibility

      • All major functionality is covered by unit tests
      • Lots of bug fixes

      Still to complete is:
      make scintilla callbacks optionally synchronous - this makes several use
      cases for scintilla callbacks much easier, and allows python to generate
      auto complete lists correctly. This wasn't possible before, but with the
      new callback system it should be trivial
      testing the python 2.7.6 build - specifically import with Unicode paths
      * Fix for toolbar button text (this isn't essential, but the suggested fix
      isn't working - it'd be nice if it did)

      • package everything up with the new 2.7.6 python libraries

      Whilst I expect that none of the open points should take long, I have only
      tonight and tomorrow evening, then I've got visitors till Sunday night. I
      would hope my evenings next week are free enough to finish it off.



  • Dave Brotherstone

    Documentation needs updating too :)

  • Ron Jensen

    Ron Jensen - 2014-03-13

    So it looks like I'm going to spend the next week or two solid running rereplace() scripts... :)


Log in to post a comment.