pythonTikZ - (Github repository)¶
pythonTikZ is a Python library creating TikZ graphics in LaTeX. The library began in concept as a fork of PyLaTeX, which still forms a basis for the package. Its goal is to provide a higher level interface, less error prone interface to writing TikZ, whilst still exposing enough low level detail that complex diagrams can be produced.
pythonTikZ is not a substitute for learning TikZ (unfortunately). However, the intent is to make available a number of easy to use wrappers, which hide the TikZ writing details beneath a relatively intuitive exterior. The hope is that pythonTikZ eases the burden of using TikZ for occasional TikZ users, making image production a simple iterative process, without the need to continually look up “how do I do xyz in TikZ?”
The library aims to provide a convenient, reusable way of writing TikZ where documentation and type hinting are available to aid in this process. The intention is that the python interface is easy to understand at a glance and thereby is easily modified and more reusable.
It does not promise concise output TikZ. Whilst one could use the various TikZ styles to write less verbose TikZ, this has a nontrivial implementation burden. Additionally, it introduces the need to heuristically determine when a style definition is “worthwhile”.
Finally, pythontikz aims to be more strict about the testing of new function than PyLaTeX (currently) is. Unit tests should verify that the output is as expected (which in turn should be valid TikZ).
Installation¶
pythonTikZ works on Python 3.6+ Currently it also will work on earlier versions of Python 3, but this is not a continuing commitment, use of f-strings are expected in future development. PyLaTeX however does support a wider array of python versions, perhaps the limited support of pythonTikz will be reviewed at a later date.
Currently one can install from the repository directly using pip:
pip install git+https://github.com/m-richards/pythonTikz.git
Currently, the package is not PyPi, however this should change as the project progresses.
Support¶
This library is developed for use on Windows, but is tested on WSL. This should mean the library will work on both platforms but there is potential for some cases where they do not.