From ebceec32268f9bcd0f8b317e3e976e895559123a Mon Sep 17 00:00:00 2001 From: milesagraham Date: Thu, 16 May 2024 15:14:29 +0100 Subject: [PATCH] scaffolded cli tool (#5) * Add dependencies * scaffolded cli --- pyproject.toml | 9 ++++++--- src/ttmask/__init__.py | 4 ++++ src/ttmask/_cli.py | 3 +++ src/ttmask/sphere.py | 6 ++++++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/ttmask/_cli.py create mode 100644 src/ttmask/sphere.py diff --git a/pyproject.toml b/pyproject.toml index b450781..8eeadcd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,10 @@ classifiers = [ "Typing :: Typed", ] # add your package dependencies here -dependencies = [] +dependencies = [ + "numpy", + "typer", +] # https://peps.python.org/pep-0621/#dependencies-optional-dependencies # "extras" (e.g. for `pip install .[test]`) @@ -59,8 +62,8 @@ repository = "https://github.com/teamtomo/ttmask" # Entry points # https://peps.python.org/pep-0621/#entry-points # same as console_scripts entry point -# [project.scripts] -# ttmask-cli = "ttmask:main_cli" +[project.scripts] +ttmask = "ttmask:cli" # [project.entry-points."some.group"] # tomatoes = "ttmask:main_tomatoes" diff --git a/src/ttmask/__init__.py b/src/ttmask/__init__.py index 6ee4d29..1128bf4 100644 --- a/src/ttmask/__init__.py +++ b/src/ttmask/__init__.py @@ -8,3 +8,7 @@ __version__ = "uninstalled" __author__ = "Miles Graham" __email__ = "miles.graham@balliol.ox.ac.uk" + +from ._cli import cli +from .sphere import sphere + diff --git a/src/ttmask/_cli.py b/src/ttmask/_cli.py new file mode 100644 index 0000000..841068e --- /dev/null +++ b/src/ttmask/_cli.py @@ -0,0 +1,3 @@ +import typer + +cli = typer.Typer(name="ttmask") diff --git a/src/ttmask/sphere.py b/src/ttmask/sphere.py new file mode 100644 index 0000000..550a314 --- /dev/null +++ b/src/ttmask/sphere.py @@ -0,0 +1,6 @@ +from ._cli import cli + + +@cli.command(name='test1') +def sphere(name: str, number: int): + print('bla')