ReferenceModel
How to find and instantiate this model
TODO: Must find a way of dynamically importing models
Clues here: https://stackoverflow.com/questions/42401495/how-to-dynamically-import-modules#42402095
>>> from reference_model import reference_model
>>> from vipscore_common.vips_model import VIPSModel
>>> print(VIPSModel.__subclasses__())
[<class 'reference_model.reference_model.ReferenceModel'>]
>>> print(VIPSModel.__subclasses__()[0])
<class 'reference_model.reference_model.ReferenceModel'>
>>> t = VIPSModel.__subclasses__()[0]()
>>> t
<reference_model.reference_model.ReferenceModel object at 0x7f8fab6dee30>
>>> t.get_model_name()
'Reference Model'
>>> t.get_model_description()
"\n The model is a reference model for developers, showcasing best practices and functionalities of a model.\n It's a simple day degree model for an imagined pest, and when thresholds are passed, the warning status progresses.\n "
Testing
The tests are located in the tests
folder, and we're using Pytest
To run the unit tests, move to the root folder of the project, and execute:
pytest -v
References
We used this excellent guide for packaging: https://realpython.com/pypi-publish-python-package/