From 252550832e448ed2ba4531549fbf7b69ec56c1cf Mon Sep 17 00:00:00 2001 From: "Travis F. Collins" Date: Thu, 26 Oct 2023 18:18:21 -0600 Subject: [PATCH] Move adiplot to be an actual CLI tool Signed-off-by: Travis F. Collins --- MANIFEST.in | 1 + adi/__init__.py | 5 +++++ adi/tools/__init__.py | 0 {examples => adi/tools}/adiplot.py | 3 ++- pyproject.toml | 6 ++++++ 5 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 adi/tools/__init__.py rename {examples => adi/tools}/adiplot.py (99%) diff --git a/MANIFEST.in b/MANIFEST.in index e67e0b8a0..469ab9511 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include LICENSE include README.md include adi/* +include adi/tools/* exclude setup.cfg diff --git a/adi/__init__.py b/adi/__init__.py index db32df83a..92ba508b5 100644 --- a/adi/__init__.py +++ b/adi/__init__.py @@ -108,5 +108,10 @@ except ImportError: pass +try: + from adi.tools.adiplot import run_adi_plot +except ImportError: + pass + __version__ = "0.0.17" name = "Analog Devices Hardware Interfaces" diff --git a/adi/tools/__init__.py b/adi/tools/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/adiplot.py b/adi/tools/adiplot.py similarity index 99% rename from examples/adiplot.py rename to adi/tools/adiplot.py index 107d55a93..8dac83cc5 100644 --- a/examples/adiplot.py +++ b/adi/tools/adiplot.py @@ -292,7 +292,8 @@ def animation(self): self.run_source = False -if __name__ == "__main__": +# if __name__ == "__main__": +def run_adi_plot(): parser = argparse.ArgumentParser(description="ADI fast plotting app") parser.add_argument( "class", help="pyadi class name to use as plot source", action="store" diff --git a/pyproject.toml b/pyproject.toml index 2ebf5c698..815bdfde3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,12 +45,18 @@ namespaces = true jesd = [ "paramiko" ] +tools = [ + "pyqtgraph", "matplotlib", "PyQt5", "scipy" +] [project.urls] homepage = "https://analogdevicesinc.github.io/pyadi-iio/" documentation = "https://analogdevicesinc.github.io/pyadi-iio/" repository = "https://github/analogdevicesinc/pyadi-iio" +[project.gui-scripts] +adiplot = "adi.tools.adiplot:run_adi_plot" + [tool.isort] multi_line_output=3 include_trailing_comma="True"