carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.22k stars 3.63k forks source link

type hints for carla pythonapi client #6547

Open qhaas opened 1 year ago

qhaas commented 1 year ago

CARLA version: 0.9.14 Platform/OS: Ubuntu 22.04 Problem you have experienced: Lack of type hints when developing with the carla client PythonAPI. What you expected to happen: Type hints are present in the carla client PythonAPI library and usable by IDEs (e.g. pylance in vscode) or via command-line tooling (e.g. pyright) Steps to reproduce: Install the Python 3.5 wheel file, import the carla module into any sample code, add a few random functions from this module, and note that type hints are missing / unknown. Other information (documentation you consulted, workarounds you tried): This is a de facto re-opening of Issue 1333 with a request for a more cross-platform (i.e. not exclusive to pycharm IDE) and standardized means to achieve type hints (i.e. using the now built-in functionality of newer Python releases). I feel given the productivity benefits of type hints warrant it, along with community interest. Type hints are described in PEP-484 and were introduced with Python 3.5. Standardization of packaging of type hints shipped with python 3.7 and is described in PEP-561. Given the carla client pythonapi relies on boost::python and underlying C++ based libraries / dependencies, it might not be possible to implement implicitly without upstream feature additions. Given CARLA 0.9.14 targets Python 3.5, an upgrade to Python 3.7+ might be needed in future releases to achieve the packaging of said hints.

xudooo commented 4 days ago

Hi, did you solve the problem? I installed CARLA client library in a virtual environment with command pip3 install carla, how do I make it possible to give method hints when using pythonapi?