This task returns a list of trucks best located to be assigned to a cargo, based on geo coordinates from both, cargo and truck. This project was developed using Python 3.8 over Ubuntu Linux and tested with git clone into a Windows10 VirtualBox with Python 3.7.
- Start with Set-up and install.
- For automatic tests, skip to Automatic tests.
- To use the Truck class, skip to The Truck class.
- To run from the command line, go to Run from command line.
- About logs, please move to the corresponding topic, Logs.
- Instructions on advanced/technical documentation, go to Documentation.
- Or click to skip to the To do list.
I recommend using virtualenv.
Install the requirements:
$ python3 -m pip install -r requirements.txt
Please check the config file to personalise variables as needed.
Note: to run tests manually, please refer to Set-up and install first. Note: to run tests using Makefile, virtualenv must be already installed.
Python tests are available manually or using Makefile.
- Run
python3 -m unittest tests/test_*
. - Or use make as in
make test
to setup, run the tests and clean up.
Note: to run from Python console, please refer to Set-up and install first.
With the python console and the Truck class, we can get three best recommended trucks to transport a cargo, from the cargo's latitude and longitude:
$ python3
>>> from truck import Truck
>>> t = Truck()
>>> t.locate(36.876719, -89.5878579)
Note: to run from command line, please refer to Set-up and install first.
From the project's root directory, please run the following command and follow instructions:
$ python3 -m truck
ATTENTION: To print all cargo and each optimal truck, use the MENU option all.
By default, logs are recorded in the 'logs' directory, in the project's root.
Please see docs/logs if you wish to access samples of the generated logs.
Please try from command line:
$ python3 -c 'import config; help(config)'
Or try from python console:
$ python3
>>> import truck
>>> help(truck)
All documentation can be found in docs.
- Preview distance between truck and load.
- Preview distance between cargo get and deliver point.
- Preview distance between truck and deliver.
- Configure rotation of log files.
- Improve docstrings.