Package: tudelft-pycar
EPO4 PythonThis repository contains Python abstractions, serial, and audio handlers for EPO4.DocumentationThepycardocumentation is generated using Sphinx v6.1.3. To open the documentation navigate todocs/buildand
openindex.html;index.htmlis the documentation's start page.Python EnvironmentPython environments / virtual environments are used for project isolation and dependency management.
They can be set up as to specify a specific Python version to the project, and install packages locally to the virtual
environment directory. Consequently, the dependencies (or packages) are isolated from the global environment, avoiding
conflicts between dependency requirements of different project and allowing for the installation of a specific
dependency's version.There exist several Python tools performing all or part of these function, most notablyvirtualenv,pyenv, andpipenv;virtualenvallows of packages in a virtual environment,pyenvallows for several Python versions to be
installed and run,pipenvis a merge between the preceding two tools. More introductory information is found onFlimm'sthread titledWhat is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv,
etc?.
It is highly recommended becoming familiar with some of these tools as they are highly used in academic and private settings.In the EPO4 project, thepipenvtool is used. When an environment is created, two files namedPipfileandPipfile.lockare also created in the project's directory. A third file namedrequirements.txtcan be used to create
an environment, however,Pipfilealways precedes the requirements file and will be used in the creation of an
environment if available in the target directory.Pipfilehas a[[source]]section specifying the repository
containing the Python packages, a[packages]section specifying the packages and their respective version requirements,
, a[dev-packages]section specifying packages for development (not installed on the machines of package users), and
a[requires]section specifying Python's version.Pipfile.lockcontains information regarding the installed packages
and package dependencies. The environment is created in a directory outside the project. For more information onpipenvreadPipenv: Python Dev Workflow for HumansandBasic Usage of Pipenv.Pipenv Setup (Windows)First, open a command prompt and make surepipis installed.>pip --versionNote that ifpipis not recognized, it is possible thatpip3is installed (with Python 3); run the same command but
usepip3instead. In casepip3is also not recognized then install it.Next, installpipenv(note that ifpip3is installed it should be used instead ofpip).>pip install --user pipenvNavigate to the repository's directory and install environment.>pipenv installAfter completing these steps, the project's python environment should be installed with the specified Python version
and required packages.To use the environment (run scripts / install additional packages), it should be first activated using thepipenvshell command.>pipenv shellA string containing(epo4-python-'hash')is appended before the directory. Scripts should be run from inside the
environment.Pipenv Setup (MacOS)TODO: Write instructions for MacOS.Pipenv Setup (Linux)TODO: Write instructions for Linux.PyCharm SetupTo run scripts directly from PyCharm (and for additional functionality). The environment's interpreter can be chosen as
the default interpreter for the project. Open a command prompt and navigate to the project's directory. Use thepipenvcommand to get the installation directory of the environment.>pipenv --venvCopy the directory's location, and in PyCharm go toFile - Settings - Project: epo4-python - Python Interpreter;
then go to the drop-down menu,Show All, go to the plus sign,Pipenv Environment, at theBase Interpreterselect the navigation option, go to the directory you copied earlier, enterScripts, selectpython.exe, clickOK, and deselectInstall packages from Pipfile; save the settings.Package DependenciesThe EPO4 project uses Python 3.10; the following packages are specified in thePipfile.PackageVersionpyqt55.15.7pyqt5-stubs5.15.6matplotlibnumpypyaudio0.2.12pyserial3.5sphinxEPO4 Python AbstractionsSerial Port Testing$ socat -d -d pty,raw,echo=0,b115200 pty,raw,echo=0,b115200
$ cat /dev/pts/3UseSerialHandleto write to/dev/pts/2, the data should be written in/dev/pts/3.
In case of a permission error, give permission to all users.$ sudo chmod 666 /dev/pts/2$ sudo apt install libxcb-xinerama0TODO: implement full test with command interactions