From 37b32dbabdf7d6b1aa932d5ea703390e42dfecf1 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 7 Sep 2024 13:02:48 -0400 Subject: [PATCH 01/85] Move tests dir to top level --- {src/diffpy/utils/tests => tests}/__init__.py | 0 {src/diffpy/utils/tests => tests}/conftest.py | 0 {src/diffpy/utils/tests => tests}/debug.py | 0 {src/diffpy/utils/tests => tests}/run.py | 0 {src/diffpy/utils/tests => tests}/test_diffraction_objects.py | 0 {src/diffpy/utils/tests => tests}/test_loaddata.py | 0 {src/diffpy/utils/tests => tests}/test_resample.py | 0 {src/diffpy/utils/tests => tests}/test_serialization.py | 0 {src/diffpy/utils/tests => tests}/test_tools.py | 0 {src/diffpy/utils/tests => tests}/testdata/dbload/e1.gr | 0 {src/diffpy/utils/tests => tests}/testdata/dbload/e2.gr | 0 {src/diffpy/utils/tests => tests}/testdata/dbload/e3.gr | 0 {src/diffpy/utils/tests => tests}/testdata/generated_db.json | 0 {src/diffpy/utils/tests => tests}/testdata/generatewarnings.txt | 0 {src/diffpy/utils/tests => tests}/testdata/loaddata01.txt | 0 .../diffpy/utils/tests => tests}/testdata/loaddatawithheaders.txt | 0 {src/diffpy/utils/tests => tests}/testdata/loadfile.txt | 0 {src/diffpy/utils/tests => tests}/testdata/strumining.json | 0 {src/diffpy/utils/tests => tests}/testdata/targetjson.json | 0 {src/diffpy/utils/tests => tests}/testdata/wrong.type | 0 {src/diffpy/utils/tests => tests}/testhelpers.py | 0 21 files changed, 0 insertions(+), 0 deletions(-) rename {src/diffpy/utils/tests => tests}/__init__.py (100%) rename {src/diffpy/utils/tests => tests}/conftest.py (100%) rename {src/diffpy/utils/tests => tests}/debug.py (100%) rename {src/diffpy/utils/tests => tests}/run.py (100%) rename {src/diffpy/utils/tests => tests}/test_diffraction_objects.py (100%) rename {src/diffpy/utils/tests => tests}/test_loaddata.py (100%) rename {src/diffpy/utils/tests => tests}/test_resample.py (100%) rename {src/diffpy/utils/tests => tests}/test_serialization.py (100%) rename {src/diffpy/utils/tests => tests}/test_tools.py (100%) rename {src/diffpy/utils/tests => tests}/testdata/dbload/e1.gr (100%) rename {src/diffpy/utils/tests => tests}/testdata/dbload/e2.gr (100%) rename {src/diffpy/utils/tests => tests}/testdata/dbload/e3.gr (100%) rename {src/diffpy/utils/tests => tests}/testdata/generated_db.json (100%) rename {src/diffpy/utils/tests => tests}/testdata/generatewarnings.txt (100%) rename {src/diffpy/utils/tests => tests}/testdata/loaddata01.txt (100%) rename {src/diffpy/utils/tests => tests}/testdata/loaddatawithheaders.txt (100%) rename {src/diffpy/utils/tests => tests}/testdata/loadfile.txt (100%) rename {src/diffpy/utils/tests => tests}/testdata/strumining.json (100%) rename {src/diffpy/utils/tests => tests}/testdata/targetjson.json (100%) rename {src/diffpy/utils/tests => tests}/testdata/wrong.type (100%) rename {src/diffpy/utils/tests => tests}/testhelpers.py (100%) diff --git a/src/diffpy/utils/tests/__init__.py b/tests/__init__.py similarity index 100% rename from src/diffpy/utils/tests/__init__.py rename to tests/__init__.py diff --git a/src/diffpy/utils/tests/conftest.py b/tests/conftest.py similarity index 100% rename from src/diffpy/utils/tests/conftest.py rename to tests/conftest.py diff --git a/src/diffpy/utils/tests/debug.py b/tests/debug.py similarity index 100% rename from src/diffpy/utils/tests/debug.py rename to tests/debug.py diff --git a/src/diffpy/utils/tests/run.py b/tests/run.py similarity index 100% rename from src/diffpy/utils/tests/run.py rename to tests/run.py diff --git a/src/diffpy/utils/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py similarity index 100% rename from src/diffpy/utils/tests/test_diffraction_objects.py rename to tests/test_diffraction_objects.py diff --git a/src/diffpy/utils/tests/test_loaddata.py b/tests/test_loaddata.py similarity index 100% rename from src/diffpy/utils/tests/test_loaddata.py rename to tests/test_loaddata.py diff --git a/src/diffpy/utils/tests/test_resample.py b/tests/test_resample.py similarity index 100% rename from src/diffpy/utils/tests/test_resample.py rename to tests/test_resample.py diff --git a/src/diffpy/utils/tests/test_serialization.py b/tests/test_serialization.py similarity index 100% rename from src/diffpy/utils/tests/test_serialization.py rename to tests/test_serialization.py diff --git a/src/diffpy/utils/tests/test_tools.py b/tests/test_tools.py similarity index 100% rename from src/diffpy/utils/tests/test_tools.py rename to tests/test_tools.py diff --git a/src/diffpy/utils/tests/testdata/dbload/e1.gr b/tests/testdata/dbload/e1.gr similarity index 100% rename from src/diffpy/utils/tests/testdata/dbload/e1.gr rename to tests/testdata/dbload/e1.gr diff --git a/src/diffpy/utils/tests/testdata/dbload/e2.gr b/tests/testdata/dbload/e2.gr similarity index 100% rename from src/diffpy/utils/tests/testdata/dbload/e2.gr rename to tests/testdata/dbload/e2.gr diff --git a/src/diffpy/utils/tests/testdata/dbload/e3.gr b/tests/testdata/dbload/e3.gr similarity index 100% rename from src/diffpy/utils/tests/testdata/dbload/e3.gr rename to tests/testdata/dbload/e3.gr diff --git a/src/diffpy/utils/tests/testdata/generated_db.json b/tests/testdata/generated_db.json similarity index 100% rename from src/diffpy/utils/tests/testdata/generated_db.json rename to tests/testdata/generated_db.json diff --git a/src/diffpy/utils/tests/testdata/generatewarnings.txt b/tests/testdata/generatewarnings.txt similarity index 100% rename from src/diffpy/utils/tests/testdata/generatewarnings.txt rename to tests/testdata/generatewarnings.txt diff --git a/src/diffpy/utils/tests/testdata/loaddata01.txt b/tests/testdata/loaddata01.txt similarity index 100% rename from src/diffpy/utils/tests/testdata/loaddata01.txt rename to tests/testdata/loaddata01.txt diff --git a/src/diffpy/utils/tests/testdata/loaddatawithheaders.txt b/tests/testdata/loaddatawithheaders.txt similarity index 100% rename from src/diffpy/utils/tests/testdata/loaddatawithheaders.txt rename to tests/testdata/loaddatawithheaders.txt diff --git a/src/diffpy/utils/tests/testdata/loadfile.txt b/tests/testdata/loadfile.txt similarity index 100% rename from src/diffpy/utils/tests/testdata/loadfile.txt rename to tests/testdata/loadfile.txt diff --git a/src/diffpy/utils/tests/testdata/strumining.json b/tests/testdata/strumining.json similarity index 100% rename from src/diffpy/utils/tests/testdata/strumining.json rename to tests/testdata/strumining.json diff --git a/src/diffpy/utils/tests/testdata/targetjson.json b/tests/testdata/targetjson.json similarity index 100% rename from src/diffpy/utils/tests/testdata/targetjson.json rename to tests/testdata/targetjson.json diff --git a/src/diffpy/utils/tests/testdata/wrong.type b/tests/testdata/wrong.type similarity index 100% rename from src/diffpy/utils/tests/testdata/wrong.type rename to tests/testdata/wrong.type diff --git a/src/diffpy/utils/tests/testhelpers.py b/tests/testhelpers.py similarity index 100% rename from src/diffpy/utils/tests/testhelpers.py rename to tests/testhelpers.py From fa20e3d7eabc3d3ca1b9f4d786e3d8663ded2d01 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 7 Sep 2024 13:27:00 -0400 Subject: [PATCH 02/85] Implement test helper as fixture --- tests/conftest.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index e3b63139..dd493352 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import json +from importlib.resources import as_file, files from pathlib import Path import pytest @@ -17,3 +18,20 @@ def user_filesystem(tmp_path): json.dump(home_config_data, f) yield tmp_path + + +def get_datafile(filename): + """Helper function to retrieve the file path for test data.""" + ref = files(__package__) / f"testdata/{filename}" + with as_file(ref) as rv: + return rv + + +@pytest.fixture +def datafile(): + """Fixture to dynamically load any test file.""" + + def _load(filename): + return get_datafile(filename) + + return _load \ No newline at end of file From a36af71eb77f046c8bd692a6ec79f9b5439db94f Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 7 Sep 2024 13:27:23 -0400 Subject: [PATCH 03/85] Remove unittest run files --- tests/debug.py | 35 ----------------------------------- tests/run.py | 37 ------------------------------------- 2 files changed, 72 deletions(-) delete mode 100644 tests/debug.py delete mode 100644 tests/run.py diff --git a/tests/debug.py b/tests/debug.py deleted file mode 100644 index fed20421..00000000 --- a/tests/debug.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.utils Complex Modeling Initiative -# (c) 2016 Brookhaven Science Associates, -# Brookhaven National Laboratory. -# All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE.txt for license information. -# -############################################################################## - -""" -Convenience module for debugging the unit tests using - -python -m diffpy.utils.tests.debug - -Exceptions raised by failed tests or other errors are not caught. -""" - - -if __name__ == "__main__": - import sys - - from diffpy.utils.tests import testsuite - - pattern = sys.argv[1] if len(sys.argv) > 1 else "" - suite = testsuite(pattern) - suite.debug() - - -# End of file diff --git a/tests/run.py b/tests/run.py deleted file mode 100644 index 241caf11..00000000 --- a/tests/run.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.utils by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2012 The Trustees of Columbia University -# in the City of New York. All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. -# -############################################################################## - -"""Convenience module for executing all unit tests with - -python -m diffpy.utils.tests.run -""" - -if __name__ == "__main__": - import sys - - # show warnings by default - if not sys.warnoptions: - import os - import warnings - - warnings.simplefilter("default") - # also affect subprocesses - os.environ["PYTHONWARNINGS"] = "default" - from diffpy.utils.tests import test - - # produce zero exit code for a successful test - sys.exit(not test().wasSuccessful()) - -# End of file From ccce7f2d153e5b779578d7105492e57e63f211be Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 7 Sep 2024 14:48:58 -0400 Subject: [PATCH 04/85] Remove content of pytest.ini --- pytest.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index 21473ae6..eea2c180 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1 @@ [pytest] -testpaths= src/diffpy/utils/tests -python_files = test_*.py From cc5305dcc1327c89ee459a35edfda7ec27dbd97c Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 7 Sep 2024 14:49:15 -0400 Subject: [PATCH 05/85] Run init files for unittest --- tests/__init__.py | 81 ----------------------------------------------- 1 file changed, 81 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 42a123f3..e69de29b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,81 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.utils by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2011 The Trustees of Columbia University -# in the City of New York. All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. -# -############################################################################## - -"""Unit tests for diffpy.utils. -""" - -import unittest - - -def testsuite(pattern=""): - """Create a unit tests suite for diffpy.utils package. - - Parameters - ---------- - pattern : str, optional - Regular expression pattern for selecting test cases. - Select all tests when empty. Ignore the pattern when - any of unit test modules fails to import. - - Returns - ------- - suite : `unittest.TestSuite` - The TestSuite object containing the matching tests. - """ - import re - from importlib.resources import as_file, files - from itertools import chain - from os.path import dirname - - loader = unittest.defaultTestLoader - ref = files(__package__) - with as_file(ref) as thisdir: - depth = __name__.count(".") + 1 - topdir = thisdir - for i in range(depth): - topdir = dirname(topdir) - suite_all = loader.discover(str(thisdir), top_level_dir=topdir) - # always filter the suite by pattern to test-cover the selection code. - suite = unittest.TestSuite() - rx = re.compile(pattern) - tsuites = list(chain.from_iterable(suite_all)) - tsok = all(isinstance(ts, unittest.TestSuite) for ts in tsuites) - if not tsok: # pragma: no cover - return suite_all - tcases = chain.from_iterable(tsuites) - for tc in tcases: - tcwords = tc.id().split(".") - shortname = ".".join(tcwords[-3:]) - if rx.search(shortname): - suite.addTest(tc) - # verify all tests are found for an empty pattern. - assert pattern or suite_all.countTestCases() == suite.countTestCases() - return suite - - -def test(): - """Execute all unit tests for the diffpy.utils package. - - Returns - ------- - result : `unittest.TestResult` - """ - suite = testsuite() - runner = unittest.TextTestRunner() - result = runner.run(suite) - return result - - -# End of file From 2d5e5716cfea89a066323d13c4d1c3a100bb6d72 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 7 Sep 2024 14:49:26 -0400 Subject: [PATCH 06/85] Use conftest within unittesT --- tests/test_loaddata.py | 12 ++++++++---- tests/test_serialization.py | 23 +++++++++++------------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/test_loaddata.py b/tests/test_loaddata.py index 9399e71d..a7221d0e 100644 --- a/tests/test_loaddata.py +++ b/tests/test_loaddata.py @@ -4,20 +4,22 @@ """ import unittest +import pytest import numpy from diffpy.utils.parsers import loadData -from diffpy.utils.tests.testhelpers import datafile - -loaddata01 = datafile("loaddata01.txt") -loaddatawithheaders = datafile("loaddatawithheaders.txt") ############################################################################## class TestLoadData(unittest.TestCase): + @pytest.fixture(autouse=True) + def prepare_fixture(self, datafile): + self.datafile = datafile + def test_loadData_default(self): """check loadData() with default options""" + loaddata01 = self.datafile("loaddata01.txt") d2c = numpy.array([[3, 31], [4, 32], [5, 33]]) self.assertRaises(IOError, loadData, "doesnotexist") # the default minrows=10 makes it read from the third line @@ -35,6 +37,7 @@ def test_loadData_default(self): def test_loadData_1column(self): """check loading of one-column data.""" + loaddata01 = self.datafile("loaddata01.txt") d1c = numpy.arange(1, 6) d = loadData(loaddata01, usecols=[0], minrows=1) self.assertTrue(numpy.array_equal(d1c, d)) @@ -46,6 +49,7 @@ def test_loadData_1column(self): def test_loadData_headers(self): """check loadData() with headers options enabled""" + loaddatawithheaders = self.datafile("loaddatawithheaders.txt") hignore = ["# ", "// ", "["] # ignore lines beginning with these strings delimiter = ": " # what our data should be separated by hdata = loadData(loaddatawithheaders, headers=True, hdel=delimiter, hignore=hignore) diff --git a/tests/test_serialization.py b/tests/test_serialization.py index bbe6be24..986892e7 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -5,21 +5,15 @@ from diffpy.utils.parsers import deserialize_data, loadData, serialize_data from diffpy.utils.parsers.custom_exceptions import ImproperSizeError, UnsupportedTypeError -from diffpy.utils.tests.testhelpers import datafile tests_dir = os.path.dirname(os.path.abspath(locals().get("__file__", "file.py"))) -targetjson = datafile("targetjson.json") -schemaname = datafile("strumining.json") -wrongtype = datafile("wrong.type") -loadfile = datafile("loadfile.txt") -warningfile = datafile("generatewarnings.txt") -nodt = datafile("loaddatawithheaders.txt") - -def test_load_multiple(tmp_path): - # generate json and apply schema +def test_load_multiple(tmp_path, datafile): + # Load test data + targetjson = datafile("targetjson.json") generatedjson = tmp_path / "generated_serialization.json" + tlm_list = os.listdir(os.path.join(tests_dir, "testdata", "dbload")) tlm_list.sort() generated_data = None @@ -50,7 +44,12 @@ def test_load_multiple(tmp_path): assert target_data == deserialize_data(generatedjson, filetype=".json") -def test_exceptions(): +def test_exceptions(datafile): + # Load test data + wrongtype = datafile("wrong.type") + loadfile = datafile("loadfile.txt") + warningfile = datafile("generatewarnings.txt") + nodt = datafile("loaddatawithheaders.txt") hdata = loadData(loadfile, headers=True) data_table = loadData(loadfile) @@ -107,4 +106,4 @@ def test_exceptions(): ) assert len(record) == 4 for msg in record: - assert "overwritten" in msg.message.args[0] + assert "overwritten" in msg.message.args[0] \ No newline at end of file From 19a7da822a7d92a9c9f7eba7413fc15fbe054843 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 7 Sep 2024 18:52:14 +0000 Subject: [PATCH 07/85] [pre-commit.ci] auto fixes from pre-commit hooks --- tests/conftest.py | 2 +- tests/test_loaddata.py | 4 ++-- tests/test_serialization.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index dd493352..09551da5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,4 +34,4 @@ def datafile(): def _load(filename): return get_datafile(filename) - return _load \ No newline at end of file + return _load diff --git a/tests/test_loaddata.py b/tests/test_loaddata.py index a7221d0e..2ca2fa07 100644 --- a/tests/test_loaddata.py +++ b/tests/test_loaddata.py @@ -4,9 +4,9 @@ """ import unittest -import pytest import numpy +import pytest from diffpy.utils.parsers import loadData @@ -16,7 +16,7 @@ class TestLoadData(unittest.TestCase): @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): self.datafile = datafile - + def test_loadData_default(self): """check loadData() with default options""" loaddata01 = self.datafile("loaddata01.txt") diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 986892e7..51921e01 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -106,4 +106,4 @@ def test_exceptions(datafile): ) assert len(record) == 4 for msg in record: - assert "overwritten" in msg.message.args[0] \ No newline at end of file + assert "overwritten" in msg.message.args[0] From e0aaad1862648bc26e44ed644c65d2bfef2b6951 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 8 Sep 2024 11:03:53 -0400 Subject: [PATCH 08/85] Include latest CI files from cookiecutter --- .github/workflows/codecov.yml | 53 ++++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 49 ++++++++++++++++-------------- .github/workflows/main.yml | 57 ++++++++++++++--------------------- 3 files changed, 102 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..67c555eb --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,53 @@ +name: Gather coverage report and upload to codecov + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: + +defaults: + run: + shell: bash -l {0} + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Check out diffpy.utils + uses: actions/checkout@v4 + + - name: Initialize miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: test + auto-update-conda: true + environment-file: environment.yml + auto-activate-base: false + + - name: Conda config + run: >- + conda config --set always_yes yes + --set changeps1 no + + - name: Install diffpy.utils and requirements + run: | + conda install --file requirements/run.txt + conda install --file requirements/test.txt + python -m pip install -r requirements/pip.txt + python -m pip install . --no-deps + + - name: Validate diffpy.utils + run: | + coverage run -m pytest -vv -s + coverage report -m + codecov + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a4661f5c..2dfe9640 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,43 +1,48 @@ -name: Build Documentation +name: Build and Deploy Documentation on: - push: - branches: - - main release: + types: + - published + workflow_dispatch: + +defaults: + run: + shell: bash -l {0} jobs: - test: + docs: runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Check out diffpy.utils + uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v2 + - name: Initialize miniconda + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: build auto-update-conda: true + environment-file: environment.yml + auto-activate-base: false - - name: install requirements + - name: Conda config run: >- - conda install -n build -c conda-forge - --file requirements/build.txt - --file requirements/run.txt - --file requirements/docs.txt - --quiet --yes + conda config --set always_yes yes + --set changeps1 no - - name: install the package - run: python -m pip install . --no-deps + - name: Install diffpy.utils and build requirements + run: | + conda install --file requirements/build.txt + conda install --file requirements/run.txt + conda install --file requirements/docs.txt + python -m pip install -r requirements/pip.txt + python -m pip install . --no-deps - name: build documents run: make -C doc html - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./doc/build/html + publish_dir: ./doc/build/html \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c39ace43..eeffc764 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,55 +1,42 @@ -name: CI +name: Test on: push: branches: - main - - CI pull_request: workflow_dispatch: +defaults: + run: + shell: bash -l {0} + jobs: - miniconda: - name: Miniconda ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["ubuntu-latest"] + validate: + runs-on: ubuntu-latest steps: - - name: check out diffpy.utils - uses: actions/checkout@v3 - with: - repository: diffpy/diffpy.utils - path: . - fetch-depth: 0 # avoid shallow clone with no tags + - name: Check out diffpy.utils + uses: actions/checkout@v4 - - name: initialize miniconda - # this uses a marketplace action that sets up miniconda in a way that makes - # it easier to use. I tried setting it up without this and it was a pain - uses: conda-incubator/setup-miniconda@v2 + - name: Initialize miniconda + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test - # environment.yml file is needed by this action. Because I don't want - # maintain this but rather maintain the requirements files it just has - # basic things in it like conda and pip - environment-file: ./environment.yml - python-version: 3 + auto-update-conda: true + environment-file: environment.yml auto-activate-base: false - - name: install diffpy.utils requirements - shell: bash -l {0} + - name: Conda config + run: >- + conda config --set always_yes yes + --set changeps1 no + + - name: Install diffpy.utils and requirements run: | - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda activate test conda install --file requirements/run.txt conda install --file requirements/test.txt - pip install . + python -m pip install -r requirements/pip.txt + python -m pip install . --no-deps - name: Validate diffpy.utils - shell: bash -l {0} - run: | - conda activate test - coverage run run_tests.py - coverage report -m - codecov + run: python -m pytest \ No newline at end of file From 567429eceb3d3b19fb2f37766e154372f73826e9 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 8 Sep 2024 11:07:45 -0400 Subject: [PATCH 09/85] Include empty pip.txt file to satisfy GH CI --- requirements/pip.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 requirements/pip.txt diff --git a/requirements/pip.txt b/requirements/pip.txt new file mode 100644 index 00000000..e69de29b From 163f509f15337cecf57bf847541ca75f400930fb Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 8 Sep 2024 11:10:52 -0400 Subject: [PATCH 10/85] Remove gitarchive, gitattributes --- .gitarchive.cfg | 5 ---- .gitattributes | 8 ------ devutils/makesdist | 61 ---------------------------------------------- 3 files changed, 74 deletions(-) delete mode 100644 .gitarchive.cfg delete mode 100644 .gitattributes delete mode 100755 devutils/makesdist diff --git a/.gitarchive.cfg b/.gitarchive.cfg deleted file mode 100644 index 95e1448c..00000000 --- a/.gitarchive.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -commit = $Format:%H$ -date = $Format:%ci$ -timestamp = $Format:%ct$ -refnames = $Format:%D$ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 13fc0b54..00000000 --- a/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -/.gitattributes export-ignore -/.gitignore export-ignore -/.travis.yml export-ignore -/conda-recipe/ export-ignore -/devutils export-ignore -/doc export-ignore -.gitarchive.cfg export-subst -*.bat text eol=crlf diff --git a/devutils/makesdist b/devutils/makesdist deleted file mode 100755 index 8b0a2179..00000000 --- a/devutils/makesdist +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python - -"""Create source distribution tar.gz archive, where each file belongs -to a root user and modification time is set to the git commit time. -""" - -import glob -import gzip -import os -import subprocess -import sys -import tarfile - -from setup import FALLBACK_VERSION, versiondata - -BASEDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -sys.path.insert(0, BASEDIR) - - -timestamp = versiondata.getint("DEFAULT", "timestamp") - -vfb = versiondata.get("DEFAULT", "version").split(".post")[0] + ".post0" -emsg = "Invalid FALLBACK_VERSION. Expected %r got %r." -assert vfb == FALLBACK_VERSION, emsg % (vfb, FALLBACK_VERSION) - - -def inform(s): - sys.stdout.write(s) - sys.stdout.flush() - return - - -inform('Run "setup.py sdist --formats=tar" ') -cmd_sdist = [sys.executable] + "setup.py sdist --formats=tar".split() -ec = subprocess.call(cmd_sdist, cwd=BASEDIR, stdout=open(os.devnull, "w")) -if ec: - sys.exit(ec) -inform("[done]\n") - -tarname = max(glob.glob(BASEDIR + "/dist/*.tar"), key=os.path.getmtime) - -tfin = tarfile.open(tarname) -fpout = gzip.GzipFile(tarname + ".gz", "w", mtime=0) -tfout = tarfile.open(fileobj=fpout, mode="w") - - -def fixtarinfo(tinfo): - tinfo.uid = tinfo.gid = 0 - tinfo.uname = tinfo.gname = "root" - tinfo.mtime = timestamp - tinfo.mode &= ~0o022 - return tinfo - - -inform("Filter %s --> %s.gz " % (2 * (os.path.basename(tarname),))) -for ti in tfin: - tfout.addfile(fixtarinfo(ti), tfin.extractfile(ti)) - -tfin.close() -os.remove(tarname) -inform("[done]\n") From 3882fdf085f5dbb618838883850217756c37d963 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 8 Sep 2024 11:11:06 -0400 Subject: [PATCH 11/85] Remove rever, run_tests --- rever.xsh | 18 ------------------ run_tests.py | 17 ----------------- 2 files changed, 35 deletions(-) delete mode 100644 rever.xsh delete mode 100644 run_tests.py diff --git a/rever.xsh b/rever.xsh deleted file mode 100644 index f1a87228..00000000 --- a/rever.xsh +++ /dev/null @@ -1,18 +0,0 @@ -$PROJECT = 'diffpy.utils' -$ACTIVITIES = [ - 'changelog', # Create a CHANGELOG.rst using news directory - 'tag', # Creates a tag for the new version number - 'push_tag', # Pushes the tag up to the $TAG_REMOTE - 'ghrelease', # Creates a Github release entry for the new tag - 'pypi', # Sends the package to pypi - ] -$CHANGELOG_FILENAME = 'CHANGELOG.rst' -$CHANGELOG_TEMPLATE = 'TEMPLATE.rst' -$CHANGELOG_IGNORE = ['TEMPLATE.rst'] -$PUSH_TAG_REMOTE = 'git@github.com:diffpy/diffpy.utils.git' # Repo to push tags to -$GITHUB_ORG = 'diffpy' # Github org for Github releases and conda-forge -$GITHUB_REPO = 'diffpy.utils' # Github repo for Github releases and conda-forge -$GHRELEASE_PREPEND = """See [CHANGELOG.rst](CHANGELOG.rst) for detailed release notes. - -The release is also available at [PyPI](https://pypi.org/project/diffpy.utils/) and [Conda](https://anaconda.org/conda-forge/diffpy.utils). -""" # release message diff --git a/run_tests.py b/run_tests.py deleted file mode 100644 index 9ab1aabb..00000000 --- a/run_tests.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python - -import sys - -import pytest - -if __name__ == "__main__": - # show output results from every test function - args = ["-v"] - # show the message output for skipped and expected failure tests - if len(sys.argv) > 1: - args.extend(sys.argv[1:]) - print("pytest arguments: {}".format(args)) - # # compute coverage stats for xpdAcq - # call pytest and exit with the return code from pytest - exit_res = pytest.main(args) - sys.exit(exit_res) From e176a37231367440b26406ca91964f7226b745fe Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 8 Sep 2024 11:12:24 -0400 Subject: [PATCH 12/85] Apply pre-commit --- .github/workflows/codecov.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/main.yml | 2 +- MANIFEST.in | 16 ++++------------ pyproject.toml | 6 +++--- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 67c555eb..e8bae0c8 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -50,4 +50,4 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2dfe9640..7b3ac4ce 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -45,4 +45,4 @@ jobs: uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./doc/build/html \ No newline at end of file + publish_dir: ./doc/build/html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eeffc764..fb0cb88b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,4 +39,4 @@ jobs: python -m pip install . --no-deps - name: Validate diffpy.utils - run: python -m pytest \ No newline at end of file + run: python -m pytest diff --git a/MANIFEST.in b/MANIFEST.in index 1e928c83..56f4a490 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,15 +1,7 @@ recursive-include src * +recursive-include tests * include AUTHORS.txt LICENSE*.txt README.rst -recursive-exclude src *.py[co] -global-exclude .gitattributes .gitignore .gitarchive.cfg -global-exclude .DS_Store -# Avoid user content in setup.cfg to make distribution reproducible. -exclude setup.cfg - -# Exclude git-tracked files spuriously added by setuptools_scm -exclude .coveragerc -exclude .travis* -prune conda-recipe -prune devutils -prune doc +# Exclude all bytecode files and __pycache__ directories +recursive-exclude src *.pyc *.pyo __pycache__/ +recursive-exclude tests *.pyc *.pyo __pycache__/ diff --git a/pyproject.toml b/pyproject.toml index 5d54b46f..5d8d0e57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,8 @@ requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] build-backend = "setuptools.build_meta" [project] -name = "diffpy.utils" -dynamic=['version'] +name = "diffpy.utilstestlee" +version = "3.2.0rc10" authors = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] @@ -46,7 +46,7 @@ dirty_template = "{tag}" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["diffpy*"] # package names should match these glob patterns (["*"] by default) -exclude = ["diffpy.utils.tests*"] # exclude packages matching these glob patterns (empty by default) +exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.black] From b1966f106b02fb2dd35dd82b9779628ba2393109 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 8 Sep 2024 11:19:30 -0400 Subject: [PATCH 13/85] Use unmodified MANIFEST, pyproject files --- MANIFEST.in | 16 ++++++++++++---- pyproject.toml | 8 ++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 56f4a490..1e928c83 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,15 @@ recursive-include src * -recursive-include tests * include AUTHORS.txt LICENSE*.txt README.rst +recursive-exclude src *.py[co] +global-exclude .gitattributes .gitignore .gitarchive.cfg +global-exclude .DS_Store -# Exclude all bytecode files and __pycache__ directories -recursive-exclude src *.pyc *.pyo __pycache__/ -recursive-exclude tests *.pyc *.pyo __pycache__/ +# Avoid user content in setup.cfg to make distribution reproducible. +exclude setup.cfg + +# Exclude git-tracked files spuriously added by setuptools_scm +exclude .coveragerc +exclude .travis* +prune conda-recipe +prune devutils +prune doc diff --git a/pyproject.toml b/pyproject.toml index 5d8d0e57..73a50ceb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,8 @@ requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] build-backend = "setuptools.build_meta" [project] -name = "diffpy.utilstestlee" -version = "3.2.0rc10" +name = "diffpy.utils" +dynamic=['version'] authors = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] @@ -46,7 +46,7 @@ dirty_template = "{tag}" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["diffpy*"] # package names should match these glob patterns (["*"] by default) -exclude = [] # exclude packages matching these glob patterns (empty by default) +exclude = ["diffpy.utils.tests*"] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.black] @@ -70,4 +70,4 @@ exclude = ''' | blib2to3 | tests/data )/ -''' +''' \ No newline at end of file From f5904fd4d2a312e0b51f944376ea4d0fb50702d6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2024 15:19:38 +0000 Subject: [PATCH 14/85] [pre-commit.ci] auto fixes from pre-commit hooks --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 73a50ceb..5d54b46f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,4 +70,4 @@ exclude = ''' | blib2to3 | tests/data )/ -''' \ No newline at end of file +''' From 8db3d9db3f4d7273a2646adc735c2386280e4910 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 8 Sep 2024 11:20:23 -0400 Subject: [PATCH 15/85] Remove unused testhelper.py --- pyproject.toml | 2 +- tests/testhelpers.py | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 tests/testhelpers.py diff --git a/pyproject.toml b/pyproject.toml index 73a50ceb..5d54b46f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,4 +70,4 @@ exclude = ''' | blib2to3 | tests/data )/ -''' \ No newline at end of file +''' diff --git a/tests/testhelpers.py b/tests/testhelpers.py deleted file mode 100644 index aaa2a519..00000000 --- a/tests/testhelpers.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.utils by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2011 The Trustees of Columbia University -# in the City of New York. All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. -# -############################################################################## - -"""Helper routines for running other unit tests. -""" - -# helper functions - - -def datafile(filename): - from importlib.resources import as_file, files - - ref = files(__package__) / ("testdata/" + filename) - with as_file(ref) as rv: - return rv - - -# End of file From bf2637245141ad0996bbe3c28a27c6c602adb5fc Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 12 Sep 2024 06:53:54 -0400 Subject: [PATCH 16/85] Trigger CI From 17b1c8b535d5582d929c91c50d6a116e444161a8 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 13:04:20 -0400 Subject: [PATCH 17/85] new workflow files --- .github/workflows/check-news-item.yml | 12 ++++++++++++ .../matrix-and-codecov-on-merge-to-main.yml | 19 +++++++++++++++++++ .github/workflows/publish-docs-on-release.yml | 14 ++++++++++++++ .github/workflows/tests-on-pr.yml | 16 ++++++++++++++++ .pre-commit-config.yaml | 5 ++++- 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/check-news-item.yml create mode 100644 .github/workflows/matrix-and-codecov-on-merge-to-main.yml create mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 .github/workflows/tests-on-pr.yml diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml new file mode 100644 index 00000000..be549960 --- /dev/null +++ b/.github/workflows/check-news-item.yml @@ -0,0 +1,12 @@ +name: Check for News + +on: + pull_request_target: + branches: + - main + +jobs: + check-news-item: + uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 + with: + project: diffpy.utils diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml new file mode 100644 index 00000000..091d9f50 --- /dev/null +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -0,0 +1,19 @@ +name: Codecov and matrix + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: + +jobs: + coverage-and-matrix: + uses: Billingegroup/release-scripts/.github/workflows/_coverage-and-matrix.yml@v0 + with: + project: diffpy.utils + c_extension: false + headless: false diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml new file mode 100644 index 00000000..56667dfa --- /dev/null +++ b/.github/workflows/publish-docs-on-release.yml @@ -0,0 +1,14 @@ +name: Build and Deploy Docs + +on: + release: + types: + - published + workflow_dispatch: + +jobs: + publish-docs-on-release: + uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: diffpy.utils + c_extension: false diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml new file mode 100644 index 00000000..dd0a102e --- /dev/null +++ b/.github/workflows/tests-on-pr.yml @@ -0,0 +1,16 @@ +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 + with: + project: diffpy.utils + c_extension: false + headless: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4588061..3070e199 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,10 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - exclude: '\.(rst|txt)$' + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml + - id: check-added-large-files - repo: https://github.com/psf/black rev: 24.4.2 hooks: From 834736a70ec83a25f46be6b2f60afe046554a535 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 13:08:24 -0400 Subject: [PATCH 18/85] adding authors, code of conduct etc. --- AUTHORS.rst | 10 ++++ CODE_OF_CONDUCT.rst | 133 ++++++++++++++++++++++++++++++++++++++++++++ LICENSE.rst | 30 ++++++++++ doc/make.bat | 36 ++++++++++++ 4 files changed, 209 insertions(+) create mode 100644 AUTHORS.rst create mode 100644 CODE_OF_CONDUCT.rst create mode 100644 LICENSE.rst create mode 100644 doc/make.bat diff --git a/AUTHORS.rst b/AUTHORS.rst new file mode 100644 index 00000000..cdb35e24 --- /dev/null +++ b/AUTHORS.rst @@ -0,0 +1,10 @@ +Authors +======= + +Billinge Group and community contibutors. + +Contributors +------------ + +For a list of contributors, visit +https://github.com/diffpy/diffpy.utils/graphs/contributors diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst new file mode 100644 index 00000000..ff9c3561 --- /dev/null +++ b/CODE_OF_CONDUCT.rst @@ -0,0 +1,133 @@ +===================================== + Contributor Covenant Code of Conduct +===================================== + +Our Pledge +---------- + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +Our Standards +------------- + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +Enforcement Responsibilities +---------------------------- + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +Scope +----- + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +Enforcement +----------- + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +sb2896@columbia.edu. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +Enforcement Guidelines +---------------------- + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +1. Correction +**************** + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +2. Warning +************* + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +3. Temporary Ban +****************** + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +4. Permanent Ban +****************** + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +Attribution +----------- + +This Code of Conduct is adapted from the `Contributor Covenant `_. + +Community Impact Guidelines were inspired by `Mozilla's code of conduct enforcement ladder `_. + +For answers to common questions about this code of conduct, see the `FAQ `_. `Translations are available `_ diff --git a/LICENSE.rst b/LICENSE.rst new file mode 100644 index 00000000..95a04ac9 --- /dev/null +++ b/LICENSE.rst @@ -0,0 +1,30 @@ +BSD 3-Clause License + +Copyright (c) 2024, The Trustees of Columbia University +in the City of New York. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 00000000..2be83069 --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,36 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build +set SPHINXPROJ=PackagingScientificPython + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd From 581d1a83a6c3dc1bb35920c5480049548ea56003 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 13:12:50 -0400 Subject: [PATCH 19/85] adding _static --- doc/source/_static/.placeholder | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/source/_static/.placeholder diff --git a/doc/source/_static/.placeholder b/doc/source/_static/.placeholder new file mode 100644 index 00000000..e69de29b From d9afddf7ec2c0e4d421447a82fa5394b78c9cc79 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 13:20:51 -0400 Subject: [PATCH 20/85] removing deleted files from git --- .github/workflows/codecov.yml | 53 ------------- .github/workflows/docs.yml | 48 ------------ .github/workflows/main.yml | 42 ----------- AUTHORS.txt | 5 -- LICENSE.txt | 137 ---------------------------------- LICENSE_DANSE.txt | 41 ---------- pytest.ini | 1 - 7 files changed, 327 deletions(-) delete mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/main.yml delete mode 100644 AUTHORS.txt delete mode 100644 LICENSE.txt delete mode 100644 LICENSE_DANSE.txt delete mode 100644 pytest.ini diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index e8bae0c8..00000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Gather coverage report and upload to codecov - -on: - push: - branches: - - main - release: - types: - - prereleased - - published - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - coverage: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.utils - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.utils and requirements - run: | - conda install --file requirements/run.txt - conda install --file requirements/test.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: Validate diffpy.utils - run: | - coverage run -m pytest -vv -s - coverage report -m - codecov - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 7b3ac4ce..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Build and Deploy Documentation - -on: - release: - types: - - published - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.utils - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: build - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.utils and build requirements - run: | - conda install --file requirements/build.txt - conda install --file requirements/run.txt - conda install --file requirements/docs.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: build documents - run: make -C doc html - - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./doc/build/html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index fb0cb88b..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Test - -on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.utils - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.utils and requirements - run: | - conda install --file requirements/run.txt - conda install --file requirements/test.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: Validate diffpy.utils - run: python -m pytest diff --git a/AUTHORS.txt b/AUTHORS.txt deleted file mode 100644 index 92b450db..00000000 --- a/AUTHORS.txt +++ /dev/null @@ -1,5 +0,0 @@ -Pavol Juhas -Andrew yang -Timur Davis -Christopher L. Farrow -Simon J.L. Billinge diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index f6d92af7..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,137 +0,0 @@ -OPEN SOURCE LICENSE AGREEMENT -============================= - -Copyright (c) 2009-2011, University of Tennessee -Copyright (c) 1989, 1991 Free Software Foundation, Inc. -Copyright (c) 2006, The Regents of the University of California through - Lawrence Berkeley National Laboratory -Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") -Copyright (c) 2006-2007, Board of Trustees of Michigan State University -Copyright (c) 2008-2012, The Trustees of Columbia University in the City - of New York - -Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National - Laboratory - - -The "DiffPy-CMI" is distributed subject to the following license conditions: - - -SOFTWARE LICENSE AGREEMENT - - Software: DiffPy-CMI - - -(1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either -source code, or binary form and accompanying documentation). - -Part of the software was derived from the DANSE, ObjCryst++ (with permission), -PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of -which the original Copyrights are contained in each individual file. - -Each licensee is addressed as "you" or "Licensee." - - -(2) The copyright holders shown above and their third-party Licensors hereby -grant licensee a royalty-free nonexclusive license, subject to the limitations -stated herein and U.S. Government license rights. - - -(3) You may modify and make a copy or copies of the software for use within -your organization, if you meet the following conditions: - - (a) Copies in source code must include the copyright notice and this - software license agreement. - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy. - - -(4) You may modify a copy or copies of the Software or any portion of it, thus -forming a work based on the Software, and distribute copies of such work -outside your organization, if you meet all of the following conditions: - - (a) Copies in source code must include the copyright notice and this - Software License Agreement; - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy; - - (c) Modified copies and works based on the Software must carry prominent - notices stating that you changed specified portions of the Software. - - (d) Neither the name of Brookhaven Science Associates or Brookhaven - National Laboratory nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - written permission. - - -(5) Portions of the Software resulted from work developed under a U.S. -Government contract and are subject to the following license: -The Government is granted for itself and others acting on its behalf a -paid-up, nonexclusive, irrevocable worldwide license in this computer software -to reproduce, prepare derivative works, and perform publicly and display -publicly. - - -(6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT -WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY -LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND -THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL -LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF -THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE -PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION -UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. - - -(7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR -THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF -ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, -CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING -BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, -WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING -NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS -BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. - - -Brookhaven National Laboratory Notice -===================================== - -Acknowledgment of sponsorship ------------------------------ - -This software was produced by the Brookhaven National Laboratory, under -Contract DE-AC02-98CH10886 with the Department of Energy. - - -Government disclaimer of liability ----------------------------------- - -Neither the United States nor the United States Department of Energy, nor -any of their employees, makes any warranty, express or implied, or assumes -any legal liability or responsibility for the accuracy, completeness, or -usefulness of any data, apparatus, product, or process disclosed, or -represents that its use would not infringe privately owned rights. - - -Brookhaven disclaimer of liability ----------------------------------- - -Brookhaven National Laboratory makes no representations or warranties, -express or implied, nor assumes any liability for the use of this software. - - -Maintenance of notice ---------------------- - -In the interest of clarity regarding the origin and status of this -software, Brookhaven National Laboratory requests that any recipient of it -maintain this notice affixed to any distribution by the recipient that -contains a copy or derivative of this software. - - -END OF LICENSE diff --git a/LICENSE_DANSE.txt b/LICENSE_DANSE.txt deleted file mode 100644 index b7e1c702..00000000 --- a/LICENSE_DANSE.txt +++ /dev/null @@ -1,41 +0,0 @@ -This program is part of the DiffPy and DANSE open-source projects -and is available subject to the conditions and terms laid out below. - -Copyright 2006-2007, Board of Trustees of Michigan State University, -Copyright 2008-2012, The Trustees of Columbia University in the -city of New York. (Copyright holder indicated in each source file). - -For more information please visit the project web-page: - http://www.diffpy.org/ -or email Prof. Simon Billinge at sb2896@columbia.edu - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS". COPYRIGHT HOLDER -EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EITHER -EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS, ADEQUACY OR SUITABILITY -FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES OF FREEDOM FROM -INFRINGEMENT OF ANY DOMESTIC OR FOREIGN PATENT, COPYRIGHTS, TRADE -SECRETS OR OTHER PROPRIETARY RIGHTS OF ANY PARTY. IN NO EVENT SHALL -COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE OR RELATING TO THIS AGREEMENT, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index eea2c180..00000000 --- a/pytest.ini +++ /dev/null @@ -1 +0,0 @@ -[pytest] From 8a29941e9783f85b450e713b3aed904f47dd6e13 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:40:48 +0000 Subject: [PATCH 21/85] [pre-commit.ci] auto fixes from pre-commit hooks --- doc/source/examples/toolsexample.rst | 2 +- doc/source/utilities/toolsutility.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/examples/toolsexample.rst b/doc/source/examples/toolsexample.rst index d4d00cce..b3f615fd 100644 --- a/doc/source/examples/toolsexample.rst +++ b/doc/source/examples/toolsexample.rst @@ -56,4 +56,4 @@ Using the tools module, we can efficiently get them in terms of a dictionary. updated_dict = get_package_info("my_package", metadata=existing_dict)) note that `"diffpy.utils"` is automatically included in the package info since the `get_user_info` function is - part of diffpy.utils. + part of diffpy.utils. diff --git a/doc/source/utilities/toolsutility.rst b/doc/source/utilities/toolsutility.rst index 973056e5..01685a93 100644 --- a/doc/source/utilities/toolsutility.rst +++ b/doc/source/utilities/toolsutility.rst @@ -17,7 +17,7 @@ The ``diffpy.utils.tools`` module provides tool functions for use with diffpy ap ``{"package_info": {"package1": "version_number1", "package2": "version_number2"}`` if the function is called more than once. - Users can use these functions to track and manage versions of packages that can later be stored, for example, in an output - file header. + Users can use these functions to track and manage versions of packages that can later be stored, for example, in an output + file header. For a more in-depth tutorial for how to use these tools, click :ref:`here `. From 153f8437be8c927ea0a447bb8e704e639712fd60 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 14:28:39 -0400 Subject: [PATCH 22/85] finishing the recut --- .codecov.yml | 2 +- .coveragerc | 29 ++------- .flake8 | 5 +- .gitignore | 88 +++++++++++++++++++++------ MANIFEST.in | 23 ++++--- README.rst | 113 ++++++++++++++++++++++------------- doc/Makefile | 9 +-- doc/source/conf.py | 22 ++++--- doc/source/index.rst | 26 ++++---- pyproject.toml | 20 ++++--- src/diffpy/__init__.py | 11 ++-- src/diffpy/utils/__init__.py | 17 +++--- src/diffpy/utils/version.py | 14 ++--- tests/__init__.py | 0 14 files changed, 225 insertions(+), 154 deletions(-) delete mode 100644 tests/__init__.py diff --git a/.codecov.yml b/.codecov.yml index 03afe9c3..04dd6510 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -20,7 +20,7 @@ coverage: target: auto if_no_uploads: error if_not_found: success - if_ci_failed: failure + if_ci_failed: error paths: '!*/tests/.*' tests: diff --git a/.coveragerc b/.coveragerc index f6252ad3..0ed6eac5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,32 +1,13 @@ -# Configuration of the coverage.py tool for reporting test coverage. - +[run] +source = + diffpy.utils [report] -# RE patterns for lines to be excluded from consideration. -exclude_lines = - ## Have to re-enable the standard pragma - pragma: no cover - ## Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - ^[ ]*assert False - - ## Don't complain if non-runnable code isn't run: - ^[ ]*@unittest.skip\b - ^[ ]{4}unittest.main() - if __name__ == .__main__.: omit = */python?.?/* */site-packages/nose/* # ignore _version.py and versioneer.py .*version.* *_version.py - # ignore wx directory - */wx/* - -[run] -source = - src/diffpy/utils/ -omit = - ## exclude debug.py from codecov report - */tests/debug.py +exclude_lines = + if __name__ == '__main__': diff --git a/.flake8 b/.flake8 index 49384350..2d2cb168 100644 --- a/.flake8 +++ b/.flake8 @@ -4,9 +4,8 @@ exclude = __pycache__, build, dist, - versioneer.py, - doc/manual/source/conf.py + doc/source/conf.py max-line-length = 115 -# Ignore some style 'errors' produced while formatting by 'black' (see link below) +# Ignore some style 'errors' produced while formatting by 'black' # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings extend-ignore = E203 diff --git a/.gitignore b/.gitignore index f49476b4..a25212ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,49 +1,99 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ *.py[cod] +*$py.class # C extensions *.so -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -temp -develop-eggs +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +venv/ +*.egg-info/ .installed.cfg -lib -lib64 -tags +*.egg +bin/ +temp/ +tags/ errors.err +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + # Installer logs pip-log.txt +pip-delete-this-directory.txt MANIFEST # Unit test / coverage reports +htmlcov/ +.tox/ .coverage -.tox +.coverage.* +.cache nosetests.xml +coverage.xml +*,cover +.hypothesis/ # Translations *.mo +*.pot # Mr Developer .mr.developer.cfg .project .pydevproject +# Django stuff: +*.log + +# Sphinx documentation +docs/build/ +docs/source/generated/ + +# pytest +.pytest_cache/ + +# PyBuilder +target/ + +# Editor files +# mac +.DS_Store +*~ + +# vim +*.swp +*.swo + +# pycharm +.idea/ + +# VSCode +.vscode/ + +# Ipython Notebook +.ipynb_checkpoints + # version information setup.cfg /src/diffpy/*/version.cfg # Rever rever/ - -# PyCharm -.idea/ diff --git a/MANIFEST.in b/MANIFEST.in index 1e928c83..f1a78eec 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,15 +1,12 @@ -recursive-include src * -include AUTHORS.txt LICENSE*.txt README.rst -recursive-exclude src *.py[co] -global-exclude .gitattributes .gitignore .gitarchive.cfg -global-exclude .DS_Store +graft src +graft tests +graft requirements -# Avoid user content in setup.cfg to make distribution reproducible. -exclude setup.cfg +include AUTHORS.rst LICENSE*.rst README.rst -# Exclude git-tracked files spuriously added by setuptools_scm -exclude .coveragerc -exclude .travis* -prune conda-recipe -prune devutils -prune doc +# 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. diff --git a/README.rst b/README.rst index b7b1ec35..1eb23adb 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,39 @@ -.. image:: https://github.com/diffpy/diffpy.utils/actions/workflows/main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.utils/actions/workflows/main.yml +|Icon| |title|_ +=============== -.. image:: https://codecov.io/gh/diffpy/diffpy.utils/branch/main/graph/badge.svg - :target: https://codecov.io/gh/diffpy/diffpy.utils +.. |title| replace:: diffpy.utils +.. _title: https://diffpy.github.io/diffpy.utils +.. |Icon| image:: https://avatars.githubusercontent.com/diffpy + :target: https://diffpy.github.io/diffpy.utils + :height: 100px + +|PyPi| |Forge| |PythonVersion| |PR| + +|CI| |Codecov| |Black| |Tracking| + +.. |Black| image:: https://img.shields.io/badge/code_style-black-black + :target: https://github.com/psf/black + +.. |CI| image:: https://github.com/diffpy/diffpy.utils/actions/workflows/codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.utils/actions/workflows/codecov-on-merge-to-main.yml + +.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.utils/branch/main/graph/badge.svg + :target: https://codecov.io/gh/diffpy/diffpy.utils + +.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.utils + :target: https://anaconda.org/conda-forge/diffpy.utils + +.. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff + +.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.utils + :target: https://pypi.org/project/diffpy.utils/ + +.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.utils + :target: https://pypi.org/project/diffpy.utils/ + +.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue + :target: https://github.com/diffpy/diffpy.utils/issues diffpy.utils ======================================================================== @@ -16,11 +46,15 @@ program. The package also includes an interpolation function based on the Whittaker-Shannon formula that can be used to resample a PDF or other profile function over a new grid. -For more information about the diffpy.utils library, see the users manual at -http://diffpy.github.io/diffpy.utils. +Citation +-------- + +If you use diffpy.utils in a scientific publication, we would like you to cite this package as + + diffpy.utils Package, https://github.com/diffpy/diffpy.utils -INSTALLATION ------------------------------------------------------------------------- +Installation +------------ The preferred method is to use `Miniconda Python `_ @@ -28,66 +62,65 @@ and install from the "conda-forge" channel of Conda packages. To add "conda-forge" to the conda channels, run the following in a terminal. :: - conda config --add channels conda-forge + conda config --add channels conda-forge We want to install our packages in a suitable conda environment. -The following creates and activates a new environment named ``diffpy-utils`` :: +The following creates and activates a new environment named ``diffpy.utils_env`` :: - conda create -n diffpy-utils python=3 - conda activate diffpy-utils + conda create -n diffpy.utils_env python=3 + conda activate diffpy.utils_env Then, to fully install ``diffpy.utils`` in our active environment, run :: - conda install diffpy.utils + conda install diffpy.utils Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -To install using ``pip`` into your ``diffpy-utils`` environment, we will also have to install dependencies :: +To install using ``pip`` into your ``diffpy.utils_env`` environment, we will also have to install dependencies :: - pip install numpy - pip install diffpy.utils + pip install -r https://raw.githubusercontent.com/diffpy/diffpy.utils/main/requirements/run.txt -For those planning to use functions in the ``diffpy.utils.wx`` module, you will also need to install ``wxPython``. -Both of the following lines will install this package. :: +and then install the package :: - conda install wxPython - pip install wxPython + pip install diffpy.utils If you prefer to install from sources, after installing the dependencies, obtain the source archive from `GitHub `_. Once installed, ``cd`` into your ``diffpy.utils`` directory and run the following :: - pip install . + pip install . -To check the installation integrity, if the following passes all checks, you are good! :: +Support and Contribute +---------------------- - pip install pytest - python -m diffpy.utils.tests.run +`Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.utils. Please join the diffpy.utils users community by joining the Google group. The diffpy.utils project welcomes your expertise and enthusiasm! +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. -DEVELOPMENT ------------------------------------------------------------------------- - -diffpy.utils is an open-source software developed as a part of the -DiffPy-CMI complex modeling initiative at the Brookhaven National -Laboratory. The diffpy.utils sources are hosted at -https://github.com/diffpy/diffpy.utils. - -Feel free to fork the project and contribute. To install diffpy.utils +Feel free to fork the project and contribute. To install diffpy.utils in a development mode, with its sources being directly used by Python rather than copied to a package directory, use the following in the root directory :: - pip install -e . + pip install -e . + +To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit +hooks. + +1. Install pre-commit in your working environment by running ``conda install pre-commit``. -Note that this is only supported for `setuptools` version 62.0 and above. +2. Initialize pre-commit (one time only) ``pre-commit install``. +Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. +If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should +pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before +trying to commit again. -CONTACTS ------------------------------------------------------------------------- +Improvements and fixes are always appreciated. -For more information on diffpy.utils please visit the project web-page +Before contribuing, please read our `Code of Conduct `_. -http://www.diffpy.org/ +Contact +------- -or email Prof. Simon Billinge at sb2896@columbia.edu. +For more information on diffpy.utils please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. diff --git a/doc/Makefile b/doc/Makefile index 00a6ed10..623232f0 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -6,6 +6,7 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build +BASENAME = $(subst .,,$(subst $() $(),,diffpy.utils)) # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) @@ -85,17 +86,17 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/diffpyutils.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/$(BASENAME).qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/diffpyutils.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(BASENAME).qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/diffpyutils" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/diffpyutils" + @echo "# mkdir -p $$HOME/.local/share/devhelp/$(BASENAME)" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/$(BASENAME)" @echo "# devhelp" epub: diff --git a/doc/source/conf.py b/doc/source/conf.py index e85a33da..721f940e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,20 +13,20 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import os import sys import time from importlib.metadata import version +from pathlib import Path # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# sys.path.insert(0, os.path.abspath('.')) -sys.path.insert(0, os.path.abspath("../..")) -sys.path.insert(0, os.path.abspath("../../src")) +# documentation root, use Path().resolve() to make it absolute, like shown here. +# sys.path.insert(0, str(Path(".").resolve())) +sys.path.insert(0, str(Path("../..").resolve())) +sys.path.insert(0, str(Path("../../src").resolve())) # abbreviations -ab_authors = "Pavol Juhás, Timur Davis, Christopher L. Farrow, Simon J.L. Billinge group" +ab_authors = "Pavol Juhás, Christopher L. Farrow, Billinge Group members and community contributors" # -- General configuration ------------------------------------------------ @@ -38,8 +38,11 @@ # ones. extensions = [ "sphinx.ext.autodoc", - "sphinx.ext.intersphinx", + "sphinx.ext.napoleon", + "sphinx.ext.todo", "sphinx.ext.viewcode", + "sphinx.ext.intersphinx", + "sphinx_rtd_theme", "m2r", ] @@ -59,7 +62,7 @@ # General information about the project. project = "diffpy.utils" -copyright = "%Y, Brookhaven National Laboratory" +copyright = "%Y, The Trustees of Columbia University in the City of New York" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -199,7 +202,8 @@ # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = "diffpyutilsdoc" +basename = "diffpy.utils".replace(" ", "").replace(".", "") +htmlhelp_basename = basename + "doc" # -- Options for LaTeX output --------------------------------------------- diff --git a/doc/source/index.rst b/doc/source/index.rst index 0cd373a6..f9f9fe80 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,8 +1,10 @@ -#################################################### -diffpy.utils documentation -#################################################### +####### +|title| +####### -diffpy.utils - general purpose shared utilities for the diffpy libraries. +.. |title| replace:: diffpy.utils documentation + +diffpy.utils - Shared utilities for diffpy packages. | Software version |release|. | Last updated |today|. @@ -28,22 +30,22 @@ Authors diffpy.utils is developed by members of the Billinge Group at Columbia University and at Brookhaven National Laboratory including -Pavol Juhás, Timur Davis, Christopher L. Farrow, Simon J.L. Billinge. +Pavol Juhás, Christopher L. Farrow, the Billinge Group +and its community contributors. For a detailed list of contributors see https://github.com/diffpy/diffpy.utils/graphs/contributors. -====================================== +============ Installation -====================================== +============ See the `README `_ file included with the distribution. -====================================== +================= Table of contents -====================================== - +================= .. toctree:: :titlesonly: @@ -53,9 +55,9 @@ Table of contents Examples Package API -====================================== +======= Indices -====================================== +======= * :ref:`genindex` * :ref:`search` diff --git a/pyproject.toml b/pyproject.toml index 5d54b46f..4337830d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,17 +4,17 @@ build-backend = "setuptools.build_meta" [project] name = "diffpy.utils" -dynamic=['version'] +dynamic=['version', 'dependencies'] authors = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] -description = "Shared utilities for diffpy packages." -keywords = ["text data parsers", "wx grid", "diffraction objects"] +description = "Shared utilities for diffpy packages" +keywords = ['"text data parsers" "wx grid" "diffraction objects"'] readme = "README.rst" -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -25,17 +25,16 @@ classifiers = [ 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Operating System :: Unix', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Topic :: Scientific/Engineering :: Physics', + 'Topic :: Scientific/Engineering :: Chemistry', ] [project.urls] Homepage = "https://github.com/diffpy/diffpy.utils/" -Issues = "https://github.com/diffpy/diffpy.utils/issues" +Issues = "https://github.com/diffpy/diffpy.utils/issues/" [tool.setuptools-git-versioning] enabled = true @@ -45,10 +44,13 @@ dirty_template = "{tag}" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) -include = ["diffpy*"] # package names should match these glob patterns (["*"] by default) -exclude = ["diffpy.utils.tests*"] # exclude packages matching these glob patterns (empty by default) +include = ["*"] # package names should match these glob patterns (["*"] by default) +exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) +[tool.setuptools.dynamic] +dependencies = {file = ["requirements/run.txt"]} + [tool.black] line-length = 115 include = '\.pyi?$' diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index f37a7759..11a4204c 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -5,11 +5,15 @@ # 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. +# All rights reserved. # -# File coded by: Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.utils/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## @@ -23,5 +27,4 @@ __path__ = extend_path(__path__, __name__) - # End of file diff --git a/src/diffpy/utils/__init__.py b/src/diffpy/utils/__init__.py index 3abeab37..41a4fa54 100644 --- a/src/diffpy/utils/__init__.py +++ b/src/diffpy/utils/__init__.py @@ -1,20 +1,19 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.utils 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. +# All rights reserved. # -# File coded by: Chris Farrow, Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.utils/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## -"""Smaller shared functions for use by other diffpy packages. -""" +"""Shared utilities for diffpy packages""" # package version from diffpy.utils.version import __version__ diff --git a/src/diffpy/utils/version.py b/src/diffpy/utils/version.py index 2566d69f..e42fed78 100644 --- a/src/diffpy/utils/version.py +++ b/src/diffpy/utils/version.py @@ -1,15 +1,15 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.utils by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2011 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. +# All rights reserved. # -# File coded by: Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.utils/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 From af47408596ae6977509245a866a954a4c613e266 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 14:38:59 -0400 Subject: [PATCH 23/85] force a build with readme tweak --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 1eb23adb..ed6f27f6 100644 --- a/README.rst +++ b/README.rst @@ -35,7 +35,7 @@ .. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue :target: https://github.com/diffpy/diffpy.utils/issues -diffpy.utils +diffpy.utils Package ======================================================================== General purpose shared utilities for the diffpy libraries. From b8d458bbfde87f162dac8eaa7bd491677cdd99f9 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 14:46:50 -0400 Subject: [PATCH 24/85] fix conftest.py and news --- news/recut.rst | 23 +++++++++++++++++++++++ tests/conftest.py | 10 +--------- 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 news/recut.rst diff --git a/news/recut.rst b/news/recut.rst new file mode 100644 index 00000000..c8c0a36a --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Updated package structure to new group standard + +**Security:** + +* diff --git a/tests/conftest.py b/tests/conftest.py index 09551da5..5471acc1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,4 @@ import json -from importlib.resources import as_file, files from pathlib import Path import pytest @@ -20,18 +19,11 @@ def user_filesystem(tmp_path): yield tmp_path -def get_datafile(filename): - """Helper function to retrieve the file path for test data.""" - ref = files(__package__) / f"testdata/{filename}" - with as_file(ref) as rv: - return rv - - @pytest.fixture def datafile(): """Fixture to dynamically load any test file.""" def _load(filename): - return get_datafile(filename) + return "tests/testdata/" + filename return _load From 6131f9fc915a1b47d2868eed436861df57c86574 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 14:58:58 -0400 Subject: [PATCH 25/85] fix matrix-workflow --- .github/workflows/matrix-and-codecov-on-merge-to-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index 091d9f50..b1102cce 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -12,7 +12,7 @@ on: jobs: coverage-and-matrix: - uses: Billingegroup/release-scripts/.github/workflows/_coverage-and-matrix.yml@v0 + uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: project: diffpy.utils c_extension: false From 34261a1e8eae1b0e99ebd464c94fa47f34a4a766 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 16 Sep 2024 15:32:36 -0400 Subject: [PATCH 26/85] Include api doc --- doc/source/api/diffpy.utils.parsers.rst | 28 ++++++++++++------ doc/source/api/diffpy.utils.rst | 5 +++- .../api/diffpy.utils.scattering_objects.rst | 29 +++++++++++++++++++ doc/source/api/diffpy.utils.wx.rst | 8 +++-- 4 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 doc/source/api/diffpy.utils.scattering_objects.rst diff --git a/doc/source/api/diffpy.utils.parsers.rst b/doc/source/api/diffpy.utils.parsers.rst index 82c70ed7..223accd7 100644 --- a/doc/source/api/diffpy.utils.parsers.rst +++ b/doc/source/api/diffpy.utils.parsers.rst @@ -1,4 +1,4 @@ -.. _Parsers Documentation: +:tocdepth: -1 diffpy.utils.parsers package ============================ @@ -8,28 +8,38 @@ diffpy.utils.parsers package :undoc-members: :show-inheritance: -For a sample data extraction workflow, see :ref:`parsers example`. +Submodules +---------- + +diffpy.utils.parsers.resample module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.utils.parsers.resample + :members: + :undoc-members: + :show-inheritance: diffpy.utils.parsers.loaddata module ------------------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: diffpy.utils.parsers.loaddata :members: :undoc-members: :show-inheritance: -diffpy.utils.parsers.serialization module ------------------------------------------ +diffpy.utils.parsers.custom_exceptions module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. automodule:: diffpy.utils.parsers.serialization +.. automodule:: diffpy.utils.parsers.custom_exceptions :members: :undoc-members: :show-inheritance: -diffpy.utils.parsers.resample module ------------------------------------- +diffpy.utils.parsers.serialization module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. automodule:: diffpy.utils.parsers.resample +.. automodule:: diffpy.utils.parsers.serialization :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.utils.rst b/doc/source/api/diffpy.utils.rst index f9a9c099..3ce300f4 100644 --- a/doc/source/api/diffpy.utils.rst +++ b/doc/source/api/diffpy.utils.rst @@ -12,17 +12,20 @@ Subpackages ----------- .. toctree:: + :titlesonly: diffpy.utils.parsers diffpy.utils.wx + diffpy.utils.scattering_objects Submodules ---------- diffpy.utils.tools module -------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: diffpy.utils.tools :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.utils.scattering_objects.rst b/doc/source/api/diffpy.utils.scattering_objects.rst new file mode 100644 index 00000000..928eca4a --- /dev/null +++ b/doc/source/api/diffpy.utils.scattering_objects.rst @@ -0,0 +1,29 @@ +:tocdepth: -1 + +diffpy.utils.scattering_objects package +======================================= + +.. automodule:: diffpy.utils.scattering_objects + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +diffpy.utils.scattering_objects.user_config module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.utils.scattering_objects.user_config + :members: + :undoc-members: + :show-inheritance: + +diffpy.utils.scattering_objects.diffraction_objects module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.utils.scattering_objects.diffraction_objects + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/api/diffpy.utils.wx.rst b/doc/source/api/diffpy.utils.wx.rst index fb747f58..60f60599 100644 --- a/doc/source/api/diffpy.utils.wx.rst +++ b/doc/source/api/diffpy.utils.wx.rst @@ -1,4 +1,4 @@ -.. _wx Python Utilities Documentation +:tocdepth: -1 diffpy.utils.wx package ======================= @@ -8,10 +8,14 @@ diffpy.utils.wx package :undoc-members: :show-inheritance: +Submodules +---------- + diffpy.utils.wx.gridutils module --------------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: diffpy.utils.wx.gridutils :members: :undoc-members: :show-inheritance: + From c115f18c827b35ef9526fbeb5f8cd0bfed122869 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:33:38 +0000 Subject: [PATCH 27/85] [pre-commit.ci] auto fixes from pre-commit hooks --- doc/source/api/diffpy.utils.parsers.rst | 1 - doc/source/api/diffpy.utils.rst | 1 - doc/source/api/diffpy.utils.scattering_objects.rst | 1 - doc/source/api/diffpy.utils.wx.rst | 1 - 4 files changed, 4 deletions(-) diff --git a/doc/source/api/diffpy.utils.parsers.rst b/doc/source/api/diffpy.utils.parsers.rst index 223accd7..0709cf3a 100644 --- a/doc/source/api/diffpy.utils.parsers.rst +++ b/doc/source/api/diffpy.utils.parsers.rst @@ -42,4 +42,3 @@ diffpy.utils.parsers.serialization module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.utils.rst b/doc/source/api/diffpy.utils.rst index 3ce300f4..cf69f596 100644 --- a/doc/source/api/diffpy.utils.rst +++ b/doc/source/api/diffpy.utils.rst @@ -28,4 +28,3 @@ diffpy.utils.tools module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.utils.scattering_objects.rst b/doc/source/api/diffpy.utils.scattering_objects.rst index 928eca4a..fe511bf5 100644 --- a/doc/source/api/diffpy.utils.scattering_objects.rst +++ b/doc/source/api/diffpy.utils.scattering_objects.rst @@ -26,4 +26,3 @@ diffpy.utils.scattering_objects.diffraction_objects module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.utils.wx.rst b/doc/source/api/diffpy.utils.wx.rst index 60f60599..76c89035 100644 --- a/doc/source/api/diffpy.utils.wx.rst +++ b/doc/source/api/diffpy.utils.wx.rst @@ -18,4 +18,3 @@ diffpy.utils.wx.gridutils module :members: :undoc-members: :show-inheritance: - From 49c873e37bae53af92aa864d424e8676b6fec644 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 16:03:54 -0400 Subject: [PATCH 28/85] fix badge name, take 1 --- .github/workflows/matrix-and-codecov-on-merge-to-main.yml | 2 +- README.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index b1102cce..4db7a40e 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -11,7 +11,7 @@ on: workflow_dispatch: jobs: - coverage-and-matrix: + CI: uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: project: diffpy.utils diff --git a/README.rst b/README.rst index ed6f27f6..38916e22 100644 --- a/README.rst +++ b/README.rst @@ -15,8 +15,8 @@ .. |Black| image:: https://img.shields.io/badge/code_style-black-black :target: https://github.com/psf/black -.. |CI| image:: https://github.com/diffpy/diffpy.utils/actions/workflows/codecov-on-merge-to-main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.utils/actions/workflows/codecov-on-merge-to-main.yml +.. |CI| image:: https://github.com/diffpy/diffpy.utils/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.utils/actions/workflows/matrix-and-codecov-on-merge-to-main.yml .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.utils/branch/main/graph/badge.svg :target: https://codecov.io/gh/diffpy/diffpy.utils From 655e43e6bdc609dbceb715d04a4fa3864bd15697 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 16 Sep 2024 16:08:08 -0400 Subject: [PATCH 29/85] Change name to CI --- .github/workflows/matrix-and-codecov-on-merge-to-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index 4db7a40e..eeffb3e9 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -1,4 +1,4 @@ -name: Codecov and matrix +name: CI on: push: From a995a612bfb974a93fb6a9cab836d9ae4d7aa4d8 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 16 Sep 2024 20:33:07 +0000 Subject: [PATCH 30/85] Update CHANGELOG.rst --- CHANGELOG.rst | 9 +++++++++ news/recut.rst | 23 ----------------------- 2 files changed, 9 insertions(+), 23 deletions(-) delete mode 100644 news/recut.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a0750dae..d82ff15f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,15 @@ Release Notes .. current developments +3.4.1 +===== + +**Fixed:** + +* Updated package structure to new group standard + + + 3.4.0 ===== diff --git a/news/recut.rst b/news/recut.rst deleted file mode 100644 index c8c0a36a..00000000 --- a/news/recut.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Updated package structure to new group standard - -**Security:** - -* From 5a5aa0cb295718b35340d5a5a622b6e13584e1c9 Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Mon, 16 Sep 2024 22:05:16 -0400 Subject: [PATCH 31/85] add secrets inherit --- .github/workflows/matrix-and-codecov-on-merge-to-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index eeffb3e9..08ccaca2 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -17,3 +17,4 @@ jobs: project: diffpy.utils c_extension: false headless: false + secrets: inherit From 0c5f9c56063e06ca0d91ca3d33abeaef4bc6ad12 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 09:15:02 -0400 Subject: [PATCH 32/85] Add pytest-cov test test.txt dependencies --- requirements/test.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements/test.txt b/requirements/test.txt index 72644779..9966e09d 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -4,4 +4,5 @@ codecov coverage pytest-env pytest-mock +pytest-cov freezegun From 95dc0f54c79a85e5ca5e5f68a5e53401ab580300 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 18:32:23 -0400 Subject: [PATCH 33/85] Update and rename LICENSE.rst to LICENSE.txt --- LICENSE.rst | 30 ------------ LICENSE.txt | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 30 deletions(-) delete mode 100644 LICENSE.rst create mode 100644 LICENSE.txt diff --git a/LICENSE.rst b/LICENSE.rst deleted file mode 100644 index 95a04ac9..00000000 --- a/LICENSE.rst +++ /dev/null @@ -1,30 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2024, The Trustees of Columbia University -in the City of New York. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..f6d92af7 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,137 @@ +OPEN SOURCE LICENSE AGREEMENT +============================= + +Copyright (c) 2009-2011, University of Tennessee +Copyright (c) 1989, 1991 Free Software Foundation, Inc. +Copyright (c) 2006, The Regents of the University of California through + Lawrence Berkeley National Laboratory +Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") +Copyright (c) 2006-2007, Board of Trustees of Michigan State University +Copyright (c) 2008-2012, The Trustees of Columbia University in the City + of New York + +Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National + Laboratory + + +The "DiffPy-CMI" is distributed subject to the following license conditions: + + +SOFTWARE LICENSE AGREEMENT + + Software: DiffPy-CMI + + +(1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either +source code, or binary form and accompanying documentation). + +Part of the software was derived from the DANSE, ObjCryst++ (with permission), +PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of +which the original Copyrights are contained in each individual file. + +Each licensee is addressed as "you" or "Licensee." + + +(2) The copyright holders shown above and their third-party Licensors hereby +grant licensee a royalty-free nonexclusive license, subject to the limitations +stated herein and U.S. Government license rights. + + +(3) You may modify and make a copy or copies of the software for use within +your organization, if you meet the following conditions: + + (a) Copies in source code must include the copyright notice and this + software license agreement. + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy. + + +(4) You may modify a copy or copies of the Software or any portion of it, thus +forming a work based on the Software, and distribute copies of such work +outside your organization, if you meet all of the following conditions: + + (a) Copies in source code must include the copyright notice and this + Software License Agreement; + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy; + + (c) Modified copies and works based on the Software must carry prominent + notices stating that you changed specified portions of the Software. + + (d) Neither the name of Brookhaven Science Associates or Brookhaven + National Laboratory nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + written permission. + + +(5) Portions of the Software resulted from work developed under a U.S. +Government contract and are subject to the following license: +The Government is granted for itself and others acting on its behalf a +paid-up, nonexclusive, irrevocable worldwide license in this computer software +to reproduce, prepare derivative works, and perform publicly and display +publicly. + + +(6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT +WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY +LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND +THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL +LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF +THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE +PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION +UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. + + +(7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR +THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF +ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, +CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING +BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, +WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING +NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS +BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. + + +Brookhaven National Laboratory Notice +===================================== + +Acknowledgment of sponsorship +----------------------------- + +This software was produced by the Brookhaven National Laboratory, under +Contract DE-AC02-98CH10886 with the Department of Energy. + + +Government disclaimer of liability +---------------------------------- + +Neither the United States nor the United States Department of Energy, nor +any of their employees, makes any warranty, express or implied, or assumes +any legal liability or responsibility for the accuracy, completeness, or +usefulness of any data, apparatus, product, or process disclosed, or +represents that its use would not infringe privately owned rights. + + +Brookhaven disclaimer of liability +---------------------------------- + +Brookhaven National Laboratory makes no representations or warranties, +express or implied, nor assumes any liability for the use of this software. + + +Maintenance of notice +--------------------- + +In the interest of clarity regarding the origin and status of this +software, Brookhaven National Laboratory requests that any recipient of it +maintain this notice affixed to any distribution by the recipient that +contains a copy or derivative of this software. + + +END OF LICENSE From 4c30cc9378ab02f90cc79277c5a4c949103e0b2a Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 18:33:15 -0400 Subject: [PATCH 34/85] Create LICENSE_DANSE.txt --- LICENSE_DANSE.txt | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 LICENSE_DANSE.txt diff --git a/LICENSE_DANSE.txt b/LICENSE_DANSE.txt new file mode 100644 index 00000000..b7e1c702 --- /dev/null +++ b/LICENSE_DANSE.txt @@ -0,0 +1,41 @@ +This program is part of the DiffPy and DANSE open-source projects +and is available subject to the conditions and terms laid out below. + +Copyright 2006-2007, Board of Trustees of Michigan State University, +Copyright 2008-2012, The Trustees of Columbia University in the +city of New York. (Copyright holder indicated in each source file). + +For more information please visit the project web-page: + http://www.diffpy.org/ +or email Prof. Simon Billinge at sb2896@columbia.edu + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS". COPYRIGHT HOLDER +EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EITHER +EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS, ADEQUACY OR SUITABILITY +FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES OF FREEDOM FROM +INFRINGEMENT OF ANY DOMESTIC OR FOREIGN PATENT, COPYRIGHTS, TRADE +SECRETS OR OTHER PROPRIETARY RIGHTS OF ANY PARTY. IN NO EVENT SHALL +COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE OR RELATING TO THIS AGREEMENT, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. From 2003404c2b37835dd8eb268cec9d14b63b0686ed Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 18:40:49 -0400 Subject: [PATCH 35/85] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4337830d..c6fa2c33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', + 'License :: Other/Proprietary License', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', From d7ea35d260cb91232e12958c0995a6fa891b8169 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 18:46:07 -0400 Subject: [PATCH 36/85] Create cookie.rst news for 3.4.2 --- news/cookie.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/cookie.rst diff --git a/news/cookie.rst b/news/cookie.rst new file mode 100644 index 00000000..c8c0a36a --- /dev/null +++ b/news/cookie.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Updated package structure to new group standard + +**Security:** + +* From 053a22d828c0c673b83cce912b304c0725543ad8 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 18:54:33 -0400 Subject: [PATCH 37/85] Remove CHANGELOG 3.4.1 content --- CHANGELOG.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d82ff15f..481d6038 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,14 +4,6 @@ Release Notes .. current developments -3.4.1 -===== - -**Fixed:** - -* Updated package structure to new group standard - - 3.4.0 ===== From a20ee875260410c1ff9414da7ec63c2287d67c3a Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 18:57:24 -0400 Subject: [PATCH 38/85] Delete LICENSE.txt --- LICENSE.txt | 137 ---------------------------------------------------- 1 file changed, 137 deletions(-) delete mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index f6d92af7..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,137 +0,0 @@ -OPEN SOURCE LICENSE AGREEMENT -============================= - -Copyright (c) 2009-2011, University of Tennessee -Copyright (c) 1989, 1991 Free Software Foundation, Inc. -Copyright (c) 2006, The Regents of the University of California through - Lawrence Berkeley National Laboratory -Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") -Copyright (c) 2006-2007, Board of Trustees of Michigan State University -Copyright (c) 2008-2012, The Trustees of Columbia University in the City - of New York - -Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National - Laboratory - - -The "DiffPy-CMI" is distributed subject to the following license conditions: - - -SOFTWARE LICENSE AGREEMENT - - Software: DiffPy-CMI - - -(1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either -source code, or binary form and accompanying documentation). - -Part of the software was derived from the DANSE, ObjCryst++ (with permission), -PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of -which the original Copyrights are contained in each individual file. - -Each licensee is addressed as "you" or "Licensee." - - -(2) The copyright holders shown above and their third-party Licensors hereby -grant licensee a royalty-free nonexclusive license, subject to the limitations -stated herein and U.S. Government license rights. - - -(3) You may modify and make a copy or copies of the software for use within -your organization, if you meet the following conditions: - - (a) Copies in source code must include the copyright notice and this - software license agreement. - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy. - - -(4) You may modify a copy or copies of the Software or any portion of it, thus -forming a work based on the Software, and distribute copies of such work -outside your organization, if you meet all of the following conditions: - - (a) Copies in source code must include the copyright notice and this - Software License Agreement; - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy; - - (c) Modified copies and works based on the Software must carry prominent - notices stating that you changed specified portions of the Software. - - (d) Neither the name of Brookhaven Science Associates or Brookhaven - National Laboratory nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - written permission. - - -(5) Portions of the Software resulted from work developed under a U.S. -Government contract and are subject to the following license: -The Government is granted for itself and others acting on its behalf a -paid-up, nonexclusive, irrevocable worldwide license in this computer software -to reproduce, prepare derivative works, and perform publicly and display -publicly. - - -(6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT -WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY -LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND -THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL -LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF -THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE -PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION -UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. - - -(7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR -THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF -ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, -CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING -BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, -WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING -NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS -BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. - - -Brookhaven National Laboratory Notice -===================================== - -Acknowledgment of sponsorship ------------------------------ - -This software was produced by the Brookhaven National Laboratory, under -Contract DE-AC02-98CH10886 with the Department of Energy. - - -Government disclaimer of liability ----------------------------------- - -Neither the United States nor the United States Department of Energy, nor -any of their employees, makes any warranty, express or implied, or assumes -any legal liability or responsibility for the accuracy, completeness, or -usefulness of any data, apparatus, product, or process disclosed, or -represents that its use would not infringe privately owned rights. - - -Brookhaven disclaimer of liability ----------------------------------- - -Brookhaven National Laboratory makes no representations or warranties, -express or implied, nor assumes any liability for the use of this software. - - -Maintenance of notice ---------------------- - -In the interest of clarity regarding the origin and status of this -software, Brookhaven National Laboratory requests that any recipient of it -maintain this notice affixed to any distribution by the recipient that -contains a copy or derivative of this software. - - -END OF LICENSE From 291a1bfea0d6af49c4dd666694fcaf27ae53e20c Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 19:12:08 -0400 Subject: [PATCH 39/85] Add LICENSE.rst --- LICENSE.rst | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 LICENSE.rst diff --git a/LICENSE.rst b/LICENSE.rst new file mode 100644 index 00000000..ee734192 --- /dev/null +++ b/LICENSE.rst @@ -0,0 +1,141 @@ +OPEN SOURCE LICENSE AGREEMENT +============================= + +Copyright (c) 1989, 1991 Free Software Foundation, Inc. + +Copyright (c) 2006, The Regents of the University of California through Lawrence Berkeley National Laboratory + +Copyright (c) 2006-2007, Board of Trustees of Michigan State University + +Copyright (c) 2008-2012, The Trustees of Columbia University in the City of New York + +Copyright (c) 2009-2011, University of Tennessee + +Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") + +Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory + +Copyright (c) 2019-2024, The Trustees of Columbia University in the City of New York. +All rights reserved. + +The "DiffPy-CMI" is distributed subject to the following license conditions: + +.. code-block:: text + + SOFTWARE LICENSE AGREEMENT + + Software: DiffPy-CMI + + + (1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either + source code, or binary form and accompanying documentation). + + Part of the software was derived from the DANSE, ObjCryst++ (with permission), + PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of + which the original Copyrights are contained in each individual file. + + Each licensee is addressed as "you" or "Licensee." + + + (2) The copyright holders shown above and their third-party Licensors hereby + grant licensee a royalty-free nonexclusive license, subject to the limitations + stated herein and U.S. Government license rights. + + + (3) You may modify and make a copy or copies of the software for use within + your organization, if you meet the following conditions: + + (a) Copies in source code must include the copyright notice and this + software license agreement. + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy. + + + (4) You may modify a copy or copies of the Software or any portion of it, thus + forming a work based on the Software, and distribute copies of such work + outside your organization, if you meet all of the following conditions: + + (a) Copies in source code must include the copyright notice and this + Software License Agreement; + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy; + + (c) Modified copies and works based on the Software must carry prominent + notices stating that you changed specified portions of the Software. + + (d) Neither the name of Brookhaven Science Associates or Brookhaven + National Laboratory nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + written permission. + + + (5) Portions of the Software resulted from work developed under a U.S. + Government contract and are subject to the following license: + The Government is granted for itself and others acting on its behalf a + paid-up, nonexclusive, irrevocable worldwide license in this computer software + to reproduce, prepare derivative works, and perform publicly and display + publicly. + + + (6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT + WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY + LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND + THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL + LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF + THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE + PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION + UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. + + + (7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR + THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF + ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, + CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING + BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, + WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING + NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS + BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. + + +Brookhaven National Laboratory Notice +===================================== + +Acknowledgment of sponsorship +----------------------------- + +This software was produced by the Brookhaven National Laboratory, under +Contract DE-AC02-98CH10886 with the Department of Energy. + + +Government disclaimer of liability +---------------------------------- + +Neither the United States nor the United States Department of Energy, nor +any of their employees, makes any warranty, express or implied, or assumes +any legal liability or responsibility for the accuracy, completeness, or +usefulness of any data, apparatus, product, or process disclosed, or +represents that its use would not infringe privately owned rights. + + +Brookhaven disclaimer of liability +---------------------------------- + +Brookhaven National Laboratory makes no representations or warranties, +express or implied, nor assumes any liability for the use of this software. + + +Maintenance of notice +--------------------- + +In the interest of clarity regarding the origin and status of this +software, Brookhaven National Laboratory requests that any recipient of it +maintain this notice affixed to any distribution by the recipient that +contains a copy or derivative of this software. + +END OF LICENSE From 1195065cc52ec12e434aa834f62f20bddb809b3a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 23:12:15 +0000 Subject: [PATCH 40/85] [pre-commit.ci] auto fixes from pre-commit hooks --- LICENSE.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.rst b/LICENSE.rst index ee734192..d042ca2c 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -15,7 +15,7 @@ Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory -Copyright (c) 2019-2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 2019-2024, The Trustees of Columbia University in the City of New York. All rights reserved. The "DiffPy-CMI" is distributed subject to the following license conditions: From 05a73a00f3412157d6009deadcfd8efb4295de07 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 19:18:32 -0400 Subject: [PATCH 41/85] Update pyproject.toml to free to use but with restrictions --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c6fa2c33..c1e0f861 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', - 'License :: Other/Proprietary License', + 'License :: Free To Use But Restricted', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', From c0ffe30876f8702faa1acdeff0457013224df89c Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 20:26:44 -0400 Subject: [PATCH 42/85] Empty build.txt file which is used for C++/C --- requirements/build.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements/build.txt b/requirements/build.txt index f72d870d..e69de29b 100644 --- a/requirements/build.txt +++ b/requirements/build.txt @@ -1,2 +0,0 @@ -python -setuptools From 3e8dd2348b73887f6604befdeecd9c46ca1ee20b Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 20:32:27 -0400 Subject: [PATCH 43/85] Fix arb value to fix warning --- tests/test_diffraction_objects.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index fa613a53..a410f313 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -236,18 +236,20 @@ def test_dump(tmp_path, mocker): directory = Path(tmp_path) file = directory / "testfile" test = Diffraction_object() - test.wavelength = 1.54 + test.wavelength = 1.01 test.name = "test" test.scat_quantity = "x-ray" test.insert_scattering_quantity( x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} ) + + with mocker.patch("importlib.metadata.version", return_value="3.3.0"), freeze_time("2012-01-14"): test.dump(file, "q") with open(file, "r") as f: actual = f.read() expected = ( - "[Diffraction_object]\nname = test\nwavelength = 1.54\nscat_quantity = x-ray\nthing1 = 1\n" + "[Diffraction_object]\nname = test\nwavelength = 1.01\nscat_quantity = x-ray\nthing1 = 1\n" "thing2 = thing2\npackage_info = {'package2': '3.4.5', 'diffpy.utils': '3.3.0'}\n" "creation_time = 2012-01-14 00:00:00\n\n" "#### start data\n0.000000000000000000e+00 0.000000000000000000e+00\n" @@ -262,4 +264,5 @@ def test_dump(tmp_path, mocker): "9.000000000000000000e+00 9.000000000000000000e+00\n" "1.000000000000000000e+01 1.000000000000000000e+01\n" ) + assert actual == expected From b62fddb46ce88d11814a78e9bb75a022ca8ece52 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 20:42:18 -0400 Subject: [PATCH 44/85] Remove patch warning --- tests/test_diffraction_objects.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index a410f313..21b6c66e 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -243,9 +243,10 @@ def test_dump(tmp_path, mocker): x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} ) - - with mocker.patch("importlib.metadata.version", return_value="3.3.0"), freeze_time("2012-01-14"): + mocker.patch("importlib.metadata.version", return_value="3.3.0") + with freeze_time("2012-01-14"): test.dump(file, "q") + with open(file, "r") as f: actual = f.read() expected = ( From 6e2ed38c9f8e3e760fbaf5957dfddbd3027e95ec Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 20:43:51 -0400 Subject: [PATCH 45/85] Add news --- news/warning.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/warning.rst diff --git a/news/warning.rst b/news/warning.rst new file mode 100644 index 00000000..45768802 --- /dev/null +++ b/news/warning.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Two Pytest warnings due to numpy and pytest mocker in test_dump function + +**Security:** + +* From 9908bea2fbdda5f123af8a1085e2f75e60287b3f Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 17 Sep 2024 21:29:23 -0400 Subject: [PATCH 46/85] adding doc link to readme --- README.rst | 5 +++++ news/doclink.rst | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 news/doclink.rst diff --git a/README.rst b/README.rst index 38916e22..a55090af 100644 --- a/README.rst +++ b/README.rst @@ -53,6 +53,11 @@ If you use diffpy.utils in a scientific publication, we would like you to cite t diffpy.utils Package, https://github.com/diffpy/diffpy.utils +Documentation +------------- + +Documentation may be found at, https://diffy.github.io/diffpy.utils + Installation ------------ diff --git a/news/doclink.rst b/news/doclink.rst new file mode 100644 index 00000000..cfd86dc6 --- /dev/null +++ b/news/doclink.rst @@ -0,0 +1,23 @@ +**Added:** + +* link docs in the README + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 7bd6f8ddb94f6e7517e68810e13c464efa492af5 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 17 Sep 2024 21:33:59 -0400 Subject: [PATCH 47/85] fix typo in url --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index a55090af..99ef5d5c 100644 --- a/README.rst +++ b/README.rst @@ -56,7 +56,7 @@ If you use diffpy.utils in a scientific publication, we would like you to cite t Documentation ------------- -Documentation may be found at, https://diffy.github.io/diffpy.utils +Documentation may be found at, https://diffpy.github.io/diffpy.utils Installation ------------ From 6696c5c20c7981322267129c3c6bc132ad9bcf56 Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Tue, 17 Sep 2024 21:43:26 -0400 Subject: [PATCH 48/85] explicitly pass codecov secrets --- .github/workflows/matrix-and-codecov-on-merge-to-main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index 08ccaca2..2df748dc 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -17,4 +17,5 @@ jobs: project: diffpy.utils c_extension: false headless: false - secrets: inherit + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 12935f84317ec0fed6f4a95d7e226ac2172cabe2 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 17 Sep 2024 22:00:19 -0400 Subject: [PATCH 49/85] trim trailing whitespace --- .github/workflows/matrix-and-codecov-on-merge-to-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index 2df748dc..99a3c623 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -17,5 +17,5 @@ jobs: project: diffpy.utils c_extension: false headless: false - secrets: + secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From bc1a7821d2b10abbcd8147293e0301a93a9cc9b9 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 17 Sep 2024 22:12:37 -0400 Subject: [PATCH 50/85] remove mention of installing dependencies from readme --- README.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 99ef5d5c..629dec94 100644 --- a/README.rst +++ b/README.rst @@ -81,11 +81,7 @@ Then, to fully install ``diffpy.utils`` in our active environment, run :: Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -To install using ``pip`` into your ``diffpy.utils_env`` environment, we will also have to install dependencies :: - - pip install -r https://raw.githubusercontent.com/diffpy/diffpy.utils/main/requirements/run.txt - -and then install the package :: +To install using ``pip`` into your ``diffpy.utils_env`` environment type :: pip install diffpy.utils From eb131ec098ff0a80bef3abb9120374741168405e Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 17 Sep 2024 22:15:22 -0400 Subject: [PATCH 51/85] news --- news/install.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/install.rst diff --git a/news/install.rst b/news/install.rst new file mode 100644 index 00000000..816dd79d --- /dev/null +++ b/news/install.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* removed need to install requirements separately when pip installing. + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 20751c8b2cf945833f64855172dd39438890d8d3 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Wed, 18 Sep 2024 02:23:11 +0000 Subject: [PATCH 52/85] Update CHANGELOG.rst --- CHANGELOG.rst | 17 +++++++++++++++++ news/cookie.rst | 23 ----------------------- news/doclink.rst | 23 ----------------------- news/install.rst | 23 ----------------------- 4 files changed, 17 insertions(+), 69 deletions(-) delete mode 100644 news/cookie.rst delete mode 100644 news/doclink.rst delete mode 100644 news/install.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 481d6038..b57c7e79 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,23 @@ Release Notes .. current developments +3.4.2 +===== + +**Added:** + +* link docs in the README + +**Changed:** + +* removed need to install requirements separately when pip installing. + +**Fixed:** + +* Updated package structure to new group standard + + + 3.4.0 ===== diff --git a/news/cookie.rst b/news/cookie.rst deleted file mode 100644 index c8c0a36a..00000000 --- a/news/cookie.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Updated package structure to new group standard - -**Security:** - -* diff --git a/news/doclink.rst b/news/doclink.rst deleted file mode 100644 index cfd86dc6..00000000 --- a/news/doclink.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* link docs in the README - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/install.rst b/news/install.rst deleted file mode 100644 index 816dd79d..00000000 --- a/news/install.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* removed need to install requirements separately when pip installing. - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* From 5f2d56ce91ccd1ea963130a96bd4f3dca4e5e1ed Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 17 Sep 2024 22:35:55 -0400 Subject: [PATCH 53/85] added mention of DO's in README --- README.rst | 7 ++++--- news/sos.rst | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 news/sos.rst diff --git a/README.rst b/README.rst index 629dec94..8045f840 100644 --- a/README.rst +++ b/README.rst @@ -41,10 +41,11 @@ diffpy.utils Package General purpose shared utilities for the diffpy libraries. The diffpy.utils package provides functions for extracting array data from -variously formatted text files and wx GUI utilities used by the PDFgui -program. The package also includes an interpolation function based on the +variously formatted text files, an interpolation function based on the Whittaker-Shannon formula that can be used to resample a PDF or other profile -function over a new grid. +function over a new grid, `Diffraction_objects` for conveniently manipulating +diffraction data, and some wx GUI utilities used by the PDFgui +program. Citation -------- diff --git a/news/sos.rst b/news/sos.rst new file mode 100644 index 00000000..b5a35246 --- /dev/null +++ b/news/sos.rst @@ -0,0 +1,23 @@ +**Added:** + +* Diffraction_objects mentioned in the README + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From b6d1ffe3231a2eb474e4e6be8a35893a4a93b2c1 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 17 Sep 2024 22:48:23 -0400 Subject: [PATCH 54/85] Fix contributors typo --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index cdb35e24..d115a8aa 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,7 +1,7 @@ Authors ======= -Billinge Group and community contibutors. +Billinge Group and community contributors. Contributors ------------ From de82a7705e207a16e90639abe75e21adf172676d Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 19 Sep 2024 07:16:27 -0400 Subject: [PATCH 55/85] Clean up tests for catching error --- tests/test_diffraction_objects.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index 8958c17f..aa99326a 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -241,21 +241,28 @@ def test_dump(tmp_path, mocker): test.name = "test" test.scat_quantity = "x-ray" - # Capture warnings due to invalid arcsin input value due to the wavelenght being 1.54 + # Setup the testing environment to capture warnings triggered by an invalid arcsin input with warnings.catch_warnings(record=True) as captured_warnings: + # Configure the warnings system to capture all warnings warnings.simplefilter("always") + + # Perform the method call that is expected to trigger the RuntimeWarning due to the specified wavelength test.insert_scattering_quantity( x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} ) - # Assert that a RuntimeWarning was raised + # Verify that at least one RuntimeWarning is raised due to the arcsin domain error from wavelength 1.54 assert any( isinstance(w.message, RuntimeWarning) for w in captured_warnings - ), "Expected a RuntimeWarning due to invalid arcsin input value from the wavelenght set to 1.54" - # Expect only one warning message produced - assert len(captured_warnings) == 1 + ), "Expected a RuntimeWarning due to invalid arcsin input value from the wavelength set to 1.54" + + # Ensure that exactly one warning was captured to confirm that no additional unexpected warnings are raised + assert len(captured_warnings) == 1, "Expected exactly one warning to be captured" + + # Patch the version lookup to control the external dependency in the test environment mocker.patch("importlib.metadata.version", return_value="3.3.0") + with freeze_time("2012-01-14"): test.dump(file, "q") From d65aa57402cb4114c896e50d835b3497cc875756 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:16:37 +0000 Subject: [PATCH 56/85] [pre-commit.ci] auto fixes from pre-commit hooks --- tests/test_diffraction_objects.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index aa99326a..7a32b3bf 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -262,7 +262,6 @@ def test_dump(tmp_path, mocker): # Patch the version lookup to control the external dependency in the test environment mocker.patch("importlib.metadata.version", return_value="3.3.0") - with freeze_time("2012-01-14"): test.dump(file, "q") From b9b05a505f06f00ee12638cc4b5fb6ae974ef371 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 19 Sep 2024 07:18:51 -0400 Subject: [PATCH 57/85] Shorten comments for test_diffraction_objects --- tests/test_diffraction_objects.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index 7a32b3bf..9e3abe3e 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -241,7 +241,6 @@ def test_dump(tmp_path, mocker): test.name = "test" test.scat_quantity = "x-ray" - # Setup the testing environment to capture warnings triggered by an invalid arcsin input with warnings.catch_warnings(record=True) as captured_warnings: # Configure the warnings system to capture all warnings warnings.simplefilter("always") @@ -251,15 +250,14 @@ def test_dump(tmp_path, mocker): x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} ) - # Verify that at least one RuntimeWarning is raised due to the arcsin domain error from wavelength 1.54 + # Verify that at least one RuntimeWarning is raised due to the arcsin error from wavelength 1.54 assert any( isinstance(w.message, RuntimeWarning) for w in captured_warnings ), "Expected a RuntimeWarning due to invalid arcsin input value from the wavelength set to 1.54" - # Ensure that exactly one warning was captured to confirm that no additional unexpected warnings are raised + # Ensure that exactly one warning was captured assert len(captured_warnings) == 1, "Expected exactly one warning to be captured" - # Patch the version lookup to control the external dependency in the test environment mocker.patch("importlib.metadata.version", return_value="3.3.0") with freeze_time("2012-01-14"): From 8038e9dcd2a9678c1e0208243a90416869198646 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 21 Sep 2024 13:14:04 -0400 Subject: [PATCH 58/85] Update setuptools-git-versioning >= 2.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c1e0f861..655b5047 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] +requires = ["setuptools>=62.0", "setuptools-git-versioning>=2.0"] build-backend = "setuptools.build_meta" [project] From 20d54ab94edebb5f644e3332b0135302d7bf12ee Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 21 Sep 2024 13:18:14 -0400 Subject: [PATCH 59/85] Create git-version.rst --- news/git-version.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/git-version.rst diff --git a/news/git-version.rst b/news/git-version.rst new file mode 100644 index 00000000..7b4e85bf --- /dev/null +++ b/news/git-version.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* setuptools-git-versioning from <2.0 to >= 2.0 in pyproject.toml + +**Security:** + +* From 53480fa1d826844ae00f692bb62e34385f2a5f99 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 30 Sep 2024 21:08:18 -0400 Subject: [PATCH 60/85] Add citation to readme --- README.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 8045f840..777f01bf 100644 --- a/README.rst +++ b/README.rst @@ -50,9 +50,16 @@ program. Citation -------- -If you use diffpy.utils in a scientific publication, we would like you to cite this package as - - diffpy.utils Package, https://github.com/diffpy/diffpy.utils +If you use this program for a scientific research that leads +to publication, we ask that you acknowledge use of the program +by citing the following paper in your publication: + + P. Juhás, C. L. Farrow, X. Yang, K. R. Knox and S. J. L. Billinge, + `Complex modeling: a strategy and software program for combining + multiple information sources to solve ill posed structure and + nanostructure inverse problems + `__, + *Acta Crystallogr. A* **71**, 562-568 (2015). Documentation ------------- From ccad4656dbbbf9307c81e0f6b4c1d209f6a958cf Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Fri, 4 Oct 2024 11:29:25 -0400 Subject: [PATCH 61/85] Add pip packages under pip.txt --- news/pip.rst | 23 +++++++++++++++++++++++ pyproject.toml | 2 +- requirements/{run.txt => conda.txt} | 0 requirements/pip.txt | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 news/pip.rst rename requirements/{run.txt => conda.txt} (100%) diff --git a/news/pip.rst b/news/pip.rst new file mode 100644 index 00000000..d10e3b6d --- /dev/null +++ b/news/pip.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Add pip dependencies under pip.txt and conda dependencies under conda.txt + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 655b5047..421f8886 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) [tool.setuptools.dynamic] -dependencies = {file = ["requirements/run.txt"]} +dependencies = {file = ["requirements/pip.txt"]} [tool.black] line-length = 115 diff --git a/requirements/run.txt b/requirements/conda.txt similarity index 100% rename from requirements/run.txt rename to requirements/conda.txt diff --git a/requirements/pip.txt b/requirements/pip.txt index e69de29b..24ce15ab 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -0,0 +1 @@ +numpy From 3aec5a3f1baf9e0d218f6d6970b5fc45b466325d Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:34:45 -0400 Subject: [PATCH 62/85] Update README --- README.rst | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 777f01bf..f0476d94 100644 --- a/README.rst +++ b/README.rst @@ -80,16 +80,18 @@ To add "conda-forge" to the conda channels, run the following in a terminal. :: We want to install our packages in a suitable conda environment. The following creates and activates a new environment named ``diffpy.utils_env`` :: - conda create -n diffpy.utils_env python=3 + conda create -n diffpy.utils_env diffpy.utils conda activate diffpy.utils_env -Then, to fully install ``diffpy.utils`` in our active environment, run :: +To confirm that the installation was successful, type :: - conda install diffpy.utils + python -c "import diffpy.utils; print(diffpy.utils.__version__)" -Another option is to use ``pip`` to download and install the latest release from +The output should print the latest version displayed on the badges above. + +If the above does not work, you can use ``pip`` to download and install the latest release from `Python Package Index `_. -To install using ``pip`` into your ``diffpy.utils_env`` environment type :: +To install using ``pip`` into your ``diffpy.utils_env`` environment, type :: pip install diffpy.utils @@ -99,12 +101,17 @@ and run the following :: pip install . +Getting Started +--------------- + +You may consult our `online documentation `_ for tutorials and API references. + Support and Contribute ---------------------- `Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.utils. Please join the diffpy.utils users community by joining the Google group. The diffpy.utils project welcomes your expertise and enthusiasm! -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. Feel free to fork the project and contribute. To install diffpy.utils in a development mode, with its sources being directly used by Python From 2fdf24d4a2742f1e1c744057879feaf3d2b69ab5 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:36:54 -0400 Subject: [PATCH 63/85] Add .github/ISSUE_TEMPLATE --- .github/ISSUE_TEMPLATE/bug_feature.md | 16 +++++++++++++++ .github/ISSUE_TEMPLATE/release_checklist.md | 22 +++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_feature.md create mode 100644 .github/ISSUE_TEMPLATE/release_checklist.md diff --git a/.github/ISSUE_TEMPLATE/bug_feature.md b/.github/ISSUE_TEMPLATE/bug_feature.md new file mode 100644 index 00000000..b3454deb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_feature.md @@ -0,0 +1,16 @@ +--- +name: Bug Report or Feature Request +about: Report a bug or suggest a new feature! +title: "" +labels: "" +assignees: "" +--- + +### Problem + + + +### Proposed solution diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md new file mode 100644 index 00000000..a87a44a8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -0,0 +1,22 @@ +--- +name: Release +about: Checklist and communication channel for PyPI and GitHub release +title: "Ready for PyPI/GitHub release" +labels: "release" +assignees: "" +--- + +### Release checklist for GitHub contributors + +- [ ] All PRs/issues attached to the release are merged. +- [ ] All the badges on the README are passing. +- [ ] License information is verified as correct. If you are unsure, please comment below. +- [ ] Locally rendered documentation contains all appropriate pages, including API references (check no modules are + missing), tutorials, and other human written text is up-to-date with any changes in the code. +- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) are updated and + tested +- [ ] Successfully run any tutorial examples or do functional testing in some other way. +- [ ] Grammar and writing quality have been checked (no typos). + +Please mention @sbillinge when you are ready for release. Include any additional comments necessary, such as +version information and details about the pre-release. From b2bad3606dc53c548c49f362b8319703fd180701 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:38:04 -0400 Subject: [PATCH 64/85] Add build-wheel-release-upload.yml --- .github/workflows/build-wheel-release-upload.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/build-wheel-release-upload.yml diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml new file mode 100644 index 00000000..9ea21782 --- /dev/null +++ b/.github/workflows/build-wheel-release-upload.yml @@ -0,0 +1,16 @@ +name: Release (GitHub/PyPI) + +on: + workflow_dispatch: + push: + tags: + - '*' # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml + +jobs: + release: + uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0 + with: + project: diffpy.utils + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + PAT_TOKEN: ${{ secrets.PAT_TOKEN }} From d04a029e30d67fccd8ead4aa6996bb83584a490e Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:39:10 -0400 Subject: [PATCH 65/85] Add example_package.rst in api --- .../api/diffpy.utils.example_package.rst | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 doc/source/api/diffpy.utils.example_package.rst diff --git a/doc/source/api/diffpy.utils.example_package.rst b/doc/source/api/diffpy.utils.example_package.rst new file mode 100644 index 00000000..40388ba1 --- /dev/null +++ b/doc/source/api/diffpy.utils.example_package.rst @@ -0,0 +1,31 @@ +.. _example_package documentation: + +|title| +======= + +.. |title| replace:: diffpy.utils.example_package package + +.. automodule:: diffpy.utils.example_package + :members: + :undoc-members: + :show-inheritance: + +|foo| +----- + +.. |foo| replace:: diffpy.utils.example_package.foo module + +.. automodule:: diffpy.utils.example_package.foo + :members: + :undoc-members: + :show-inheritance: + +|bar| +----- + +.. |bar| replace:: diffpy.utils.example_package.bar module + +.. automodule:: diffpy.utils.example_package.foo + :members: + :undoc-members: + :show-inheritance: From 27b57378f90ebdadc9761dab9de516a8053cf27c Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:39:35 -0400 Subject: [PATCH 66/85] Add README for requirements --- requirements/README.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 requirements/README.txt diff --git a/requirements/README.txt b/requirements/README.txt new file mode 100644 index 00000000..3740a138 --- /dev/null +++ b/requirements/README.txt @@ -0,0 +1,10 @@ +# YOU MAY DELETE THIS FILE AFTER SETTING UP DEPENDENCIES! +# +# This directory is where you should place your project dependencies. +# build.txt should list all Conda packages required for building the package in GitHub CI, including those specified in the build section of meta.yaml (conda-recipe). +# conda.txt should list all Conda packages required (including optional) for running the package in GitHub CI, as well as those specified in the run section of meta.yaml (conda-recipe). +# pip.txt should list all PyPI packages (including optional) required to install the package via `pip install `. +# test.txt should list all Conda/PyPI packages required for the testing suite to ensure all tests pass. +# docs.txt should list all Conda/PyPI packages required for building the package documentation page. +# +# YOU MAY DELETE THIS FILE AFTER SETTING UP DEPENDENCIES! From c241c9c33997ef5bd0bd4a1b19ea3222dc462cc7 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:39:54 -0400 Subject: [PATCH 67/85] Add test_version.py --- tests/test_version.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/test_version.py diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 00000000..421a96e4 --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,10 @@ +"""Unit tests for __version__.py +""" + +import diffpy.utils + + +def test_package_version(): + """Ensure the package version is defined and not set to the initial placeholder.""" + assert hasattr(diffpy.utils, "__version__") + assert diffpy.utils.__version__ != "0.0.0" From 54170fef7d62730ae70a29629e43499001544c67 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:41:33 -0400 Subject: [PATCH 68/85] Add news for recut --- news/recut.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/recut.rst diff --git a/news/recut.rst b/news/recut.rst new file mode 100644 index 00000000..70e17b5d --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Recut to group's package standard, fix installation, add GitHub release workflow + +**Security:** + +* From 3b67d83a618f13a2112f24d8432da6144bb61a25 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 12:43:39 -0400 Subject: [PATCH 69/85] Added newline to README --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f0476d94..5a2875d8 100644 --- a/README.rst +++ b/README.rst @@ -111,7 +111,7 @@ Support and Contribute `Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.utils. Please join the diffpy.utils users community by joining the Google group. The diffpy.utils project welcomes your expertise and enthusiasm! -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. Feel free to fork the project and contribute. To install diffpy.utils in a development mode, with its sources being directly used by Python @@ -140,3 +140,4 @@ Contact ------- For more information on diffpy.utils please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. + From a9fd906c1a0d0d3100aa6320f5d7eda76f3aee87 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 13:03:51 -0400 Subject: [PATCH 70/85] deleted README.txt --- requirements/README.txt | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 requirements/README.txt diff --git a/requirements/README.txt b/requirements/README.txt deleted file mode 100644 index 3740a138..00000000 --- a/requirements/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -# YOU MAY DELETE THIS FILE AFTER SETTING UP DEPENDENCIES! -# -# This directory is where you should place your project dependencies. -# build.txt should list all Conda packages required for building the package in GitHub CI, including those specified in the build section of meta.yaml (conda-recipe). -# conda.txt should list all Conda packages required (including optional) for running the package in GitHub CI, as well as those specified in the run section of meta.yaml (conda-recipe). -# pip.txt should list all PyPI packages (including optional) required to install the package via `pip install `. -# test.txt should list all Conda/PyPI packages required for the testing suite to ensure all tests pass. -# docs.txt should list all Conda/PyPI packages required for building the package documentation page. -# -# YOU MAY DELETE THIS FILE AFTER SETTING UP DEPENDENCIES! From 86813a5634cc1be90720cf19f947efd39eac7674 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 13:04:33 -0400 Subject: [PATCH 71/85] deleted new line --- README.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/README.rst b/README.rst index 5a2875d8..98e34649 100644 --- a/README.rst +++ b/README.rst @@ -140,4 +140,3 @@ Contact ------- For more information on diffpy.utils please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. - From ce8cdef672cb4e673657e7d6f1efceef05b63b57 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 23 Oct 2024 13:17:46 -0400 Subject: [PATCH 72/85] deleted example_package.rst in api --- .../api/diffpy.utils.example_package.rst | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 doc/source/api/diffpy.utils.example_package.rst diff --git a/doc/source/api/diffpy.utils.example_package.rst b/doc/source/api/diffpy.utils.example_package.rst deleted file mode 100644 index 40388ba1..00000000 --- a/doc/source/api/diffpy.utils.example_package.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _example_package documentation: - -|title| -======= - -.. |title| replace:: diffpy.utils.example_package package - -.. automodule:: diffpy.utils.example_package - :members: - :undoc-members: - :show-inheritance: - -|foo| ------ - -.. |foo| replace:: diffpy.utils.example_package.foo module - -.. automodule:: diffpy.utils.example_package.foo - :members: - :undoc-members: - :show-inheritance: - -|bar| ------ - -.. |bar| replace:: diffpy.utils.example_package.bar module - -.. automodule:: diffpy.utils.example_package.foo - :members: - :undoc-members: - :show-inheritance: From 31f3c03b25e01341fc351deede00f368b6de3276 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Fri, 25 Oct 2024 10:59:14 -0400 Subject: [PATCH 73/85] Setup requirements --- requirements/{run.txt => conda.txt} | 0 requirements/pip.txt | 1 + 2 files changed, 1 insertion(+) rename requirements/{run.txt => conda.txt} (100%) diff --git a/requirements/run.txt b/requirements/conda.txt similarity index 100% rename from requirements/run.txt rename to requirements/conda.txt diff --git a/requirements/pip.txt b/requirements/pip.txt index e69de29b..24ce15ab 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -0,0 +1 @@ +numpy From e69255afb24f01902f547bf3c38ef0bcb2b2a3cc Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Fri, 25 Oct 2024 10:59:39 -0400 Subject: [PATCH 74/85] Set valid q range for test dump function --- tests/test_diffraction_objects.py | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index 9e3abe3e..8798930b 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -233,31 +233,17 @@ def test_diffraction_objects_equality(inputs1, inputs2, expected): def test_dump(tmp_path, mocker): - x, y = np.linspace(0, 10, 11), np.linspace(0, 10, 11) + x, y = np.linspace(0, 5, 6), np.linspace(0, 5, 6) directory = Path(tmp_path) file = directory / "testfile" test = Diffraction_object() test.wavelength = 1.54 test.name = "test" test.scat_quantity = "x-ray" - - with warnings.catch_warnings(record=True) as captured_warnings: - # Configure the warnings system to capture all warnings - warnings.simplefilter("always") - - # Perform the method call that is expected to trigger the RuntimeWarning due to the specified wavelength - test.insert_scattering_quantity( + test.insert_scattering_quantity( x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} - ) - - # Verify that at least one RuntimeWarning is raised due to the arcsin error from wavelength 1.54 - assert any( - isinstance(w.message, RuntimeWarning) for w in captured_warnings - ), "Expected a RuntimeWarning due to invalid arcsin input value from the wavelength set to 1.54" - - # Ensure that exactly one warning was captured - assert len(captured_warnings) == 1, "Expected exactly one warning to be captured" - + ) + mocker.patch("importlib.metadata.version", return_value="3.3.0") with freeze_time("2012-01-14"): @@ -275,11 +261,6 @@ def test_dump(tmp_path, mocker): "3.000000000000000000e+00 3.000000000000000000e+00\n" "4.000000000000000000e+00 4.000000000000000000e+00\n" "5.000000000000000000e+00 5.000000000000000000e+00\n" - "6.000000000000000000e+00 6.000000000000000000e+00\n" - "7.000000000000000000e+00 7.000000000000000000e+00\n" - "8.000000000000000000e+00 8.000000000000000000e+00\n" - "9.000000000000000000e+00 9.000000000000000000e+00\n" - "1.000000000000000000e+01 1.000000000000000000e+01\n" ) assert actual == expected From 7b12bafda78914961df782289ec92d689f3f17f0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:01:46 +0000 Subject: [PATCH 75/85] [pre-commit.ci] auto fixes from pre-commit hooks --- tests/test_diffraction_objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index 8798930b..5658b9b1 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -241,9 +241,9 @@ def test_dump(tmp_path, mocker): test.name = "test" test.scat_quantity = "x-ray" test.insert_scattering_quantity( - x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} + x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} ) - + mocker.patch("importlib.metadata.version", return_value="3.3.0") with freeze_time("2012-01-14"): From 0cb34e28641b44ae21826fa79a6e09faccac3e05 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Fri, 25 Oct 2024 11:06:36 -0400 Subject: [PATCH 76/85] Pre-commit --- tests/test_diffraction_objects.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index 8798930b..b5581384 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -1,4 +1,3 @@ -import warnings from pathlib import Path import numpy as np From 859755e6b57c75a7b96bc3f750795fc7230e94d6 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Fri, 25 Oct 2024 11:07:08 -0400 Subject: [PATCH 77/85] Apply pre-commit --- tests/test_diffraction_objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_diffraction_objects.py b/tests/test_diffraction_objects.py index b5581384..a155b95e 100644 --- a/tests/test_diffraction_objects.py +++ b/tests/test_diffraction_objects.py @@ -240,9 +240,9 @@ def test_dump(tmp_path, mocker): test.name = "test" test.scat_quantity = "x-ray" test.insert_scattering_quantity( - x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} + x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}} ) - + mocker.patch("importlib.metadata.version", return_value="3.3.0") with freeze_time("2012-01-14"): From f17b979076b0769713b3601c1bd1e0139c3a8b17 Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Fri, 25 Oct 2024 15:38:47 -0400 Subject: [PATCH 78/85] update pyproject.toml for python 3.13 --- news/python313.rst | 23 +++++++++++++++++++++++ pyproject.toml | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 news/python313.rst diff --git a/news/python313.rst b/news/python313.rst new file mode 100644 index 00000000..4b34bb41 --- /dev/null +++ b/news/python313.rst @@ -0,0 +1,23 @@ +**Added:** + +* Support for Python 3.13 + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* Support for Python 3.10 + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 421f8886..41fe385a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ maintainers = [ description = "Shared utilities for diffpy packages" keywords = ['"text data parsers" "wx grid" "diffraction objects"'] readme = "README.rst" -requires-python = ">=3.10" +requires-python = ">=3.11, <3.14" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -25,9 +25,9 @@ classifiers = [ 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Operating System :: Unix', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Chemistry', ] From 4834db1ae0e6c9af00276db66fa4fd27aa2ee95d Mon Sep 17 00:00:00 2001 From: sbillinge Date: Sat, 26 Oct 2024 20:56:55 +0000 Subject: [PATCH 79/85] update changelog --- CHANGELOG.rst | 15 +++++++++++++++ news/git-version.rst | 23 ----------------------- news/pip.rst | 23 ----------------------- news/recut.rst | 23 ----------------------- news/sos.rst | 23 ----------------------- news/warning.rst | 23 ----------------------- 6 files changed, 15 insertions(+), 115 deletions(-) delete mode 100644 news/git-version.rst delete mode 100644 news/pip.rst delete mode 100644 news/recut.rst delete mode 100644 news/sos.rst delete mode 100644 news/warning.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b57c7e79..d574883f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,21 @@ Release Notes .. current developments +3.4.3 +===== + +**Added:** + +* Diffraction_objects mentioned in the README + +**Fixed:** + +* Recut to group's package standard, fix installation, add GitHub release workflow +* setuptools-git-versioning from <2.0 to >= 2.0 in pyproject.toml +* Two Pytest warnings due to numpy and pytest mocker in test_dump function +* Add pip dependencies under pip.txt and conda dependencies under conda.txt + + 3.4.2 ===== diff --git a/news/git-version.rst b/news/git-version.rst deleted file mode 100644 index 7b4e85bf..00000000 --- a/news/git-version.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* setuptools-git-versioning from <2.0 to >= 2.0 in pyproject.toml - -**Security:** - -* diff --git a/news/pip.rst b/news/pip.rst deleted file mode 100644 index d10e3b6d..00000000 --- a/news/pip.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Add pip dependencies under pip.txt and conda dependencies under conda.txt - -**Security:** - -* diff --git a/news/recut.rst b/news/recut.rst deleted file mode 100644 index 70e17b5d..00000000 --- a/news/recut.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Recut to group's package standard, fix installation, add GitHub release workflow - -**Security:** - -* diff --git a/news/sos.rst b/news/sos.rst deleted file mode 100644 index b5a35246..00000000 --- a/news/sos.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Diffraction_objects mentioned in the README - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/warning.rst b/news/warning.rst deleted file mode 100644 index 45768802..00000000 --- a/news/warning.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Two Pytest warnings due to numpy and pytest mocker in test_dump function - -**Security:** - -* From ebbb644a9d9bb4cccd2fdadbb4c7a56fe2dca972 Mon Sep 17 00:00:00 2001 From: sbillinge Date: Sun, 27 Oct 2024 00:32:12 +0000 Subject: [PATCH 80/85] update changelog --- CHANGELOG.rst | 12 ++++++++++++ news/python313.rst | 23 ----------------------- 2 files changed, 12 insertions(+), 23 deletions(-) delete mode 100644 news/python313.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d574883f..63320901 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,18 @@ Release Notes .. current developments +3.5.0 +===== + +**Added:** + +* Support for Python 3.13 + +**Removed:** + +* Support for Python 3.10 + + 3.4.3 ===== diff --git a/news/python313.rst b/news/python313.rst deleted file mode 100644 index 4b34bb41..00000000 --- a/news/python313.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Support for Python 3.13 - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* Support for Python 3.10 - -**Fixed:** - -* - -**Security:** - -* From f3cd7b4c4ca8963f698d20cd601b1b334f6328c6 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 26 Oct 2024 22:33:27 -0400 Subject: [PATCH 81/85] Add commas in keywords in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 41fe385a..a43118ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] description = "Shared utilities for diffpy packages" -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 = [ From 611d219f3402c0b0b26c51fca0a6b91bd32d6018 Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Mon, 4 Nov 2024 18:15:01 -0500 Subject: [PATCH 82/85] add xtype=d in dump function --- src/diffpy/utils/scattering_objects/diffraction_objects.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/diffpy/utils/scattering_objects/diffraction_objects.py b/src/diffpy/utils/scattering_objects/diffraction_objects.py index bd5b16db..94d2831a 100644 --- a/src/diffpy/utils/scattering_objects/diffraction_objects.py +++ b/src/diffpy/utils/scattering_objects/diffraction_objects.py @@ -445,6 +445,8 @@ def dump(self, filepath, xtype=None): data_to_save = np.column_stack((self.on_q[0], self.on_q[1])) elif xtype == "tth": data_to_save = np.column_stack((self.on_tth[0], self.on_tth[1])) + elif xtype == "d": + data_to_save = np.column_stack((self.on_d[0], self.on_d[1])) else: print(f"WARNING: cannot handle the xtype '{xtype}'") self.metadata.update(get_package_info("diffpy.utils", metadata=self.metadata)) From e5a6c381bce9b0ea4760834654bbc0434cfec7ce Mon Sep 17 00:00:00 2001 From: Alison Wu Date: Wed, 6 Nov 2024 10:26:57 -0500 Subject: [PATCH 83/85] configure codespell at pyproject.toml and pre-commit --- .codespell/ignore_lines.txt | 2 ++ .codespell/ignore_words.txt | 11 +++++++++++ .pre-commit-config.yaml | 6 ++++++ CHANGELOG.rst | 2 +- README.rst | 2 +- news/codespell.rst | 23 +++++++++++++++++++++++ pyproject.toml | 5 +++++ src/diffpy/utils/parsers/loaddata.py | 2 +- src/diffpy/utils/parsers/resample.py | 2 +- src/diffpy/utils/parsers/serialization.py | 2 +- 10 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 .codespell/ignore_lines.txt create mode 100644 .codespell/ignore_words.txt create mode 100644 news/codespell.rst diff --git a/.codespell/ignore_lines.txt b/.codespell/ignore_lines.txt new file mode 100644 index 00000000..07fa7c8c --- /dev/null +++ b/.codespell/ignore_lines.txt @@ -0,0 +1,2 @@ +;; Please include filenames and explanations for each ignored line. +;; See https://docs.openverse.org/meta/codespell.html for docs. diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt new file mode 100644 index 00000000..9757d7c0 --- /dev/null +++ b/.codespell/ignore_words.txt @@ -0,0 +1,11 @@ +;; Please include explanations for each ignored word (lowercase). +;; See https://docs.openverse.org/meta/codespell.html for docs. + +;; abbreviation for "materials" often used in a journal title +mater + +;; alternative use of socioeconomic +socio-economic + +;; Frobenius norm used in np.linalg.norm +fro diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3070e199..aee43d0e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,3 +44,9 @@ repos: name: Prevent Commit to Main Branch args: ["--branch", "main"] stages: [pre-commit] + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b57c7e79..ceed2511 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -90,7 +90,7 @@ v3.2.3 **Added:** -* Compatability with Python 3.12.0rc3, 3.11. +* Compatibility with Python 3.12.0rc3, 3.11. * CI Coverage. * New tests for loadData function. * loadData function now toggleable. Can return either (a) data read from data blocks or (b) header information stored diff --git a/README.rst b/README.rst index 98e34649..48967571 100644 --- a/README.rst +++ b/README.rst @@ -134,7 +134,7 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contribuing, please read our `Code of Conduct `_. +Before contributing, please read our `Code of Conduct `_. Contact ------- diff --git a/news/codespell.rst b/news/codespell.rst new file mode 100644 index 00000000..8c5ba6d2 --- /dev/null +++ b/news/codespell.rst @@ -0,0 +1,23 @@ +**Added:** + +* Spelling check via Codespell in pre-commit + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 421f8886..53e14e82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,11 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} +[tool.codespell] +exclude-file = ".codespell/ignore_lines.txt" +ignore-words = ".codespell/ignore_words.txt" +skip = "*.cif,*.dat" + [tool.black] line-length = 115 include = '\.pyi?$' diff --git a/src/diffpy/utils/parsers/loaddata.py b/src/diffpy/utils/parsers/loaddata.py index 4bb0d792..18375d90 100644 --- a/src/diffpy/utils/parsers/loaddata.py +++ b/src/diffpy/utils/parsers/loaddata.py @@ -30,7 +30,7 @@ def loadData(filename, minrows=10, headers=False, hdel="=", hignore=None, **kwar Minimum number of rows in the first data block. All rows must have the same number of floating point values. headers: bool - when False (defualt), the function returns a numpy array of the data in the data block. + when False (default), the function returns a numpy array of the data in the data block. When True, the function instead returns a dictionary of parameters and their corresponding values parsed from header (information prior the data block). See hdel and hignore for options to help with parsing header information. diff --git a/src/diffpy/utils/parsers/resample.py b/src/diffpy/utils/parsers/resample.py index f81fc2a2..e88c4f0b 100644 --- a/src/diffpy/utils/parsers/resample.py +++ b/src/diffpy/utils/parsers/resample.py @@ -113,7 +113,7 @@ def resample(r, s, dr): # spad = numpy.concatenate([s,spad]) # rnew = numpy.arange(0, rpad[-1], dr) # snew = numpy.zeros_like(rnew) - # Accomodate for the fact that r[0] might not be 0 + # Accommodate for the fact that r[0] might not be 0 # u = (rnew-r[0]) / dr0 # for n in range(len(spad)): # snew += spad[n] * numpy.sinc(u - n) diff --git a/src/diffpy/utils/parsers/serialization.py b/src/diffpy/utils/parsers/serialization.py index a0bec92c..46d4b8ff 100644 --- a/src/diffpy/utils/parsers/serialization.py +++ b/src/diffpy/utils/parsers/serialization.py @@ -56,7 +56,7 @@ def serialize_data( include a path element in the database entry (default True). If 'path' is not included in hddata, extract path from filename. serial_file - Serial language file to dump dictionary into. If None (defualt), no dumping will occur. + Serial language file to dump dictionary into. If None (default), no dumping will occur. Returns ------- From 7e25316974d3426339b7520ddd8ed45c575d5f5b Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Wed, 6 Nov 2024 17:56:41 -0500 Subject: [PATCH 84/85] add news --- news/dump.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/dump.rst diff --git a/news/dump.rst b/news/dump.rst new file mode 100644 index 00000000..7f99d586 --- /dev/null +++ b/news/dump.rst @@ -0,0 +1,23 @@ +**Added:** + +* functionality in dump to allow writing data on dspace + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From fb5cb73f5eed44c077fbcc4e78461c087fcd2e62 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 6 Nov 2024 19:05:12 -0500 Subject: [PATCH 85/85] Expect to run PR --- src/diffpy/utils/version.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/diffpy/utils/version.py b/src/diffpy/utils/version.py index e42fed78..6eec4d9f 100644 --- a/src/diffpy/utils/version.py +++ b/src/diffpy/utils/version.py @@ -24,3 +24,5 @@ __version__ = version("diffpy.utils") # End of file + +# Expect to run PR \ No newline at end of file