diff --git a/doc/source/getting-started.rst b/doc/source/getting-started.rst index ac7d510..68a04b8 100644 --- a/doc/source/getting-started.rst +++ b/doc/source/getting-started.rst @@ -39,12 +39,12 @@ Here is how you can write a block of code in the documentation. You can use the # Create a new environment, without build dependencies (pure Python package) conda create -n -env python=3.13 \ - --file requirements/test.txt \ + --file requirements/tests.txt \ --file requirements/conda.txt # Create a new environment, with build dependencies (non-pure Python package) conda create -n -env python=3.13 \ - --file requirements/test.txt \ + --file requirements/tests.txt \ --file requirements/conda.txt \ --file requirements/build.txt diff --git a/doc/source/index.rst b/doc/source/index.rst index 11508cc..84c46cb 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,7 +4,7 @@ .. |title| replace:: diffpy.cmi documentation -``diffpy.cmi`` - Complex modeling infrastructure: a modulare framework for multi-modal modeling of scientific data. +``diffpy.cmi`` - Complex modeling infrastructure: a modular framework for multi-modal modeling of scientific data. | Software version |release| | Last updated |today|. diff --git a/news/app-creation.rst b/news/app-creation.rst new file mode 100644 index 0000000..04b806a --- /dev/null +++ b/news/app-creation.rst @@ -0,0 +1,23 @@ +**Added:** + +* Add CLI to return diffpy.cmi version and help page. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 00e749b..1146c0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ maintainers = [ { name="Simon Billinge", email="sb2896@columbia.edu" }, ] -description = "Complex modeling infrastructure: a modulare framework for multi-modal modeling of scientific data." +description = "Complex modeling infrastructure: a modular framework for multi-modal modeling of scientific data." keywords = ['modelling', 'regression', 'diffraction', 'PDF', 'complex-modeling'] readme = "README.rst" requires-python = ">=3.11, <3.14" @@ -48,6 +48,10 @@ include = ["*"] # package names should match these glob patterns (["*"] by defa exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) +[project.scripts] +diffpy-cmi = "diffpy.cmi.app:main" +cmi = "diffpy.cmi.app:main" + [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} diff --git a/requirements/test.txt b/requirements/tests.txt similarity index 100% rename from requirements/test.txt rename to requirements/tests.txt diff --git a/src/diffpy/cmi/__init__.py b/src/diffpy/cmi/__init__.py index 073d76e..158d6da 100644 --- a/src/diffpy/cmi/__init__.py +++ b/src/diffpy/cmi/__init__.py @@ -12,7 +12,8 @@ # See LICENSE.rst for license information. # ############################################################################## -"""Complex modeling infrastructure: a modulare framework for multi-modal modeling of scientific data.""" +"""Complex modeling infrastructure: +a modular framework for multi-modal modeling of scientific data.""" # package version from diffpy.cmi.version import __version__ # noqa diff --git a/src/diffpy/cmi/app.py b/src/diffpy/cmi/app.py new file mode 100644 index 0000000..1a46163 --- /dev/null +++ b/src/diffpy/cmi/app.py @@ -0,0 +1,30 @@ +import argparse + +from diffpy.cmi.version import __version__ + + +def main(): + parser = argparse.ArgumentParser( + prog="diffpy-cmi", + description=( + "Welcome to diffpy-CMI, a complex modeling infrastructure " + "for multi-modal analysis of scientific data.\n\n" + "Docs: https://www.diffpy.org/diffpy.cmi" + ), + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + parser.add_argument( + "--version", + action="store_true", + help="Show the program's version number and exit", + ) + args = parser.parse_args() + if args.version: + print(f"diffpy.cmi {__version__}") + else: + # Default behavior when no arguments are given + parser.print_help() + + +if __name__ == "__main__": + main()