Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/in-1-1-entry-point.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* The ``diffpy-diffchooser`` command now starts instead of failing with ``ModuleNotFoundError``.

**Security:**

* <news item>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exclude = [] # exclude packages matching these glob patterns (empty by default)
namespaces = false # to disable scanning PEP 420 namespaces (true by default)

[project.scripts]
diffpy-diffchooser = "diffpy.diffchooser.app:main"
diffpy-diffchooser = "diffpy.diffchooser.diffchooser_app:main"

[tool.setuptools.dynamic]
dependencies = {file = ["requirements/pip.txt"]}
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/diffchooser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See LICENSE.rst for license information.
#
##############################################################################
"""Screen protein diffraction images for well diffracting samples"""
"""Screen protein diffraction images for well diffracting samples."""

# package version
from diffpy.diffchooser.version import __version__ # noqa
Expand Down
15 changes: 12 additions & 3 deletions src/diffpy/diffchooser/diffchooser_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@
from diffpy.diffchooser.version import __version__ # noqa


def main():
def main(argv=None):
"""Run the diffpy-diffchooser command line interface.

Parameters
----------
argv : list of str, optional
The command line arguments. If None, the arguments are read from
the terminal. Default is None.
"""
parser = argparse.ArgumentParser(
prog="diffpy.diffchooser",
description=(
"Screen protein diffraction images for well diffracting samples\n\n"
"Screen protein diffraction images for well diffracting "
"samples\n\n"
"For more information, visit: "
"https://github.com/diffpy/diffpy.diffchooser/"
),
Expand All @@ -20,7 +29,7 @@ def main():
help="Show the program's version number and exit",
)

args = parser.parse_args()
args = parser.parse_args(argv)

if args.version:
print(f"diffpy.diffchooser {__version__}")
Expand Down
11 changes: 11 additions & 0 deletions tests/test_diffchooser_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Unit tests for diffchooser_app.py."""

from diffpy.diffchooser import __version__
from diffpy.diffchooser.diffchooser_app import main


def test_main_version(capsys):
main(["--version"])
actual = capsys.readouterr().out.strip()
expected = f"diffpy.diffchooser {__version__}"
assert actual == expected
Loading