1. First, you need to fork the GitHub repository.

    Note : always work on a specific branch dedicated to your patch.

  2. Then, you could need the Embedded printer DP-EH600 Technical Manual and take a look at the features advancement.

  3. Finally, be sure to add/update tests and documentation within your patch.



You will need pytest:

python3 -m pip install --upgrade --user pytest

Adding/changing a method

Before all, you will add a test file for the new method. Then, there is a test file called where all functions signatures are specified. Here is a little help to add a new one.

  1. Say we want to find the signature of the size function:
>>> from thermalprinter import ThermalPrinter
>>> from inspect import getargspec

>>> getargspec(ThermalPrinter.size)
ArgSpec(args=['self', 'value'], varargs=None, keywords=None, defaults=('S',))
  1. Copy the all line ArgSpec(...).
  2. Open the file and add a new test case, keep it sorted:
# Syntax of the function's name: test_signature_FUNCTION
def test_signature_size(methods):
    methods.remove(extract_stack(None, 2)[1][2].replace('test_signature_', ''))

    # Here, you paste the ArgSpec(...) line
    sig = ArgSpec(args=['self', 'value'], varargs=None, keywords=None,

    # And here you use the function's name too
    assert getargspec(ThermalPrinter.size) == sig

To summary, there are 3 modifications to apply, all functions in this file use the same syntax.

How to test?

Enable the developer mode:

python3 develop

Lauch the test suit:

python3 -m pytest

And you can test printing functions (if you added a styling method, you can add it to this function).

Validating the code

It is important to keep a clean base code. Use tools like flake8 and Pylint.


Install required packages:

python3 -m pip install --upgrade --user flake8 pylint

How to validate?

pylint3 thermalprinter

If there is no output, you are good ;)



You will need Sphinx:

python3 -m pip install --upgrade --user sphinx

How to build?

cd docs
make clean html