xflr6 / graphviz

Simple Python interface for Graphviz
https://graphviz.readthedocs.io
MIT License
1.63k stars 211 forks source link

Not pure Python, needs GraphViz installed #166

Closed abitrolly closed 2 years ago

abitrolly commented 2 years ago

I am not sure if GraphViz is only needed for rendering, but pure Python packages are those that do not require any binary dependencies except Python itself.

codecov-commenter commented 2 years ago

Codecov Report

Merging #166 (f7ab832) into master (ee3ae10) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #166   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           33        33           
  Lines         1079      1079           
=========================================
  Hits          1079      1079           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ee3ae10...f7ab832. Read the comment docs.

xflr6 commented 2 years ago

pure Python packages are those that do not require any binary dependencies except Python itself.

I don't follow. In my understanding, pure Python means that the package itself does not include any binaries (no compiler needed to install it).

See also a couple of lines below:

The only dependency is a working installation of Graphviz (...).
abitrolly commented 2 years ago

Pure Python for a library means "it's all implemented in Python, and not (as is sometimes done) with parts written in C or other languages. As a result it's guaranteed to work on any system that Python works on."

From https://stackoverflow.com/questions/45976946/what-is-pure-python

In the case of this lib functionality, one part is obviously implemented in C, and won't work on systems without GraphViz installed. Therefore it is not pure Python.

xflr6 commented 2 years ago

I agree with the definition but not with your statement:

In the case of this lib functionality, one part is obviously implemented in C

This is not the case: there is no C code here, only Python (as opposed to e.g. https://pypi.org/project/pygraphviz).

This library depends on an installation of http://graphviz.org (whose installation falls outside of the Python domain).

abitrolly commented 2 years ago

So you agree this package is not for pure Python. It is just a Python package, not a Python extension. But from the user's perspective it is the same problem - you need to get GraphViz compiled and installed.

xflr6 commented 2 years ago

I don't. Note that we provide a -py3-none-any.whl.

Also you don't need a compiler to install upstream Graphviz (see http://graphviz.org/download/)

I don't understand what the problem is you refer to: Any interface to upstream Graphviz will trivially/necessarily depend on an installation of it. The relevant distinction is that you can build this package without a compiler because it contains only Python code: The wheel is platform-independent.

The installation of upstream Graphviz is out of scope for the Python package system (pip). In case you are looking for a platform-independent way to install both this library and upstream Graphviz in a single step, you might want to check out the conda-forge distribution (see https://graphviz.readthedocs.io/en/stable/manual.html#installation).

abitrolly commented 2 years ago

I need root access to install GraphViz. I also doubt it will work from Jupyter.

I don't understand what the problem is you refer to

My objection is that people looking for pure Python dot renderer will find this project, which is just a wrapper over 3rd party tool.

Thank for the pygraphviz hint. It could work with shipped wheels, but there are no wheels yet.

xflr6 commented 2 years ago

Thanks for the clarification.

I understand you were looking for a pure-Python DOT-renderer (a full re-implementation of https://www.graphviz.org in Python). That is out of scope for this little (much more modest) library. IMHO this is clear from the phrasing 'interface for Graphviz'.

I need root access to install GraphViz.

Might be worth asking about (adding?) user-install options in upstream https://www.graphviz.org.

I also doubt it will work from Jupyter.

I guess I am still not completely understanding the restrictions of your environment so just to make clear: as long as the dot binary is available in the environment it should work with this library: https://graphviz.readthedocs.io/en/stable/notebooks.html

+1 that it would be great if pygraphviz could provide a binary wheel that includes everything needed. Thanks for the pointer to https://github.com/pygraphviz/pygraphviz/issues/167