Changes
This release splits the nfc2klipper.py file into two new files:
nfc2klipper_backend.py, runs the code communicating with the NFC reader.nfc2klipper_api.pyruns the web API. It can now be started with a production ready web server. Gunicorn is included in the requirements to make it easy to start, but any Python WSGI supporting web server should work.
The two services communicate with each other through a unix domain socket. Its path is taken from the socket_path key under [webserver] in the config file, copy that from the default config file and update to a suitable path. The backend server need to have write permission to the dir it is in.
There is a new nfc2klipper.py file that will start the backend and the webserver as usual, making it possible to upgrade without changing the systemd service file.
For developers
The code now uses types everywhere. One can run mypy on the code with make typecheck.
There are mock objects for the code communicating with Spoolman, Moonraker and the NFC-reader. That way the code can be tested without them. Run it with make run-mock