Skip to content

Conversation

@themilkman
Copy link
Contributor

The latest ST 4201, which replaces py38 with py313, has been released as a private beta in the discord. See discord.com/channels/280102180189634562/650695903446827011/1432613579223339059

AnyTest has an import error with py313 because distutils has been removed (see: https://peps.python.org/pep-0632/#migration-advice)

Traceback (most recent call last):
  File "/opt/sublime_text/Lib/python313/sublime_plugin.py", line 316, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.13/importlib/__init__.py", line 88, in import_module
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1052, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/me/.config/sublime-text-3/Installed Packages/AnyTest.sublime-package/main.py", line 18, in <module>
    from .plugin import SCOPE_LAST, Plugin  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.config/sublime-text-3/Installed Packages/AnyTest.sublime-package/plugin/__init__.py", line 6, in <module>
    from . import cache, runners, settings, status, test_frameworks
  File "/home/me/.config/sublime-text-3/Installed Packages/AnyTest.sublime-package/plugin/test_frameworks/__init__.py", line 6, in <module>
    from .. import errors, settings, utils
  File "/home/me/.config/sublime-text-3/Installed Packages/AnyTest.sublime-package/plugin/utils.py", line 2, in <module>
    from distutils import spawn
ModuleNotFoundError: No module named 'distutils'

This PR replaces distutils with shutil as suggested in the pep above. With that, the plugin works now here. Disclaimer: I am not really a Python dev, so please take a close look on this before merging ;)

Moreover I do not know whether this will work with ST versions < 4201, thus the next release might better target 4201+.

And finally, thanks for AnyTest, I use it nearly daily for Ruby - a great tool!

@FichteFoll
Copy link

shutil.which was added in Python 3.3, so should be fine for any non-ST2 version.

@timfjord
Copy link
Owner

timfjord commented Nov 4, 2025

Great, thanks for the contribution @themilkman

@timfjord timfjord merged commit 2c25de8 into timfjord:main Nov 4, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants