Skip to content

Commit

Permalink
Create dxtbx.any2nexus dispatcher through setuptools
Browse files Browse the repository at this point in the history
Previously, this was only created through libtbx.
  • Loading branch information
ndevenish committed Jun 23, 2024
1 parent d3fbb7f commit a38695d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def get_entry_point(filename: Path, prefix: str, import_path: str) -> List[str]:
tree = ast.parse(contents)
# Find root functions named "run"
has_run = any(
x for x in tree.body if isinstance(x, ast.FunctionDef) and x.name == "run"
x
for x in tree.body
if (isinstance(x, ast.FunctionDef) and x.name == "run")
or (isinstance(x, ast.ImportFrom) and "run" in [a.name for a in x.names])
)
if not has_run:
return []
Expand Down
1 change: 1 addition & 0 deletions newsfragments/XXX.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add any2nexus to formal dispatcher mechanisms.
2 changes: 1 addition & 1 deletion src/dxtbx/format/nxmx_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ def add_crystal(self, multi_crystal_group_name, crystal):
)


def run(args):
def run(args: list[str] | None = None):
usage = "dials.python nxmx_writer.py <experiments OR image files>"
parser = ArgumentParser(
usage=usage,
Expand Down

0 comments on commit a38695d

Please sign in to comment.