carla icon indicating copy to clipboard operation
carla copied to clipboard

[Help wanted] Improvement of Python Type Stubs - Update availaible

Open Daraan opened this issue 5 months ago • 1 comments

Description

This PR is the continuation of #7787 that added type hints for the carla package.

This PR contains:

  • added carla.Rss* classes
  • added weak carla.ad type hints; also they are only included in the rss build. This needs modification of the setup and some cleaning
  • further fixes and improvements

How can you contribute:

Carla package
  • [ ] testing of the carla type hints and extending where necessary. Property setters and inplace setters are likely missing.
    You can use ruff and
     ruff check PythonAPI/carla/source/carla --select ANN --ignore ANN101,ANN102
    
    Use --exclude *ad/rss,*ad/map to exclude the SyntaxError from these two files while they are not addressed or the whole ad subpackage.
ad subpackage
  • [ ] Finishing type stubs for the ad subpackage.
    • [ ] add missing global attributes and functions
    • [ ] cleaning
    • [ ] overloads and property signatures

[!IMPORTANT] The type stubs for the ad library are only minimally done there are many things missing (top-level functions & attributes), wrong (e.g. overloads) or incomplete. I will not continue the work on the ad subpackage. On my repo I have a tag with alternative type stubs for ad that can be used to complement the ones in this PR. Those are more complete but lack function signatures and types: https://github.com/Daraan/LunaticAI-Driver-for-CARLA-Simulator/releases/tag/deleted-Alternative-ad-type-stubs

  • [x] Solve setup.py not to include rss files into non-rss build (happens when rebuilding without cleaning build dir). If someone has a better idea how to prevent copying of the source/carla/ad/ if one does a normal build after an rss build please feel to share your ideas. I am not sure how far we can go with MANIFEST.in files. Or doing a more thorough cleanup before. Currently these files will be removed instead keeping them around.

Further contributions

Feel free to make PRs against my fork https://github.com/Daraan/CARLA-Simulator-Fork-DebianFix/tree/type-hinting-to-dev to the type-hinting-to-dev branch.

Where has this been tested?

  • Platform(s): Ubuntu 22.04
  • Python version(s):
    • 2.7 RSS build fails, without OK
    • 3.10with and without RSS

Possible Drawbacks


This change is Reviewable

Daraan avatar Sep 04 '24 18:09 Daraan