moltenform / scite-files

Translations and extras for the SciTE code editor --- see the links below for more information!
123 stars 44 forks source link

Update mpheath's python script to v1.6 #60

Closed mpheath closed 1 year ago

mpheath commented 1 year ago

Update mpheath_gen_python_3_api.py

Version set to 1.6 for Python 3.2 to 3.11 or later.

With Python v3.9+, soft keywords like case and match are added to the output. Soft keyword _ is probably useless in an api file so it will not be added to the output.

Tested in Windows 10 virtual machine. Had some issues with running the script with Python v3.11.2 . The use of shebang

#! /usr/bin/env python3

causes the Windows Launcher py.exe to search the PATH for python3 as the use of env causes the PATH search. Windows 10 and Windows 11 distribute 0 byte sized files named python.exe and python3.exe in PATH . To avoid this trap with trying to run 0 byte sized files, I changed the shebang to

#!python3

The Python docs recommend /usr/... , though with a few examples to choose from and with UNIX based systems which may have different locations for python3, I chose just the filename itself and let it sort itself out.

benf-write commented 1 year ago

This looks great, thank you for contributing!

I will merge it within the next few days.

moltenform commented 1 year ago

Ran the script on my Windows machine and it worked first try. Uploaded the results to the page here too, https://github.com/moltenform/scite-files/blob/main/files/api_files.md (although your script is even better because it can get the current site packages).