Prepare for python 3.13
It is planned to upgrade ST's plugin ecosystem to python 3.13.
Support for python 3.3 is being sunset. It can already be disabled via settings and will be removed next year.
Therefore plugins need to be prepared to maintain compatible with python 3.13.
I've found references to __file__ and __name__ globals in your package.
As modern python 3.1x releases move on towards __spec__ and drop support for __file__ and __package__ globals, it is recommended to replace relevant references to ensure compatibility with upcoming ST dev builds.
If this package targets ST4 and python 3.8+ it is an easy change by just replacing:
__file__=>__spec__.origin__name__=>__spec__.name__package__=>__spec__.parent
Python 3.3 doesn't support __spec__ and would require a fallback.
A common pattern might be
try:
package_path = os.path.dirname(__spec__.origin)
except (AttributeError, NameError):
package_path = os.path.dirname(__file__)
FWIW, ST4107+ supports calling sublime.cache_path(), sublime.installed_packages_path() and sublime.packages_path() at import time, which may help to replace/avoid various constructs like given example above.
Thank you for this feedback.
-
__name__is used to trace class names (so it is not global). -
__file__is used to determine the SublimeText package name to work around a problem during updates. Sub-modules compiled from packages are not re-imported by default. So, I have to do it manually (a tricky bug !).
Therefore, I do not think there will be any problem with Python 3.13 (except I have to rebuild the module)
Out of curiosity, I looked at the number of downloads related to version 2 of SublimeText (python 2.6). It still accounts for 0.5%.
The one at File ".../Installed Packages/DoxyDoxygen (evolution).sublime-package/Doxy.py", line 17 certainly will.
This line uses __file__ to determine the package name (e.g. DoxyDoxygen (evolution)).
At the moment, I have no way to test it.
Since the editor will likely fall back to Python 3.8, this should not be an issue (even not optimal)
I prefer to test it before providing a public bytecode version for Python 3.13
The alternative is to use __spec__.origin as described in OP. It is supported as of python 3.8
FWIW, ST will replace python 3.8 by 3.13, so there won't be any fallback to 3.8.
Hi @20Tauri , just a FYI. ST 4202 which replaces py38 with py313, has been released as private beta if you need it for test. I am looking forward to a py313 build doxydoxygen.
- macOS: https://download.sublimetext.com/sublime_text_build_4202_mac.zip
- Windows 64bit installer: https://download.sublimetext.com/sublime_text_build_4202_x64_setup.exe
- Windows 64bit portable zip: https://download.sublimetext.com/sublime_text_build_4202_x64.zip
- Linux 64bit deb package: https://download.sublimetext.com/sublime-text_build-4202_amd64.deb
- Linux 64bit rpm package: https://download.sublimetext.com/sublime-text-4202-1.x86_64.rpm
- Linux 64bit pkg package: https://download.sublimetext.com/sublime-text-4202-1-x86_64.pkg.tar.xz
- Linux 64bit tar archive: https://download.sublimetext.com/sublime_text_build_4202_x64.tar.xz
- Linux arm64 deb package: https://download.sublimetext.com/sublime-text_build-4202_arm64.deb
- Linux arm64 pkg package: https://download.sublimetext.com/sublime-text-4202-1-aarch64.pkg.tar.xz
- Linux arm64 tar archive: https://download.sublimetext.com/sublime_text_build_4202_arm64.tar.xz
Thank you.
Unfortunately, I cannot access the beta (I no longer use Sublime Text and must await a trial version to do tests). Note that the 3.3 plugin host seems to be preserved. Users on version 4201+ will need to use the Sublime Text 3 release (python 3.3). I have just update the package control description to route to the "right" package. Not sure that a plugin update is currently forced for 3.8 packages on 4202+. Maybe a manual reinstallation will be needed...
"DocBlockr 2021 (DoxyDoxygen powered)" should not be affected by the problem
On Windows, Sublime now requires a missing VCRuntime140_1.dll and requires a manual installation of the VC Redist. Sounds like a regression
Note that the 3.3 plugin host seems to be preserved. Users on version 4201+ will need to use the Sublime Text 3 release (python 3.3).
Oh, that's an okay workaround for me. Thanks.