After dropping Python 3.5 (#1067), we can use type hints with variable annotation syntax.
https://www.python.org/dev/peps/pep-0526/
Thank you @harupy for creating a script to detect type comments for variables!
https://github.com/optuna/optuna/issues/711#issuecomment-683521987
I have tested com2ann (which translates type comments into type annotations) and it worked.
Usage:
# install python 3.8 (because com2ann doesn't work in python < 3.8)
# install com2nn
pip install git+https://github.com/ilevkivskyi/com2ann.git
# run com2ann
com2ann .
For the record, https://github.com/optuna/optuna/pull/1937/files#r509361516.
I confirmed that all comment-style variable annotation are replaced at #1950.