Hi Collin,

> > Feel free to do so. Either in GLFileSystem only, or globally - as you like.
> 
> I would prefer to do it globally. I find they make it easier to
> reference code. Since we have *some* of the information in docstrings,
> I would just remove those and turn them into actual type hints.

Yes. Sounds good.

> Since the type-hinting requires the
> 
>     from __future__ import annotations
> 
> wizardry for older versions of Python3, it would be nice for me to be
> able to confirm things remain compatible.

Sure. For the same purpose, I've already installed some past Python
releases, each from source and with a different --prefix. So that
I have a directory /inst-python

$ ls -1rt /inst-python/
3.7.17
3.8.19
3.9.19
3.10.14
3.11.8
3.12.2

with a 'python3' program for each:
$ ls -1rt /inst-python/*/bin/python3
/inst-python/3.7.17/bin/python3
/inst-python/3.8.19/bin/python3
/inst-python/3.9.19/bin/python3
/inst-python/3.10.14/bin/python3
/inst-python/3.11.8/bin/python3
/inst-python/3.12.2/bin/python3

and I can pick a specific Python version by prepending /inst-python/VERSION/bin
to PATH.

> Since we don't use (and probably won't ever have the need) for third
> party packages, what do you think of this patch adding the PYTHON
> environment variable?

I'm reluctant to add a dependency on yet another environment variable:
- What if some users have it already set, for a different purpose?
- What if users include options in this environment variable?
- It makes remote problem analysis harder.

> Most GNU/Linux distributions and FreeBSD package various python3.x
> packages. This would allow me to run the test case:
> 
>     $ env PYTHON=python3.7 GNULIB_TOOL_IMPL=py ./test-all.sh
> 
> This should be enough to ensure type hints + no future changes break
> compatibility with older Python versions.

You can use pre-built packages and use PATH to select the one:

  $ mkdir -p $HOME/choose-python/3.7

  $ ln -s /usr/bin/python3.7 $HOME/choose-python/3.7/python3
  or, if that does not work:
  $ { echo '#!/bin/sh'; echo 'exec /usr/bin/python3.7 "$@"'; } > 
$HOME/choose-python/3.7/python3
  $ chmod a+x $HOME/choose-python/3.7/python3

  $ PATH=$HOME/choose-python/3.7:$PATH

Admittedly this is a little bit more complicated (for you) than setting
an environment variable.

Bruno




Reply via email to