Python Vehicle Model Distribution

Learn how to distribute a Vehicle Model written in Python.

Now you a have a Python package containing your first Python Vehicle Model and it is time to distribute it. There is nothing special about the distribution of this package, since it is just an ordinary Python package. Check out the Python Packaging User Guide to learn more about packaging and package distribution in Python.

Distribute to single Vehicle App

If you want to distribute your Python Vehicle Model to a single Vehicle App, you can do so by copying the entire folder my_vehicle_model under the /app/src folder of your Vehicle App repository and treat it as a sub-package of the Vehicle App.

  1. Create a new folder my_vehicle_model under /app/src in your Vehicle App repository.
  2. Copy the my_vehicle_model folder to the /app/src folder of your Vehicle App repository.
  3. Import the package my_vehicle_model in your Vehicle App:
from <my_app>.my_vehicle_model import vehicle

...

my_app = MyVehicleApp(vehicle)

Distribute inside an organization

If you want to distribute your Python Vehicle Model inside an organization and use it to develop multiple Vehicle Apps, you can do so by creating a dedicated Git repository and copying the files there.

  1. Create new Git repository called my_vehicle_model

  2. Copy the content under my_vehicle_model to the repository.

  3. Release the Vehicle Model by creating a version tag (e.g., v1.0.0).

  4. Install the Vehicle Model package to your Vehicle App:

    pip3 install git+https://github.com/<yourorg>/my_vehicle_model.git@v1.0.0
    
  5. Import the package my_vehicle_model in your Vehicle App and use it as shown in the previous section.

Distribute publicly as open source

If you want to distribute your Python Vehicle Model publicly, you can do so by creating a Python package and distributing it on the Python Package Index (PyPI). PyPi is a repository of software for the Python programming language and helps you find and install software developed and shared by the Python community. If you use the pip command, you are already using PyPI.

Detailed instructions on how to make a Python package available on PyPI can be found here.

Last modified January 17, 2023: Changed overview picture (#51) (ea5274b)