sphinx_reports.Adapter.Dependency

sphinx_reports/Adapter/Dependency.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from importlib.metadata import metadata as importlib_metadata

from packaging import metadata
from pyTooling.Decorators import export, readonly

from sphinx_reports.DataModel.Dependency import Distribution

# Further Reading:
# * https://stackoverflow.com/questions/17194301/is-there-any-way-to-show-the-dependency-trees-for-pip-packages
# * https://www.python.org/success-stories/building-a-dependency-graph-of-our-python-codebase/
# * https://github.com/thebjorn/pydeps
# * https://docs.python.org/3/library/importlib.metadata.html


@export
class DependencyScanner:
	_distribution: Distribution

	def __init__(self, distributionName: str):
		md1 = importlib_metadata(distributionName)

		self._distribution = Distribution(distributionName)

	@readonly
	def Distribution(self) -> Distribution:
		return self._distribution