Thursday, February 27, 2025

Using QGIS - Update

 QGIS is a widely used, free and open source, GIS software package.  This is an update on how to use it with PyScripter.   I have used the currently latest version for Windows (3.42) but you can adapt the instructions to other recent versions of QGIS.

Create a command file "PyScripter-QGIS.cmd" with the following content:

@echo off
rem Adapt the following line to match your installation
set QGIS_ROOT=C:\Program Files\QGIS 3.42.0
call "%QGIS_ROOT%\bin\o4w_env.bat"
path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%
@echo on
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE=TRUE
set VSI_CACHE_SIZE=1000000
set GDAL_FILENAME_IS_UTF8=YES
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins
set PYTHONPATH=%QGIS_ROOT%\apps\qgis\python;%PYTHONPATH%
pushd "c:\Program Files\PyScripter"
rem Adapt the following line to match the python version that comes with QGIS
start "PyScripter" /B "PyScripter.exe" --PYTHON312 --PYTHONDLLPATH="%QGIS_ROOT%\apps\Python312"
popd

Save it anywhere you want and run it. 

Then in the PyScripter python interpreter you can do:

*** Python 3.12.9 (main, Feb  7 2025, 14:34:44) [MSC v.1938 64 bit (AMD64)] on win32. ***
*** Remote Python engine is active ***
>>> from qgis.core import *
>>> import qgis.utils
>>> from PyQt5.QtCore import QSettings
>>> 

That's it.

Sunday, February 9, 2025

PyScripter v5.2.1 released

PyScripter v5.2.1 is now available at Sourceforge.  This release brings a number of significant improvements in the areas of LLM-Assisted coding and Debugging.   This is the list of the main new features and fixes:

  • New Features:
    • LLM Support improvements
      • Added support for DeepSeek LLM
      • Added support for DeepSeek and OpenAI "o" LLM reasoning models
      • Improved display of LLM output
      • Syntax Highligting for 300 languges
      • Exposed the temperature LLM parameter
      • Printing of LLM output
    • Debugging
    • Surround editor selection with brackets and quotes
    • Added two new styles: Windows11 MineShaft (new default) and Windows 11 Impressive Light
  • Issues addressed:

DeepSeek and Other improvements to LLM-Assisted Coding

 The forthcoming version of PyScripter has a number of improvements to LLL-assisted coding:

 When it comes to coding, DeepSeek is simply amazing.  It is now supported both in the Chat and Assistant.

  • The rendering of the LLM responses is much improved and it is now on a par with the Web interface of the LLM providers.

Code is presented in code boxes, and using the icons in the header, you can copy the code into the clipboard or directly into a new editor.

Markdown is now rendered perfectly:


  • Support for DeepSeek and OpenAI LLM reasoning models

You can now follow the reasoning behind the answers, using DeepSeek's deepseek-reasoner model or OpenAI's "o" models, such o1-mini.  The reasoning is presented without cluttering the output.


 

  • Other improvements  

  • The temperature LLM model parameter is exposed by the Chat UI.   It is a decimal number between 0 and 2 that controls the randomness of the results (higher values leed to more random answers).
  • You can now print the chat topic content. 
  • Syntax highlighting for about 300 programming languages is available.  So you can now ask questions not just about python but also for other languages.

 And don't forget the Assistant.  While coding Assistant completion is available by pressing Ctrl+Alt+Space. as well as by using the editor context menu.