From 46ff20fdfa04ff03ad1b77f592c4d1d6e70fefa9 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 28 Oct 2025 02:19:51 -0400 Subject: [PATCH 1/7] skpkg: add cookiecutter.json --- cookiecutter.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 cookiecutter.json diff --git a/cookiecutter.json b/cookiecutter.json new file mode 100644 index 0000000..b9286f7 --- /dev/null +++ b/cookiecutter.json @@ -0,0 +1,18 @@ +{ + "maintainer_name": "Simon Billinge", + "maintainer_email": "sb2896@columbia.edu", + "maintainer_github_username": "sbillinge", + "contributors": "Xiaohao Yang and Billinge Group members", + "license_holders": "The Trustees of Columbia University in the City of New York", + "project_name": "diffpy.distanceprinter", + "github_username_or_orgname": "diffpy", + "github_repo_name": "diffpy.distanceprinter", + "conda_pypi_package_dist_name": "diffpy.distanceprinter", + "package_dir_name": "diffpy.distanceprinter", + "project_short_description": "Distance Printer, calculate the inter atomic distances. Part of xPDFsuite.", + "project_keywords": "diffpy, pdf, data-interpretation", + "minimum_supported_python_version": "3.11", + "maximum_supported_python_version": "3.13", + "project_needs_c_code_compiled": "No", + "project_has_gui_tests": "No" +} From c1e94a16076095d6fe4fe76951cce26399c8b163 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 28 Oct 2025 02:31:03 -0400 Subject: [PATCH 2/7] docs: add index.rst to allow docs to build, fix rendering issues in readme --- README.rst | 8 +++--- docs/source/index.rst | 57 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 docs/source/index.rst diff --git a/README.rst b/README.rst index 90cf3c6..a051fa9 100644 --- a/README.rst +++ b/README.rst @@ -44,28 +44,28 @@ Independent Installation ------------------------ You can also install ``diffpy.distanceprinter`` independently for yourself. -Assuming you have a wheel file in the current working directory, in an active conda environment please type +Assuming you have a wheel file in the current working directory, in an active conda environment please type :: pip install ./diffpy.distanceprinter-VERSION.whl where you replace VERSION with the actual version you have so the command matches the filename of the wheel file you have. -The commands to create and activate the conda environment with name "distanceprinter-env" is +The commands to create and activate the conda environment with name "distanceprinter-env" is :: conda create -n distanceprinter-env python=3.13 conda activate distanceprinter-env If you don't have conda installed, we recomment you install `miniconda `_ -To install this software from a Python wheel distribution format execute +To install this software from a Python wheel distribution format execute :: pip install ./diffpy.distanceprinter-VERSION.whl If you are a developer, you can also install this package from sources. First, obtain the source archive from `GitHub `_. Install the packages in ``./requirements/conda.txt`` and ``./requirements/tests.txt`` -using the `--file`` command: +using the ``--file`` command :: conda activate distanceprinter-env conda install --file ./requirements/conda.txt diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..2826b58 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,57 @@ +####### +|title| +####### + +.. |title| replace:: diffpy.distanceprinter documentation + +``diffpy.distanceprinter`` - Distance Printer, calculate the inter atomic distances. Part of xPDFsuite. + +| Software version |release| +| Last updated |today|. + +=============== +Getting started +=============== + +Welcome to the ``diffpy.distanceprinter`` documentation! + +This package is not designed to be installed independently. To get started, please visit +https://www.diffpy.org/products/xPDFsuite.html for more information about the xpdfsuite package and +download the package together with ``diffpy.xpdfsuite``. + +======= +Authors +======= + +``diffpy.distanceprinter`` is developed by Xiaohao Yang and Billinge Group members. The maintainer for this project is Simon Billinge. For a detailed list of contributors see +https://github.com/diffpy/diffpy.distanceprinter/graphs/contributors. + +============ +Installation +============ + +See the `README `_ +file included with the distribution. + +================ +Acknowledgements +================ + +``diffpy.distanceprinter`` is built and maintained with `scikit-package `_. + +================= +Table of contents +================= +.. toctree:: + :maxdepth: 2 + + Package API + release + license + +======= +Indices +======= + +* :ref:`genindex` +* :ref:`search` From 5c9a781c1cffd99f820edd4d68e9e449b0e63c48 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 28 Oct 2025 02:31:49 -0400 Subject: [PATCH 3/7] chore: change license to .rst --- LICENSENOTICE.txt => LICENSENOTICE.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LICENSENOTICE.txt => LICENSENOTICE.rst (100%) diff --git a/LICENSENOTICE.txt b/LICENSENOTICE.rst similarity index 100% rename from LICENSENOTICE.txt rename to LICENSENOTICE.rst From bd695524c4cfb587ba3279434b9b2dc9628993fe Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 28 Oct 2025 02:32:31 -0400 Subject: [PATCH 4/7] chore: add news file --- news/fix-issues.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/fix-issues.rst diff --git a/news/fix-issues.rst b/news/fix-issues.rst new file mode 100644 index 0000000..4a968b2 --- /dev/null +++ b/news/fix-issues.rst @@ -0,0 +1,23 @@ +**Added:** + +* No news added: Fix documentation errors + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 2ee37a8496e2480203274e262568ce46fd3cb6d9 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 28 Oct 2025 02:41:26 -0400 Subject: [PATCH 5/7] skpkg: add pip.txt to requirements folder --- requirements/pip.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements/pip.txt diff --git a/requirements/pip.txt b/requirements/pip.txt new file mode 100644 index 0000000..92111f9 --- /dev/null +++ b/requirements/pip.txt @@ -0,0 +1,3 @@ +numpy +diffpy.pdffit2 +diffpy.structure From 04b8365af53ac67a693ae2424bcdb3b77a82691c Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 28 Oct 2025 03:05:06 -0400 Subject: [PATCH 6/7] skpkg: update MANIFEST.in --- MANIFEST.in | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 0ecc683..f1a78ee 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,12 @@ -recursive-include DistancePrinter * -prune doc -exclude MANIFEST.in +graft src +graft tests +graft requirements + +include AUTHORS.rst LICENSE*.rst README.rst + +# Exclude all bytecode files and __pycache__ directories +global-exclude *.py[cod] # Exclude all .pyc, .pyo, and .pyd files. +global-exclude .DS_Store # Exclude Mac filesystem artifacts. +global-exclude __pycache__ # Exclude Python cache directories. +global-exclude .git* # Exclude git files and directories. +global-exclude .idea # Exclude PyCharm project settings. From 0186c511d0e98bd51bd3055f41a127aa1829d71a Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 28 Oct 2025 03:10:05 -0400 Subject: [PATCH 7/7] skpkg: add conftest.py, add cli utility from skpkg --- pyproject.toml | 2 +- .../distanceprinter/distanceprinter_app.py | 33 +++++++++++++++++++ tests/conftest.py | 19 +++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/diffpy/distanceprinter/distanceprinter_app.py create mode 100644 tests/conftest.py diff --git a/pyproject.toml b/pyproject.toml index 836946d..eb6f98b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,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-distanceprinter = "diffpy.distanceprinter:main" +diffpy-distanceprinter = "diffpy.distanceprinter.distanceprinter_app:main" [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} diff --git a/src/diffpy/distanceprinter/distanceprinter_app.py b/src/diffpy/distanceprinter/distanceprinter_app.py new file mode 100644 index 0000000..41f70c7 --- /dev/null +++ b/src/diffpy/distanceprinter/distanceprinter_app.py @@ -0,0 +1,33 @@ +import argparse + +from diffpy.distanceprinter.version import __version__ # noqa + + +def main(): + parser = argparse.ArgumentParser( + prog="diffpy.distanceprinter", + description=( + "Distance Printer, calculate the inter atomic distances. Part of xPDFsuite.\n\n" + "For more information, visit: " + "https://github.com/diffpy/diffpy.distanceprinter/" + ), + 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.distanceprinter {__version__}") + else: + # Default behavior when no arguments are given + parser.print_help() + + +if __name__ == "__main__": + main() diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..e3b6313 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,19 @@ +import json +from pathlib import Path + +import pytest + + +@pytest.fixture +def user_filesystem(tmp_path): + base_dir = Path(tmp_path) + home_dir = base_dir / "home_dir" + home_dir.mkdir(parents=True, exist_ok=True) + cwd_dir = base_dir / "cwd_dir" + cwd_dir.mkdir(parents=True, exist_ok=True) + + home_config_data = {"username": "home_username", "email": "home@email.com"} + with open(home_dir / "diffpyconfig.json", "w") as f: + json.dump(home_config_data, f) + + yield tmp_path