Python Vehicle Model Distribution
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.
- Create a new folder
/app/srcin your Vehicle App repository.
- Copy the
my_vehicle_modelfolder to the
/app/srcfolder of your Vehicle App repository.
- Import the package
my_vehicle_modelin 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.
Create new Git repository called
Copy the content under
my_vehicle_modelto the repository.
Release the Vehicle Model by creating a version tag (e.g.,
Install the Vehicle Model package to your Vehicle App:
pip3 install git+https://github.com/<yourorg>/email@example.com
Import the package
my_vehicle_modelin 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.