astral-sh / astral-sh/python-build-standalone

Tcl's itcl and thread packages are broken on Linux

Open
#728 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
4.4k
Forks
314
Avg merge
1d 9h
Merged PRs (30d)
27

Description

This is loosely analogous to #723, but less pressing to me because these modules are part of Tcl's standard distribution and not causing any trouble with the build.

The following code works on some other distributions of Python (e.g., macOS system Python), but not currently in python-build-standalone (tested on Linux, haven't tested on macOS or Windows):
```pycon
>>> import tkinter
>>> t = tkinter.Tk(useTk=False)
>>> t.eval('package require Itcl')
Traceback (most recent call last):
File "", line 1, in
_tkinter.TclError: can't find package Itcl
>>> t.eval('package require Thread')
Traceback (most recent call last):
File "", line 1, in
_tkinter.TclError: can't find package Thread
```
(`useTk=False` is optional, it avoids the need for `$DISPLAY`.)

I cannot tell if this matters to anyone. I found [one StackOverflow question](https://stackoverflow.com/q/74033936/23392774), downvoted, where someone tried to use it but didn't have the right syntax. The correct syntax is in a comment, and the answer tells them not to do that. Sourcegraph returns no hits for `"package require Itcl" file:\.py$` nor `"package require Thread" file:\.py$` (but plenty for `file:\.tcl$`).

The reason it's broken currently is that we are shipping some .a files that are not particularly useful at runtime, and I think we'd need to actually link those files in like we do with libtcl.a and libtk.a. #676 gets rid of these .a files and presumably switches these to being .so files, which is more useful in that they _can_ be loaded at runtime, but those files aren't currently being included in the distribution. I think we could include them if anyone actually needs this without any trouble, but I'd like to have a concrete request for it, and a test case to make sure it's not accidentally broken and useless again. The .a files are a little over half a meg total, so if nobody's using them it is purely bloat.

I'm going to leave this open for a bit for comment if anyone wants to say "Hey, I'm using that!" or "Hey, I want to use that!" but I intend to clean out the remainder of the support files that aren't useful without the actual .so file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.