You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(.venv) C:\clones\typeshed>tests\runtests -h
usage: runtests.py [-h] [--run-stubtest] [--python-version {3.9,3.10,3.11,3.12,3.13}] path
positional arguments:
pathPath of the stub to test in format<folder>/<stub>, from the root of the project.
...
(.venv) C:\clones\typeshed>tests\runtests.py /clones/typeshed/stdlib/ast.pyi
usage: runtests.py [-h] [--run-stubtest] [--python-version {3.9,3.10,3.11,3.12,3.13}] path
runtests.py: error: 'path' argument should be in format<folder>/<stub>.
Oh, oops!
(.venv) C:\clones\typeshed>tests\runtests.py stdlib/ast.pyi
...
--- TEST SUMMARY: One or more tests failed. See above for details. ---
pre-commit Success
Check structure: Success
Pyright: Success
mypy: Success
stubtest: Success
pytype: Failed
Pyright regression tests: Success
mypy regression test: Success
I troubleshoot for at least two hours, including reinstalling venv and installing editable ts_utils.
# to typeshed. Installing ts_utils editable would solve that, see
Now, pytype passes if I run it directly.
(.venv) C:\clones\typeshed\tests>pytype_test.py --print-stderr --typeshed-location /clones/typeshed \clones\typeshed\stdlib\ast.pyi
Testing files with pytype...
Ran pytype with 1 pyis, got 0 errors.
Interesting! I used to use Windows, and ran this script regularly, and never ran into any problems. I believe @Avasam still uses Windows, and he was the original author of this script, so it surprises me that it doesn't work on your machine. I was under the impression that / was a valid path separator on Windows, it just wasn't the default separator.
I don't mind too much making the changes you suggest, but I'm surprised that they're necessary. Are you able to give us any more information about your setup?
I was under the impression that / was a valid path separator on Windows, it just wasn't the default separator.
It is.
Either slashes should work fine. (even prepended by ./ or .\ due to tab-completion)
I'm guessing an issue with the pytype script (found 1-2 whilst working on #13795, I just haven't taken the time to extract them). In fact, I cannot replicate this failure on that branch (but I can on main!)
tbf it's possible I missed issues with the pytype script (or passing args to it) as I never run it under Windows. Reason being I prefer Python 3.13 for the new REPL (and pytype doesn't support 3.13). My alternate venv is for Linux (which I just run under WSL2, almost exclusively for pytype)
In other words, I see tests\runtests.py stdlib/ast.pyi failing as the bug.
I generally avoid backslashes in doc/helpers because they can be very annoying to copy (copying a path on windows and deduplicating \\ is so annoying. So is copying a backslash somewhere and having it accidentally escape a character)
Yes, here is some more info. It's pretty much what @Avasam found.
(.venv) C:\clones\typeshed>tests\pytype_test.py --print-stderr stdlib/ast.pyi
Testing files with pytype...
Traceback (most recent call last):
File "C:\clones\typeshed\tests\pytype_test.py", line 88, in run_pytype
ast = loader.load_file(_get_module_name(filename), filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\clones\typeshed\tests\pytype_test.py", line 115, in _get_module_name
assert parts[0] =="stubs"^^^^^^^^^^^^^^^^^^^
AssertionError
Ran pytype with 1 pyis, got 1 errors.
stdlib/ast.pyi (3.12): AssertionError
Run again with --print-stderr to get the full stacktrace.
(.venv) C:\clones\typeshed>tests\pytype_test.py --print-stderr stdlib\ast.pyi
Testing files with pytype...
Ran pytype with 1 pyis, got 0 errors.
installing pytype
Ahh, that explains it. I never actually ran pytype_test.py on Windows (could never be bothered to get WSL setup 😃)
I installed pytype in the following way. Should I trust the installation? (I do not understand wheels and eggs and unwheels or whatever the other methods are.)
I am very surprised that I did not need to install ts_utils as editable. (The above installation.)
Right now editable install of ts_utils would only be needed so that you don't need to re-install every time you do a modification.
It would also be a nice-to-have to ensure some path locations independent of current working directory.
pip install pytype
That is indeed how you should install pytype. The latest version is Windows compatible.
It's just that pytype doesn't work on Python 3.13 yet.
(I'm sorry for going so far off topic, but this issue has vexed me since my first Python modules. And thank you both for the feedback and questions. @AlexWaygood )
I was under the impression that / was a valid path separator on Windows, it just wasn't the default separator. @AlexWaygood
It is.
Either slashes should work fine. (even prepended by ./ or .\ due to tab-completion) @Avasam
FYI, more precisely, a forward slash /can be valid. For example:
(.venv) C:\apps\astToolkit>cd typeshed/stdlib
(.venv) C:\apps\astToolkit\typeshed\stdlib>cd ../..
(.venv) C:\apps\astToolkit>pushd typeshed/stdlib
The syntax of the command is incorrect.
(.venv) C:\apps\astToolkit>pushd "typeshed/stdlib"
(.venv) C:\apps\astToolkit\typeshed\stdlib>pushd /?
Stores the current directory for use by the POPD command, then
changes to the specified directory.
PUSHD [path | ..]
path Specifies the directory to make the current directory.
If Command Extensions are enabled the PUSHD command accepts
network paths in addition to the normal drive letter and path.
If a network path is specified, PUSHD will create a temporary
drive letter that points to that specified network resource and
then change the current drive and directory, using the newly
defined drive letter. Temporary drive letters are allocated from
Z: on down, using the first unused drive letter found.
pushd doesn't have switches, so the cmd interpreter isn't confusing the forward slash for a switch. In this case, the forward slash is interpreted as a malformed server path, not as part of a path.
Furthermore, the syntax for path is strict.
(.venv) C:\apps\astToolkit>pushd 'typeshed/stdlib'
The syntax of the command is incorrect.
Activity
AlexWaygood commentedon May 4, 2025
Interesting! I used to use Windows, and ran this script regularly, and never ran into any problems. I believe @Avasam still uses Windows, and he was the original author of this script, so it surprises me that it doesn't work on your machine. I was under the impression that
/was a valid path separator on Windows, it just wasn't the default separator.I don't mind too much making the changes you suggest, but I'm surprised that they're necessary. Are you able to give us any more information about your setup?
Avasam commentedon May 4, 2025
It is.
Either slashes should work fine. (even prepended by
./or.\due to tab-completion)I'm guessing an issue with the pytype script (found 1-2 whilst working on #13795, I just haven't taken the time to extract them). In fact, I cannot replicate this failure on that branch (but I can on main!)
tbf it's possible I missed issues with the pytype script (or passing args to it) as I never run it under Windows. Reason being I prefer Python 3.13 for the new REPL (and pytype doesn't support 3.13). My alternate venv is for Linux (which I just run under WSL2, almost exclusively for pytype)
In other words, I see
tests\runtests.py stdlib/ast.pyifailing as the bug.I generally avoid backslashes in doc/helpers because they can be very annoying to copy (copying a path on windows and deduplicating
\\is so annoying. So is copying a backslash somewhere and having it accidentally escape a character)Avasam commentedon May 4, 2025
Line 101 assumes filename is using system's default separator.
Line 115 asserts.
typeshed/tests/pytype_test.py
Lines 97 to 117 in a4d3f6f
AlexWaygood commentedon May 4, 2025
Ahh, that explains it. I never actually ran pytype_test.py on Windows (could never be bothered to get WSL setup 😃)
hunterhogan commentedon May 5, 2025
Yes, here is some more info. It's pretty much what @Avasam found.
installing pytype
I installed pytype in the following way. Should I trust the installation? (I do not understand wheels and eggs and unwheels or whatever the other methods are.)
editable wasn't necessary
I am very surprised that I did not need to install ts_utils as editable. (The above installation.)
Avasam commentedon May 5, 2025
Right now editable install of
ts_utilswould only be needed so that you don't need to re-install every time you do a modification.It would also be a nice-to-have to ensure some path locations independent of current working directory.
That is indeed how you should install pytype. The latest version is Windows compatible.
It's just that pytype doesn't work on Python 3.13 yet.
hunterhogan commentedon May 5, 2025
Wait, are you saying "blindness to path locations" is a Python-wide issue and not merely one of the eleventy jillion things I don't know how to do?!
hunterhogan/hunterMakesPy#1
(I'm sorry for going so far off topic, but this issue has vexed me since my first Python modules. And thank you both for the feedback and questions. @AlexWaygood )
hunterhogan commentedon May 6, 2025
FYI, more precisely, a forward slash
/can be valid. For example:pushddoesn't have switches, so the cmd interpreter isn't confusing the forward slash for a switch. In this case, the forward slash is interpreted as a malformed server path, not as part of a path.Furthermore, the syntax for path is strict.
(.venv) C:\apps\astToolkit>pushd 'typeshed/stdlib' The syntax of the command is incorrect.