For example, in this post I provided a set of valid and invalid and ambiguous Latex examples. I did not provide details on how I would integrate a suggested solution written by a contributor.
Here are three specific aspects I would need for integration of contributed code:
- I will write doctests in Python. That way I can express the function as it would be integrated in the PDG project code
- The contributed Python script should run inside a Docker image. That way the dependencies are made explicit
- The "docker build" can assume to have Internet access, but the "docker run" process should assume no Internet connection
As an example from the above blog post, I can express the interface as a Python3 function
def is_expression_valid_latex(expr_latex: str) -> bool:
"""
>>> is_expression_valid_latex("a = b")
True
>>> is_expression_valid_latex("a = b +")
True
>>> is_expression_valid_latex("\si a")
False
"""
By using sys.stdin, we could expose that function to the container such that the following would be an acceptance test:
docker run -it --rm demo:latest python3 /opt/my_script.py "a = b"
True
No comments:
Post a Comment