Skip to content

Commit 86b65e8

Browse files
authored
Merge pull request #20 from cadenmyers13/app-creation
feat: create app for diffpy.cmi CLI
2 parents 261ec9b + b156607 commit 86b65e8

File tree

7 files changed

+63
-5
lines changed

7 files changed

+63
-5
lines changed

doc/source/getting-started.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ Here is how you can write a block of code in the documentation. You can use the
3939
4040
# Create a new environment, without build dependencies (pure Python package)
4141
conda create -n <package_name>-env python=3.13 \
42-
--file requirements/test.txt \
42+
--file requirements/tests.txt \
4343
--file requirements/conda.txt
4444
4545
# Create a new environment, with build dependencies (non-pure Python package)
4646
conda create -n <package_name>-env python=3.13 \
47-
--file requirements/test.txt \
47+
--file requirements/tests.txt \
4848
--file requirements/conda.txt \
4949
--file requirements/build.txt
5050

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
.. |title| replace:: diffpy.cmi documentation
66

7-
``diffpy.cmi`` - Complex modeling infrastructure: a modulare framework for multi-modal modeling of scientific data.
7+
``diffpy.cmi`` - Complex modeling infrastructure: a modular framework for multi-modal modeling of scientific data.
88

99
| Software version |release|
1010
| Last updated |today|.

news/app-creation.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* Add CLI to return diffpy.cmi version and help page.
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
maintainers = [
1212
{ name="Simon Billinge", email="[email protected]" },
1313
]
14-
description = "Complex modeling infrastructure: a modulare framework for multi-modal modeling of scientific data."
14+
description = "Complex modeling infrastructure: a modular framework for multi-modal modeling of scientific data."
1515
keywords = ['modelling', 'regression', 'diffraction', 'PDF', 'complex-modeling']
1616
readme = "README.rst"
1717
requires-python = ">=3.11, <3.14"
@@ -48,6 +48,10 @@ include = ["*"] # package names should match these glob patterns (["*"] by defa
4848
exclude = [] # exclude packages matching these glob patterns (empty by default)
4949
namespaces = false # to disable scanning PEP 420 namespaces (true by default)
5050

51+
[project.scripts]
52+
diffpy-cmi = "diffpy.cmi.app:main"
53+
cmi = "diffpy.cmi.app:main"
54+
5155
[tool.setuptools.dynamic]
5256
dependencies = {file = ["requirements/pip.txt"]}
5357

File renamed without changes.

src/diffpy/cmi/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
"""Complex modeling infrastructure: a modulare framework for multi-modal modeling of scientific data."""
15+
"""Complex modeling infrastructure:
16+
a modular framework for multi-modal modeling of scientific data."""
1617

1718
# package version
1819
from diffpy.cmi.version import __version__ # noqa

src/diffpy/cmi/app.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import argparse
2+
3+
from diffpy.cmi.version import __version__
4+
5+
6+
def main():
7+
parser = argparse.ArgumentParser(
8+
prog="diffpy-cmi",
9+
description=(
10+
"Welcome to diffpy-CMI, a complex modeling infrastructure "
11+
"for multi-modal analysis of scientific data.\n\n"
12+
"Docs: https://www.diffpy.org/diffpy.cmi"
13+
),
14+
formatter_class=argparse.RawDescriptionHelpFormatter,
15+
)
16+
parser.add_argument(
17+
"--version",
18+
action="store_true",
19+
help="Show the program's version number and exit",
20+
)
21+
args = parser.parse_args()
22+
if args.version:
23+
print(f"diffpy.cmi {__version__}")
24+
else:
25+
# Default behavior when no arguments are given
26+
parser.print_help()
27+
28+
29+
if __name__ == "__main__":
30+
main()

0 commit comments

Comments
 (0)