Open jGaboardi opened 4 years ago
Good question. In most cases, I think that
pkg_resources.get_distribution(p).version
(https://github.com/rasbt/watermark/blob/master/watermark/watermark.py#L157)
should take care of it. But if pkg_resources
can find the version, we have the manual brute-force approach in the lines below. I guess there is not really a better way than brute-forcing these.
The cleanest way, I believe, would be through the metadata
package (from the stdlib), but it's Python 3.8-only (#56) so that it's not that useful, yet.
I am wondering if there is an efficient way to support fetching the versions of Python packages that don't follow the
__version__
convention,gurobi
's Python API for example?Or would this have to be (1) a brute-force search through the entire directory; or (2) a manual
print()
for the version.