pytype
pytype copied to clipboard
Please support Windows.
My tale of woe I have a Windows PC, and I wanted to run pytype on my code. I had to install WSL and then load several needed packages. Not only was this a big pain, but when pytype gave me some bad results, I tried debugging it. I'm not familiar with the latest IDEs on linux, nor did I want to spend the effort of learning to debug Python code visually (and load even more packages). So I resorted to inserting lots of print() calls in the code until I figured out what the problem was. About two days spent on this effort. I managed to get good pyi outputs for most, but not all, of my source code. I then tried running merge_pyi on the good ones, only to find out that merge_pyi crashed. On the hunch that at least merge_pyi didn't do anything weird, I installed pytype on my Windows Python, and used Visual Studio to debug it. It worked without problems. I was able to find and fix the bug, and file an issue about it. See #1153.
The pitch I presume that there can't be too much involved in getting the entire pytype package to run correctly on Windows. After all, Python is mostly portable. It would be a great assistance to Windows Python users if they could run pytype directly. Thank you.
we would definitely love to have better support for windows, the problem is that there are only three pytype devs, and we all use linux. we are very open to pull requests for windows and macos support, but we are unable to do the work ourselves.
we would definitely love to have better support for windows, the problem is that there are only three pytype devs, and we all use linux. we are very open to pull requests for windows and macos support, but we are unable to do the work ourselves.
Hey, i was just wondering what would be necessary in order to support windows.
@IIHERO4 just an iterative process of running pytype, finding issues, investigating and fixing them - i'm afraid we don't have a proper roadmap because we don't even know what all the issues are.
the current blocker is #90 - it's possible that everything will just work after that is fixed, but it's also possible that other issues are hiding behind it.
The designated initializers like the ones here seem to be non-standard and break MSVC.
https://github.com/google/pytype/blob/efc1fd95170e0569fa1821d960108017f072cc17/pytype/typegraph/cfg.cc#L501-L547
Even if you used C++20 designated initializers PyVarObject_HEAD_INIT
would cause non-designated initializers to be mixed in and break MSVC. I solved this issue by switching from Python static types to heap types rather than leaving a lot of attributes without names.
The CMake script doesn't set a C++ standard so MSVC defaults to one that's too early. I added set(CMAKE_CXX_STANDARD 17)
to the top script but there might be better options. On Windows I was able to run both pip install -e .
and python build_scripts/build.py
after this change and the one above.
The issues with #90 still exist. pytype
generates absolute paths with Windows drive names C:\
in them and Ninja thinks the colon is part of the build command instead of part of a path. The Ninja build file will run if you change some of the paths to be relative. I think only the paths on the build/check lines are having issues. I don't know how you're normally supposed to escape the drive path.
https://github.com/google/pytype/issues/727#issuecomment-1371631692
Hi, I'm trying to look into this MSVC syntax error, but for the life of me I can't figure out how to use /std:c++20
instead of /std:c++14
when doing pip install . -e
so I can try some things. (namely using standard designated initializers)
Looks like we have std=c++11
specified here: https://github.com/google/pytype/blob/8ee2d9c0b4536570d99f3d383c134d900e431ac7/cmake/modules/PyTypeUtils.cmake#L18
and cxx_std=11
here: https://github.com/google/pytype/blob/8ee2d9c0b4536570d99f3d383c134d900e431ac7/setup.py#L47
Try changing one or both of those?
I've been using pytype in WSL (Windows Subsystem for Linux) for a while.
I just tried Windows-native Python and was amazed that just about everything I have ever used works, e.g.:
pip install -U jupyter jupyterlab jupyterlab-execute-time jupytext autopep8 flake8 mypy pyink pylint pytest pdoc matplotlib numba numpy scipy scikit-image tqdm Pillow plotly keras tensorboard tensorflow-estimator torch 'jax[cpu]' opencv-python-headless graphviz kaleido networkx more-itertools sympy nbformat requests requests_oauthlib configparser z3-solver ipywidgets 'pyvista[jupyter]' mediapy resampler
The only packages that failed were: tensorflow
and pytype
.
Just saying... :-)