Wednesday, November 28, 2018
PyScripter project of the week (November 26) at SourceForge
Thursday, November 15, 2018
PyScripter v3.5.1 released
Wednesday, November 14, 2018
PyScripter v3.5 released
New features:
- Open and work with remote files from Windows and Linux machines as if they were local.
- Run and Debug scripts on remote Windows and Linux machines using SSH.
- Connection to python server with Windows named pipes. Avoids firewall issues. Requires the installation of pywin32 (pip install pywin32).
- IDE option to force the use of sockets for connection to the python server. (default True).
- New Editor commands Copy Line Up/Down (Shift+Alt+Up/Down) and Move Line Up/Down (Alt + Up/Down) as in Visual Studio.
- PyScripter icons given a facelift by Salim Saddaquzzaman.
- Upgraded rpyc to 4.x. As a result Python 2.5 is no longer supported.
Issues addressed:
Wednesday, October 31, 2018
Firewal issues resolved in forthcoming PyScripter 3.5
However there are users running under strictly controlled corporate environments in which even these "innocent" local TCP/IP connections are not allowed. So a few users could not load and connect to python. What can be done with the current version is:
- Enable the Internal Python Engine (Tools, Options, IDE options, Python, uncheck "Internal Interpreter hidden).
- Then go to the Python Versions dialog and try to load a python version.
> pip install pywin32
at the command prompt or using the pip External tool in PyScripter. If the module is not available in your python version PyScripter will revert to using sockets as before. There is a new IDE option "Always use sockets" that will prevent PyScripter from using named pipes. This option is on by default. So if your firewall prevents for using the remote python engine, you should switch this option off. (Tools, Options, IDE Options, Python Interpreter, "Always use sockets").
Monday, October 29, 2018
PyScripter understands type hints
class Airport:
def __init__(self, name:str):
self._name = name
@property
def location(self) -> str:
return self._name
class Flight:
def __init__(self, origin:str, dest:str):
self.origin = origin
self.dest = dest
class Plane:
def do_flight(self, fligth:Flight):
origin = fligth.origin #code completion flight.
dest = fligth.dest
print("I am flying from {origin} to {dest}".format(origin=origin, dest=dest))
def catch_plane() -> Plane:
return Plane();
Venizelos = Airport("Athens")
Fiumicino = Airport("Rome")
plane = catch_plane()
plane.do_flight(Flight(Venizelos.location, Fiumicino.location)) #code completion plane.
If you want full type checking of your code you can setup mypy as an external tool.
Thursday, October 25, 2018
Using PyScripter with QGIS
- copy python3.exe and python36.dll (or python37.dll for recent versions) from the bin folder (osgeo4w\bin) to the python folder (osgeo4w\apps\Python36 or osgeo4w\apps\Python36)
- rename python3.exe to python.exe
Using PyScripter with ArcGIS Pro
- Install ArcGIS Pro. I have used a single user installation and the product was installed in C:\Users\username\AppData\Local\Programs\ArcGIS\Pro.
- Start PyScripter 64bit v 3.4,2
- Go to the Python Versions dialog (Run, Python Versions, Setup Python..)
- Add a new version pressing the + button and select the path C:\Users\username\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3
- Activated the new unregistered version and pressing the first button
- If you get a firewall notification allow the connection and voila
Wednesday, October 17, 2018
PyScripter project of the week at Sourceforge
New Feature: Run and Debug files on remote Windows and Linux machines using SSH
Wednesday, October 10, 2018
Friday, October 5, 2018
Working with Remote Files. Preview of new feature.
Requirements
To use PyScripter with remote files your computer need to have SSH client capabilities at the computer running PyScripter and an SSH server running on the remote computer. SSH is a widely used network protocol for securely connecting to remote machines. Windows 10 since the April 2018 update includes SSH. With earlier versions of Windows 10 you need to manually enable SSH through "Enable Optional Features". For other versions of Windows you can install the latest version of OpenSSH for Windows using the provided installation instructions.Configuring the SSH client side
Pyscripter requires password-less authentication using rsa keys. You need to create the rsa keys and add them to the ssh-agent service which needs to be running. Your public key needs to be added to the ~/.ssh/authorised_keys file on the server side. Instructions are provided here.net start sshd
net start ssh-agent
commands. You can also configure these services to run automatically.
Testing the SSH connection
From a command prompt issue the following command:ssh username@hostname
You can open remote files using the File Menu. You are then shown the Open Remote File dialog shown below:
Setting up SSH Servers
Editing SSH sever information
Sunday, September 9, 2018
PyScripter version 3.4.2 released
New features:
- New Edit Command Read Only (#883)
- Files opened by PyScripter from the Python directory during debugging are read only by default to prevent accidental changes.
- Close All to the Right Editor command added (#886)
- New editor parameter [$-CurLineNumber] (#864)
- New IDE Option "File Explorer background processing”. Set to false if you get File Explorer errors.
- Console output including multiprocessing is now shown in interpreter (#891)
Saturday, May 5, 2018
PyScripter v3.4.0 released
- Faster loading times
- Initial support for running Jupyter notebooks inside PyScripter
- Syntax highlighting for JSON files
- New IDE option "Style Main Window Border"
- Find in Files and ToDo folders can include parameters (#828)
Tuesday, May 1, 2018
New feature: switching python versions
You can easily switch versions from the Python versions submenu (below) accessible from the Run menu, the application toolbar and the Python interpreter submenu.
Thursday, April 19, 2018
Tips for working with code folding
- Bird's eye view of a module:
- A. Fold All
- B Unfold classes
- Fold/unfold whole functions:
- A. Unfold All
- B Fold functions
- Now when you unfold a function it appears fully unfolded. If you want to fold it back just fold it with the mouse or with cursor on the function def select Fold Nearest.
- Fold out of a heavily nested function
- Press Ctrl+/ (Fold Nearest) a few times until you fold up to the level you want.
Tuesday, April 17, 2018
PyScripter Project of the Week at SourceForge
Sunday, April 15, 2018
Benchmark of Regular Expression Engines
- Delphi’s built-in engine (PCRE)
- A modified version of Jcl’s regular expression engine, also PCRE based. Three versions of this set up were tested:
- with Study and JIT enabled
- with Study and no JIT
- without Study and JIT
- Python’s built-in regular expression engine and
- A relative new comer FLRE a pascal-based regular expression engine.
Time | Match count
==============================================================================
Delphi's own TRegEx:
/Twain/ : 35.00 ms | 811
/(?i)Twain/ : 69.00 ms | 965
/[a-z]shing/ : 510.00 ms | 1540
/Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 581.00 ms | 262
/\b\w+nn\b/ : 548.00 ms | 262
/[a-q][^u-z]{13}x/ : 566.00 ms | 4094
/Tom|Sawyer|Huckleberry|Finn/ : 743.00 ms | 2598
/(?i)Tom|Sawyer|Huckleberry|Finn/ : 875.00 ms | 4152
/.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 2617.00 ms | 2598
/.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 2814.00 ms | 1976
/Tom.{10,25}river|river.{10,25}Tom/ : 421.00 ms | 2
/[a-zA-Z]+ing/ : 763.00 ms | 78423
/\s[a-zA-Z]{0,12}ing\s/ : 485.00 ms | 55201
/([A-Za-z]awyer|[A-Za-z]inn)\s/ : 1468.00 ms | 209
/["'][^"']{0,30}[?!\.]["']/ : 302.00 ms | 8885
Total Time: 12812.00 ms
==============================================================================
Modified TJclWideRegEx with Study and JIT:
/Twain/ : 9.00 ms | 811
/(?i)Twain/ : 30.00 ms | 965
/[a-z]shing/ : 74.00 ms | 1540
/Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 17.00 ms | 262
/\b\w+nn\b/ : 115.00 ms | 262
/[a-q][^u-z]{13}x/ : 181.00 ms | 4094
/Tom|Sawyer|Huckleberry|Finn/ : 18.00 ms | 2598
/(?i)Tom|Sawyer|Huckleberry|Finn/ : 50.00 ms | 4152
/.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 194.00 ms | 2598
/.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 216.00 ms | 1976
/Tom.{10,25}river|river.{10,25}Tom/ : 24.00 ms | 2
/[a-zA-Z]+ing/ : 168.00 ms | 78423
/\s[a-zA-Z]{0,12}ing\s/ : 97.00 ms | 55248
/([A-Za-z]awyer|[A-Za-z]inn)\s/ : 95.00 ms | 209
/["'][^"']{0,30}[?!\.]["']/ : 25.00 ms | 8885
Total Time: 1336.00 ms
==============================================================================
Modified TJclWideRegEx with Study no JIT:
/Twain/ : 11.00 ms | 811
/(?i)Twain/ : 42.00 ms | 965
/[a-z]shing/ : 272.00 ms | 1540
/Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 19.00 ms | 262
/\b\w+nn\b/ : 418.00 ms | 262
/[a-q][^u-z]{13}x/ : 384.00 ms | 4094
/Tom|Sawyer|Huckleberry|Finn/ : 23.00 ms | 2598
/(?i)Tom|Sawyer|Huckleberry|Finn/ : 209.00 ms | 4152
/.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 2664.00 ms | 2598
/.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 2730.00 ms | 1976
/Tom.{10,25}river|river.{10,25}Tom/ : 45.00 ms | 2
/[a-zA-Z]+ing/ : 627.00 ms | 78423
/\s[a-zA-Z]{0,12}ing\s/ : 279.00 ms | 55248
/([A-Za-z]awyer|[A-Za-z]inn)\s/ : 593.00 ms | 209
/["'][^"']{0,30}[?!\.]["']/ : 40.00 ms | 8885
Total Time: 8389.00 ms
==============================================================================
Modified TJclWideRegEx no Study no JIT:
/Twain/ : 10.00 ms | 811
/(?i)Twain/ : 43.00 ms | 965
/[a-z]shing/ : 341.00 ms | 1540
/Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 383.00 ms | 262
/\b\w+nn\b/ : 500.00 ms | 262
/[a-q][^u-z]{13}x/ : 659.00 ms | 4094
/Tom|Sawyer|Huckleberry|Finn/ : 716.00 ms | 2598
/(?i)Tom|Sawyer|Huckleberry|Finn/ : 984.00 ms | 4152
/.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 2769.00 ms | 2598
/.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 3130.00 ms | 1976
/Tom.{10,25}river|river.{10,25}Tom/ : 409.00 ms | 2
/[a-zA-Z]+ing/ : 845.00 ms | 78423
/\s[a-zA-Z]{0,12}ing\s/ : 501.00 ms | 55248
/([A-Za-z]awyer|[A-Za-z]inn)\s/ : 815.00 ms | 209
/["'][^"']{0,30}[?!\.]["']/ : 281.00 ms | 8885
Total Time: 12411.00 ms
============================================================================== Python Regular Expressions
Twain time: 0.00505 found mathces: 811
(?i)Twain time: 0.209 found mathces: 965
[a-z]shing time: 0.24 found mathces: 1540
Huck[a-zA-Z]+|Saw[a-zA-Z]+ time: 0.0807 found mathces: 262
\b\w+nn\b time: 0.513 found mathces: 262
[a-q][^u-z]{13}x time: 0.685 found mathces: 4081
Tom|Sawyer|Huckleberry|Finn time: 0.0715 found mathces: 2598
(?i)Tom|Sawyer|Huckleberry|Finn time: 0.93 found mathces: 4152
.{0,2}(Tom|Sawyer|Huckleberry|Finn) time: 0.957 found mathces: 2598
.{2,4}(Tom|Sawyer|Huckleberry|Finn) time: 0.935 found mathces: 1976
Tom.{10,25}river|river.{10,25}Tom time: 0.0922 found mathces: 2
[a-zA-Z]+ing time: 0.52 found mathces: 78423
\s[a-zA-Z]{0,12}ing\s time: 0.299 found mathces: 55201
([A-Za-z]awyer|[A-Za-z]inn)\s time: 0.358 found mathces: 209
["][^"]{0,30}[?!\.]["] time: 0.0175 found mathces: 5261
total time: 5910 ms
Time | Match count
==============================================================================
FLRE:
/Twain/ : 7.83 ms | 811
/(?i)Twain/ : 4.78 ms | 965
/[a-z]shing/ : 8.95 ms | 1540
/Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 8.14 ms | 262
/\b\w+nn\b/ : 50.53 ms | 262
/[a-q][^u-z]{13}x/ : 94.96 ms | 4094
/Tom|Sawyer|Huckleberry|Finn/ : 12.24 ms | 2598
/(?i)Tom|Sawyer|Huckleberry|Finn/ : 21.34 ms | 4152
/.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 47.25 ms | 2598
/.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 47.37 ms | 1976
/Tom.{10,25}river|river.{10,25}Tom/ : 46.06 ms | 2
/[a-zA-Z]+ing/ : 60.95 ms | 78423
/\s[a-zA-Z]{0,12}ing\s/ : 55.11 ms | 55248
/([A-Za-z]awyer|[A-Za-z]inn)\s/ : 10.76 ms | 209
/["'][^"']{0,30}[?!\.]["']/ : 49.21 ms | 8885
Total time: 542.93 ms
And the winner by a big margin is FLRE!
Notes:
Sunday, April 8, 2018
Jupyter notebooks in PyScripter
Jupiter notebooks are JSON files and PyScripter 3.4 provides syntax highlighting with code-folding for such files. To work with Jupiter notebooks you first need to install jupiter using pip. You can then select, Tools, Source Code Views, Web preview, to work inside the notebooks in the usual way. A Jupiter server is automatically started to support this.
You can also open a new notebook through File, New... and selecting the Jupiter notebook file template. You will be asked to save the empty notebook and then you will go straight into the new notebook to start work. The support for Jupiter notebooks should be considered at this stage experimental.
Friday, April 6, 2018
PyScripter v3.3.2 released
This hotfix release resolves a problem that may occur when running/debugging GUI scripts and a few minor other minor issues. It is available at Sourceforge.
Sunday, April 1, 2018
Turning your scripts into executables
Sometimes you may want to distribute your python work as a single .exe file. This post explains how to do it easily with PyScripter.
- If you do not see “Install packages with pip” under Tools Tools you first need to create a new Tool that helps you to use pip from PyScripter as explained in a separate blog post.
- Use the pip tool to install pyinstaller.
- Setup a new tool to use PyInstaller using Tools, Configure Tools, Add and completing the dialog box as shown below:
- Open in editor the script and invoke the new tool. You can watch the pyinstaller output in the Output window. After a short while and if everything goes smoothly your executable will be ready and can be found in a folder called “dist”, below your script.
- You could create another tool to easily test the generated executable, but I will leave that as a little challenge.
Friday, March 23, 2018
PyScripter v3.3.1 released
This is a hotfix release. It fixed an error in Tools, Options, IDE Options. It is available at Sourceforge.
Wednesday, March 21, 2018
Pyscripter version 3.3.0 released
PyScripter 3.3.0 is now available at Sourceforge. The major change in this version is the addition of thread debugging.
New features:- Thread debugging (#455)
- Much faster python output redirection
- Form Layout and placement stored in PyScripter.local.ini
Saturday, March 10, 2018
Thread Debugging
import time
import threading
import logginglogging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
)
class MyThread(threading.Thread):def run(self):
logging.debug('running')
time.sleep(3)
returnthreads =[]
for i in range(5):
t = MyThread()
t.start()
threads += [t]for t in threads:
t.join()
The scripts creates and starts 5 threads and waits for the threads to finish. The following layout is suggested for debugging:
Saturday, January 27, 2018
Pyscripter version 3.2.2 released
This is a hotfix release. It restores compatibility with Python 3.7a, which was broken due to some changes to the C API. It is available at Sourceforge.
Wednesday, January 24, 2018
Pyscripter version 3.2.1 released
This is a hotfix release. It addresses a regression due to which, in some situations, Unix line breaks were converted to Windows line breaks upon saving files. It also includes optimizations that significantly reduce the memory footprint of PyScripter. It is available at Sourceforge.
Monday, January 15, 2018
DPI awareness
The new version of PyScripter is DPI Aware. This means that by default on high DPI screens PyScripter will do its own scaling and will not rely on the scaling carried out by the operating system (Windows). Users with high DPI screens will see a considerable improvement in the way texts rendered and blurry text will no longer be an issue. Other users will monitors having the common 96 pixels per inch resolution, should not observe any noticeable difference.
If however you want to go back and rely on scaling carried out by Windows, you can do that if you are using Windows 10 and have the Creators Update installed. Find the executable file of PyScripter under Program Files, right click and select Properties. In the Compatibility tab check “Override high DPI scaling behaviour” and in the dropdown box select System (Enhanced) as shown below.
Pyscripter version 3.2.0 released
Monday, January 1, 2018
Using File Templates in PyScripter
https://epjmorris.wordpress.com/2016/02/08/working-with-script-templates-in-pyscripter/