From 6977f3e0f1ff8c849c831d74463602ab04a29c9f Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 14:12:04 -0400 Subject: [PATCH 1/9] skpkg: mirate src folder --- src/diffpy/__init__.py | 17 +---------------- src/diffpy/utils/__init__.py | 10 ++++++---- src/diffpy/utils/version.py | 8 +++++--- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index 00208e23..d2a03b94 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -1,11 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2010 The Trustees of Columbia University -# in the City of New York. All rights reserved. -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # # File coded by: Billinge Group members and community contributors. @@ -16,14 +12,3 @@ # See LICENSE.rst for license information. # ############################################################################## -"""diffpy - tools for structure analysis by diffraction. - -Blank namespace package. -""" - - -from pkgutil import extend_path - -__path__ = extend_path(__path__, __name__) - -# End of file diff --git a/src/diffpy/utils/__init__.py b/src/diffpy/utils/__init__.py index 12f4a49d..5baaf05c 100644 --- a/src/diffpy/utils/__init__.py +++ b/src/diffpy/utils/__init__.py @@ -1,10 +1,10 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # -# File coded by: Billinge Group members and community contributors. +# File coded by: Simon Billinge, Billinge Group members. # # See GitHub contributions for a more detailed list of contributors. # https://github.com/diffpy/diffpy.utils/graphs/contributors @@ -12,10 +12,12 @@ # See LICENSE.rst for license information. # ############################################################################## -"""Shared utilities for diffpy packages.""" +"""General utilities for analyzing diffraction data""" # package version -from diffpy.utils.version import __version__ +from diffpy.utils.version import __version__ # noqa # silence the pyflakes syntax checker assert __version__ or True + +# End of file diff --git a/src/diffpy/utils/version.py b/src/diffpy/utils/version.py index e74c47bd..c767ea96 100644 --- a/src/diffpy/utils/version.py +++ b/src/diffpy/utils/version.py @@ -1,13 +1,13 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # -# File coded by: Billinge Group members and community contributors. +# File coded by: Simon Billinge, Billinge Group members. # # See GitHub contributions for a more detailed list of contributors. -# https://github.com/diffpy/diffpy.utils/graphs/contributors +# https://github.com/diffpy/diffpy.utils/graphs/contributors # noqa: E501 # # See LICENSE.rst for license information. # @@ -21,3 +21,5 @@ from importlib.metadata import version __version__ = version("diffpy.utils") + +# End of file From bd4fa9707d39d4141c2a05a71e6b0ed7ef9fb05d Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 14:12:16 -0400 Subject: [PATCH 2/9] skpkg: migrate tests folder --- tests/conftest.py | 101 ++---------------------------------------- tests/test_version.py | 2 +- 2 files changed, 5 insertions(+), 98 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index fcccb186..e3b63139 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,112 +1,19 @@ import json from pathlib import Path -import numpy as np import pytest -from diffpy.utils.diffraction_objects import DiffractionObject - @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 = home_dir / "cwd_dir" + cwd_dir = base_dir / "cwd_dir" cwd_dir.mkdir(parents=True, exist_ok=True) - home_config_data = { - "owner_name": "home_ownername", - "owner_email": "home@email.com", - "owner_orcid": "home_orcid", - } + + 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 home_dir, cwd_dir - - -@pytest.fixture -def datafile(): - """Fixture to dynamically load any test file.""" - base_path = Path(__file__).parent / "testdata" # Adjusted base path - - def _load(filename): - return base_path / filename - - return _load - - -@pytest.fixture -def do_minimal(): - # Create an instance of DiffractionObject with empty xarray and yarray - # values, and a non-empty wavelength - return DiffractionObject( - xarray=np.empty(0), yarray=np.empty(0), xtype="tth", wavelength=1.54 - ) - - -@pytest.fixture -def do_minimal_tth(): - # Create an instance of DiffractionObject with non-empty xarray, yarray, - # and wavelength values - return DiffractionObject( - wavelength=2 * np.pi, - xarray=np.array([30, 60]), - yarray=np.array([1, 2]), - xtype="tth", - ) - -@pytest.fixture -def do_minimal_d(): - # Create an instance of DiffractionObject with non-empty xarray, yarray, - # and wavelength values - return DiffractionObject( - wavelength=1.54, - xarray=np.array([1, 2]), - yarray=np.array([1, 2]), - xtype="d", - ) - - -@pytest.fixture -def wavelength_warning_msg(): - return ( - "No wavelength has been specified. You can continue to use the " - "DiffractionObject, but some of its powerful features will not be " - "available. " - "To specify a wavelength, if you have " - "do = DiffractionObject(xarray, yarray, 'tth'), " - "you may set do.wavelength = 1.54 for a wavelength of 1.54 angstroms." - ) - - -@pytest.fixture -def invalid_q_or_d_or_wavelength_error_msg(): - return ( - "The supplied input array and wavelength will result in an " - "impossible two-theta. " - "Please check these values and re-instantiate the DiffractionObject " - "with correct values." - ) - - -@pytest.fixture -def invalid_add_type_error_msg(): - return ( - "You may only add a DiffractionObject with another DiffractionObject " - "or a scalar value. " - "Please rerun by adding another DiffractionObject instance or a " - "scalar value. " - "e.g., my_do_1 + my_do_2 or my_do + 10 or 10 + my_do" - ) - - -@pytest.fixture -def x_values_not_equal_error_msg(): - return ( - "The two objects have different values in x arrays " - "(my_do.all_arrays[:, [1, 2, 3]]). " - "Please ensure the x values of the two objects are identical " - "by re-instantiating the DiffractionObject with the correct x value " - "inputs." - ) + yield tmp_path diff --git a/tests/test_version.py b/tests/test_version.py index 4152a197..9cf78e46 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,6 +1,6 @@ """Unit tests for __version__.py.""" -import diffpy.utils +import diffpy.utils # noqa def test_package_version(): From d292578a325779a4d8086d80a9ba88c3f52c2d67 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 14:39:13 -0400 Subject: [PATCH 3/9] skpkg: list dependencies in requirements folder --- requirements/build.txt | 0 requirements/conda.txt | 2 -- requirements/docs.txt | 1 + requirements/pip.txt | 2 -- requirements/test.txt | 5 +---- 5 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 requirements/build.txt diff --git a/requirements/build.txt b/requirements/build.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/requirements/conda.txt b/requirements/conda.txt index 9de10da8..24ce15ab 100644 --- a/requirements/conda.txt +++ b/requirements/conda.txt @@ -1,3 +1 @@ numpy -xraydb -scipy diff --git a/requirements/docs.txt b/requirements/docs.txt index ab17b1c8..5f34c6ed 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,4 +1,5 @@ sphinx sphinx_rtd_theme +sphinx-copybutton doctr m2r diff --git a/requirements/pip.txt b/requirements/pip.txt index 9de10da8..24ce15ab 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1,3 +1 @@ numpy -xraydb -scipy diff --git a/requirements/test.txt b/requirements/test.txt index a392bd23..a7277865 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,8 +2,5 @@ flake8 pytest codecov coverage -pytest-env -pytest-mock pytest-cov -freezegun -DeepDiff +pytest-env From 3227e2f7cd796eb9b668b90c0796eac95b727fd6 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 15:00:53 -0400 Subject: [PATCH 4/9] skpkg: list dependencies in requirements folder --- requirements/build.txt | 0 requirements/conda.txt | 2 ++ requirements/docs.txt | 1 - requirements/pip.txt | 2 ++ requirements/test.txt | 5 ++++- 5 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 requirements/build.txt diff --git a/requirements/build.txt b/requirements/build.txt new file mode 100644 index 00000000..e69de29b diff --git a/requirements/conda.txt b/requirements/conda.txt index 24ce15ab..9de10da8 100644 --- a/requirements/conda.txt +++ b/requirements/conda.txt @@ -1 +1,3 @@ numpy +xraydb +scipy diff --git a/requirements/docs.txt b/requirements/docs.txt index 5f34c6ed..ab17b1c8 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,5 +1,4 @@ sphinx sphinx_rtd_theme -sphinx-copybutton doctr m2r diff --git a/requirements/pip.txt b/requirements/pip.txt index 24ce15ab..9de10da8 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1 +1,3 @@ numpy +xraydb +scipy diff --git a/requirements/test.txt b/requirements/test.txt index a7277865..a392bd23 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,5 +2,8 @@ flake8 pytest codecov coverage -pytest-cov pytest-env +pytest-mock +pytest-cov +freezegun +DeepDiff From cd84158a5e5f30c107269c73b5b3d6e0b5457649 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 15:08:02 -0400 Subject: [PATCH 5/9] skpkg: add pyproject.toml --- pyproject.toml | 10 +++++----- requirements/build.txt | 0 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 requirements/build.txt diff --git a/pyproject.toml b/pyproject.toml index 10a6f890..a0c525c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,13 +6,13 @@ build-backend = "setuptools.build_meta" name = "diffpy.utils" dynamic=['version', 'dependencies'] authors = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, + { name="Simon Billinge", email="sb2896@columbia.edu" }, ] maintainers = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, + { name="Simon Billinge", email="sb2896@columbia.edu" }, ] description = "General utilities for analyzing diffraction data" -keywords = ["text data parsers", "wx grid", "diffraction objects"] +keywords = ['text data parsers', 'wx grid', 'diffraction objects'] readme = "README.rst" requires-python = ">=3.11, <3.14" classifiers = [ @@ -20,14 +20,14 @@ classifiers = [ 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', - 'License :: Free To Use But Restricted', + 'License :: OSI Approved :: BSD License', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Operating System :: Unix', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.13', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Chemistry', ] diff --git a/requirements/build.txt b/requirements/build.txt deleted file mode 100644 index e69de29b..00000000 From 9170c232d092ec0a98585cb807b0a50004c34529 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 15:12:08 -0400 Subject: [PATCH 6/9] skpkg: add CI and issue/PR templates --- .github/workflows/tests-on-pr.yml | 5 +---- .gitignore | 8 +------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index baac1aeb..5e4b8fec 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -1,15 +1,12 @@ name: Tests on PR on: - push: - branches: - - main pull_request: workflow_dispatch: jobs: tests-on-pr: - uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 + uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr.yml@v0 with: project: diffpy.utils c_extension: false diff --git a/.gitignore b/.gitignore index a25212ea..099e2948 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__/ .Python env/ build/ +_build/ develop-eggs/ dist/ downloads/ @@ -90,10 +91,3 @@ target/ # Ipython Notebook .ipynb_checkpoints - -# version information -setup.cfg -/src/diffpy/*/version.cfg - -# Rever -rever/ From bd3f896e768afd53558bbeab74722c7bd084344a Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 15:15:41 -0400 Subject: [PATCH 7/9] chore: news --- news/setup-CI.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 news/setup-CI.rst diff --git a/news/setup-CI.rst b/news/setup-CI.rst new file mode 100644 index 00000000..983b7f00 --- /dev/null +++ b/news/setup-CI.rst @@ -0,0 +1,24 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Support ``scikit-package`` Level 5 standard for file structure and workflow (https://scikit-package.github.io/scikit-package/). + + +**Security:** + +* From 09b3d8ffef6b1ee40a427c4195719e399caceede Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Tue, 10 Jun 2025 15:16:34 -0400 Subject: [PATCH 8/9] chore: news pt2 --- news/setup-CI.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/setup-CI.rst b/news/setup-CI.rst index 983b7f00..527f9f87 100644 --- a/news/setup-CI.rst +++ b/news/setup-CI.rst @@ -16,7 +16,7 @@ **Fixed:** -* Support ``scikit-package`` Level 5 standard for file structure and workflow (https://scikit-package.github.io/scikit-package/). +* Support ``scikit-package`` Level 5 standard for file structure and CI workflow (https://scikit-package.github.io/scikit-package/). **Security:** From e5ad3ab5aaeb4c36b05c466c2c06fa2d5564356e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 19:18:11 +0000 Subject: [PATCH 9/9] [pre-commit.ci] auto fixes from pre-commit hooks --- src/diffpy/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffpy/utils/__init__.py b/src/diffpy/utils/__init__.py index 5baaf05c..ad966a6d 100644 --- a/src/diffpy/utils/__init__.py +++ b/src/diffpy/utils/__init__.py @@ -12,7 +12,7 @@ # See LICENSE.rst for license information. # ############################################################################## -"""General utilities for analyzing diffraction data""" +"""General utilities for analyzing diffraction data.""" # package version from diffpy.utils.version import __version__ # noqa