Giter VIP home page Giter VIP logo

carla-python-stubs's Introduction

CARLA Python Stubs

GitHub all releases

This repository contains Python stub files for the CARLA Python API. Installing these along the CARLA Python API will allow you to use type hints and auto-completion in your code.

type-hints

Installation

Download the stub files (ending with .pyi) for your version of CARLA from the releases page. Then follow the installation instructions for your editor below.

VS Code

VS code expects by default that custom stubs are placed in the ./typings directory in your project. Create a subdirectory named carla (./typings/carla) and place the stub files there. You should now see type hints for the carla-module in your code. See VS Code docs of stubPath for more information.

PyCharm

Create a directory in the root of your project with any name, for example ./stubs. Right-click the directory and select Mark directory as --> Sources Root. Create a subdirectory named carla (./stubs/carla) and place the stub files there. You should now see type hints for the carla-module in your code. See PyCharm docs of stubs for external implementation for more information.

Other editors

See if your editor supports adding custom Python stubs. If not, you can add the stub files directly to the CARLA module:

  1. Run pip show carla in the terminal. Find the Location path. This should end in a directory named site-packages.
  2. Open the Location directory above. Place the stub files in the carla subdiretory (.../site-packages/carla).
  3. You should now see type hints for the carla-module in your code.

Generating stubs

Stubs are available in releases. You can generate them yourself:

  1. Clone this repository.
  2. Install the requirements: pip install -r requirements.txt
  3. Run python -m src.generate_stubs in the terminal. This will generate stubs for the latest CARLA version. You can specify a different version by running python -m src.generate_stubs --version <version>. See python -m src.generate_stubs --help for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.