Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[updated #7009] Add a *.pyi file for auto-completion & hints. #7787

Merged
merged 39 commits into from
Aug 28, 2024

Conversation

Daraan
Copy link

@Daraan Daraan commented Jun 14, 2024

This is an updated version of the PRs #7009 + Minokori#1 from @Minokori who did the main and initial work and further corrections from me. As #7009 has not been maintained in the last months and Blyron mentioned that they might close it I choose now to make this PR as a combined and rebased version of the mentioned PRs.
Of course we should favor #7009 should it be updated and I hope everyone is fine with me opening this alternative PR, if not please close it again or leave a comment.

  • Setters for properties

    • VehicleControl
    • Possibly others
  • Overloads

    • Location.init with Vector3D
    • Location a.o. setters accept Vector3D
  • Overload for get_waypoint() -> Waypoint

    • Question when is it guaranteed that a waypoint is returned?
      Is project_to_road=True sufficient? Including LaneType.NONE or Any?

Description

To enable auto-completion and hints in code editors such as VScode, create a *.pyi file. This feature is compatible with python 3.9 and later versions.

Fallback to typing_extension with version check is now added.

Where has this been tested?

  • Platform(s): Windows Desktop (not by me), Ubuntu 22.04
  • Python version(s): 3.7, 3.9, 3.10 (also IDE version)
  • Unreal Engine version(s): N/A

Possible Drawbacks

Some type checking features are only available in later Python versions (3.9+), but as this is a *.pyi stub file it depends on the IDE and not the runtime version.


This change is Reviewable

@Daraan Daraan requested a review from a team as a code owner June 14, 2024 17:14
@Daraan Daraan force-pushed the type-hinting-to-dev branch from 9fe050f to bc1f334 Compare July 23, 2024 10:22
@Daraan
Copy link
Author

Daraan commented Jul 23, 2024

Note: Since Added type hints for values attribute on enums this PR is a superset of Minokori#1 containing more changes.

@Daraan Daraan force-pushed the type-hinting-to-dev branch 10 times, most recently from 71e581e to f1fa9b1 Compare July 29, 2024 16:52
@Daraan Daraan force-pushed the type-hinting-to-dev branch 2 times, most recently from 3fd09a9 to 5377399 Compare August 1, 2024 15:07
@Daraan Daraan force-pushed the type-hinting-to-dev branch from d1f278b to 9679a25 Compare August 8, 2024 12:58
@Daraan Daraan force-pushed the type-hinting-to-dev branch from 9679a25 to 3e82831 Compare August 8, 2024 13:04
more setters
missing, wrong types corrected
spelling
@Daraan Daraan force-pushed the type-hinting-to-dev branch from 4d846f0 to 49562b7 Compare August 15, 2024 20:45
Copy link
Contributor

@Blyron Blyron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Daraan)

@Blyron Blyron merged commit 334740a into carla-simulator:dev Aug 28, 2024
2 checks passed
@Daraan Daraan mentioned this pull request Sep 4, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants