Getting started with development¶
This page will guide you through everything, that you need to contribute to this project.
Installing¶
In the console:
The projects repository is located at Github. To clone it to a local repository. Go to the parent folder where you want the repo placed. Then type in the console:
git clone https://github.com/JulianSobott/OpenDrive.git
In PyCharm:
In PyCharm: In the menu: VCS -> Checkout from Version Control -> Git. I the URL paste https://github.com/JulianSobott/OpenDrive and select the parent directory.
The code is written in python, so you need python 3.6+ installed. If you haven’t get it from python.org. Make sure, that you check the box install pip.
The easiest thing to set everything up, is to use pipenv. To install pipenv type:
pip install pipenv
Now that you have pipenv installed, you can install all necessary dependencies in a virtualenv.
pipenv install
What is a virtualenv?
A virtualenv is a virtual environment. It is used, that all project dependencies are not installed inside the global python folder, but inside a separate folder. This folder contains only libraries that are necessary for the project. This is also useful, when different projects need different versions of a library. Every time you type pip install XXX the library is installed inside the global python path. To install it in the virtualenv use pipenv install XXX.
Generate the docs¶
The docs are generated by sphinx. To install sphinx globally:
pip install Sphinx
To generate the docs:
cd docs
make html
Tip: When you have your project opened in PyCharm. At the bottom left there is a tab with Terminal If you open it, a terminal is opened in pycharm. The current path is automatically set to the projects path. So you only need to cd in docs.
You should see the results in OpenDrive/docs/_build/html. You can open the index.html in your browser and watch the generated documentation. If you are working in PyCharm you can right-click the index.html file and select run to run it at the localhost in your browser. No advantage, maybe more easy, then searching in the file explorer for the file.
Setup PyCharm¶
In PyCharm you need to set 3 folders as sources root. This ensures, that all imports works. To set a folder as sources root: In PyCharm on the left side, navigate to the folder -> right click it -> Select: Mark Directory as -> Sources Root. Do this for the folders:
- OpenDrive/src
- OpenDrive/src/OpenDrive
- OpenDrive/src/tests
These three folders should now be colored blue instead of grey.