Community
    • Login

    Quick Question: what Python version for Pythonscript does everyone use?

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 26 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pbarneyP
      pbarney
      last edited by

      I’m writing a Pythonscript to share with the community, and I need to know what version to code it in.

      If I understand it correctly, the Pythonscript plugin can provide v2.7 support, but if you have a newer version installed on your system, it can use that. Is this right?

      If so, should I be coding for v2.7 or for a more modern version?

      PeterJonesP 1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @pbarney
        last edited by

        If I understand it correctly, the Pythonscript plugin can provide v2.7 support, but if you have a newer version installed on your system, it can use that. Is this right?

        No, you have conflated two ideas for the plugin: plugin’s Python version and plugin’s library location.

        • Version: The version of Python is 100% dependent on the plugin: you can either install

          • PythonScript plugin v2.1 from the PluginsAdmin menu or from its release page, and that will come with Python 2.7.
          • An alpha version of the PythonScript 3 plugin: pick the most recent from the releases page, which is currently v3.0.22, which comes with Python 3.12.9. (Still in Alpha because it only supports UTF-8-encoded files in Notepad++; if you are using ANSI character-set files, you will not want to pick PS3)
        • Library location: In Plugins > PythonScript > Configuration…, there is a checkbox for Prefer installed python libraries: if you have a standalone Python 2.7 (for plugin version 2.1) or 3.12 (for plugin 3.0.22-alpha) installed, then you can tell the plugin to look for python libraries in the installed location before looking in the plugin’s library-directory – this makes it easier to install a module with pip, and have it available to one of the scripts for PythonScript (though it blurs the lines between the separation of concerns: things for PythonScript are primarily for automating Notepad++ itself; if you just want to write a normal Python program using all your installed python libraries, don’t run it with the PythonScript plugin).

        If so, should I be coding for v2.7 or for a more modern version?

        If you are aiming the script at newbies – people who just want Notepad++ to do feature XYZ that isn’t in the main app – then stick with 2.7, because asking them to install the alpha plugin is asking for trouble. If you are aiming the script at power users or people who already know/use python, then you can require the alpha plugin which allows modern Python 3.12 syntax.

        1 Reply Last reply Reply Quote 3
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors