Friday, December 13, 2024

Create virtual environments the easy way

A powerful and possibly underused feature or PyScripter is the Externa Tools.  A collection of such tools is included with the installation, but you can create your own.

Virtual python environments are isolated workspaces, that allow you to install packages and test code, without messing up the main python installation.  After using them for a specific purpose you can just delete them.  Python ships with a module called venv, that allows you to easily create such virtual environments.

Instead of creating such environments from the command prompt you can create an external tool to do that.  You can can create new external tools using Tools, Configure Tools, Add.  You can then fill the information as in the image below.


You can run the created tool by selecting it from the Tools, Tools menu.  It will prompt you for a folder in which the virtual environment will be created and then will create the environment.  To use the created environment, you then go to Run, Python Versions, Setup Python Versions..., add a new unregistered python version at the new virtual environment folder and activate it.

If you are using Conda python distributions you can create an external tool to create conda virtual environments instead.  Note though, that conda virtual environments are much more heavyweight than the venv ones.

The next release of PyScripter will add such an external tool to new installations and you can easily add it to existing installations.

Thursday, December 12, 2024

Free-threaded python support is coming to PyScripter

One of the main limitations of Python has been its inability to make use of the multiple cores of modern CPUs, at least not easily. This is due to the infamous Global Interpreter Lock.  In essence, due to the presence of the GIL, only one python thread can execute at a time,

Python 3.13 has changed this and provides an experimental free-threaded (or No-GIL) version.  It is included in the standard installer, but you need to select the relevant option (see below) to install it.

Python 3.13 Windows Installer

What you get is a another python executable called python3.13t.exe alongside python.exe.   This executable runs the free-threaded version of python.

This RealPython article provides an in-depth coverage of free-threaded python and is recommended reading. .

The next version of PyScripter will include support for free-treaded Python. The Run, Python Engine submenu now includes an option to use the Free-Threaded version if is available.  It also allows you to easily switch between the standard and free-threaded version.


To get an idea of the performance benefits from using free-threaded python, here are the the results of running the benchmark code of the RealPython article without/with free-threading:

*** Python 3.13.0 (tags/v3.13.0:60403a5, Oct  7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32. ***
>>> =======================================================================
💻 Windows 64bit with 20x CPU cores (Intel64 Family 6 Model 151 Stepping 2, GenuineIntel Little Endian)
🐍 CPython 3.13.0 C:\Python\Python313\python.exe
Free Threading: unsupported
=======================================================================
Running 20 threads...: 15.07s


*** Python 3.13.0 experimental free-threading build (tags/v3.13.0*** Remote Interpreter Reinitialized ***
=======================================================================
💻 Windows 64bit with 20x CPU cores (Intel64 Family 6 Model 151 Stepping 2, GenuineIntel Little Endian)
🐍 CPython 3.13.0 C:\Python\Python313\python3.13t.exe
Free Threading: enabled ✨
========================================================================
Running 20 threads...: 2.81s



Thursday, November 21, 2024

SSH Engines broken by November 12, 2024 Windows update

If you are using SSH engines that rely on OpenSSH (and not PuTTY), you may find that they stopped working after the November 23 Windows 11 update.  The reason is that OpenSSH has been updated to version 9.5 and this affects how the scp command works. It now uses the SFTP mode by default and it breaks compatibility with earlier versions.

To fix this, you need to edit the settings of your ssh engine and add a new option –O to the scp command options.  This options instructs scp to work in a backward compatible manner.  With this change you will find that your SSH engines work as before the update.

Monday, October 28, 2024

Saturday, October 26, 2024

Teaser: Colored highlight of program structure is coming to PyScripter

The PyScripter editor had the option to show indentation guides (thin vertical lines that help you visualize blocks of python code).  This feature has been enhanced and it is now using colors to help you better understand the python code structure.  See the picture below:


The option is enabled by the default.  You can disable by unchecking the option using Tools, Options, IDE Options, Editor, "Indentation Guides", "Highlight Structure".

Teaser: Display of program flow control symbols is coming to PyScripter

The next version of PyScripter will be able to display program flow control symbols (small arrows next to return/continue/break/yield statements), that help you visualize and better understand the flow of execution:

See the picture below:


You can enable/disable this feature through, Tools, Options, IDE Options, Editor, "Display flow control symbols".  You can also customize their color.
 

Wednesday, October 23, 2024

Teaser: Annotated scrollbars are coming to PyScripter

 


In this screenshot you can see in the scrollbar:

  • the position of the multiple carets (full blueish line)
  • lines with errors (full red line)
  • the position of the bookmarks (mini bluish marks on the left)
  • line modification info (on the right side)
  • alpha-blended slider

Wednesday, October 16, 2024

PyScripter on Windows 7

Windows 7 share of the Windows market is under 3% and declining.Microsoft stopped support for Win 7 on January 2020.  Python no longer supports Win7 since version 3.9.  However there are still quite a few PyScripter users on Win 7.  

I recently  got an issue report that the latest versions 5.x do not paint well on Windows 7.  The problem was resolved when the user activated an Aero theme instead of a classic one.  So, if you are on Windows 7 and want to use PyScripter you still can.

If you have trouble activating an Aero theme please have a look a this troubleshooting guide.

Thursday, October 10, 2024

Teaser: Multi-caret editing is coming to PyScripter

The series of short videos that follow, introduce the forthcoming new multi-caret and multi-selection editing capabilities of PyScripter. They can also serve as a tutorial on how to effectively use them for more productive code editing.

Multiple carets and selections using the mouse

Takeaways:

  • Alt + Mouse click:  Adds new caret
  • Alt + Mouse move: Adds new selection
  • Alt + Shift + Mouse click/move: Selects column mode

Multiple carets and selections using the keyboard


Takeaways:

  • Alt + Shift + Left/Right/Up/Down/PgUp/PgDown: Selects column mode
  • Alt + End: Adds carets to the end of the lines in the current selection


Editing with multiple carets and selections



Takeaways:

  • Most editing commands work with multiple carets and selections

Copying and pasting with multiple selections

Takeaways:

  • If the number of carets when you copy, is equal to the number of carets when you paste, copying is taking place on a one-to-one basis.  Otherwise, the full selected text is copied.

Selecting matching words and text

Takeaways:

  • Ctrl + W: Adds the next matching word as a new selection
  • Shift +Ctrl + W: Selects all matching occurrences of the current selection




Tuesday, September 10, 2024

PyScripter v5.0.1 released

PyScripter v5.0.1 is now available at Sourceforge. Google’s Gemini LLM has been added to the list of supported LLM service providers.  Low usage of Gemini is free, so this makes it a great choice for working with PyScripter’s LLM-assisted coding.  See this wiki page to get started.

  • New features:
    • Support for Google's Gemini LLM
  • Issues addressed:

Sunday, June 30, 2024

PyScripter 5.0.0 released

PyScripter 5.0.0 is now available at Sourceforge.  The headline item in this release is the introduction of LLM-assisted coding.  Large Language Models (LLMs) have the potential of transforming the coding experience and increasing programmer productivity to new levels.  Click on the links below to find out more and watch the demo videos in this blog post.

New features:

  •  Integrated LLM support
  • OpenAI and local LLM models using Ollama supported
  • New IDE Window Chat for interacting with Large Language Models
  • Code Assistant functionality (Suggest, Find bugs, Optimize, Comment)
  • Python 3.13 support added.  Dropped support for python 3.7
  • Updated and improved documentation (Help file)

Issues addressed:

Sunday, June 23, 2024

Teaser: Integration with LLM

The videos below showcase some of the forthcoming functionality related to the integration of LLM technology with PyScripter.  OpenAI and local models using Ollama are supported.

Assistant code completion (1): 



Assistant code completion (2): 


Fix bugs:



Chat with LLM (1):



Chat with LLM (2):