From 7ecc73335b5647696f3b51e19709195837b1eeb8 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Thu, 1 Aug 2024 12:48:53 -0400 Subject: [PATCH 1/5] fix path --- src/diffpy/pdfgui/control/pdfguimacros.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffpy/pdfgui/control/pdfguimacros.py b/src/diffpy/pdfgui/control/pdfguimacros.py index e91abe76..263a861b 100644 --- a/src/diffpy/pdfgui/control/pdfguimacros.py +++ b/src/diffpy/pdfgui/control/pdfguimacros.py @@ -381,7 +381,7 @@ def makeDopingSeries(control, fit, base, dopant, paths, doping): from diffpy.pdfgui.control.pdfguicontrol import PDFGuiControl control = PDFGuiControl() - control.load("../../tests/testdata/ni.ddp") + control.load("src/diffpy/pdfgui/tests/testdata/ni.ddp") fit = control.fits[0] olist = makeRSeries(control, fit, 5, 20, 5) print("\n".join(f[0].name for f in olist)) From ade74cefd457a3e0f64c17a3af3bf2503b9b1d31 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Thu, 1 Aug 2024 12:51:06 -0400 Subject: [PATCH 2/5] copyright update and run.py --- src/diffpy/pdfgui/tests/debug.py | 15 ++++++------ src/diffpy/pdfgui/tests/run.py | 42 +++++++++++++++----------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/diffpy/pdfgui/tests/debug.py b/src/diffpy/pdfgui/tests/debug.py index 28926e22..c26a68d2 100644 --- a/src/diffpy/pdfgui/tests/debug.py +++ b/src/diffpy/pdfgui/tests/debug.py @@ -1,15 +1,16 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfgui Complex Modeling Initiative -# (c) 2016 Brookhaven Science Associates, -# Brookhaven National Laboratory. -# All rights reserved. +# (c) 2016 Brookhaven Science Associates, Brookhaven National Laboratory. +# (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.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.pdfgui/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## diff --git a/src/diffpy/pdfgui/tests/run.py b/src/diffpy/pdfgui/tests/run.py index 461d7c01..58cc123a 100644 --- a/src/diffpy/pdfgui/tests/run.py +++ b/src/diffpy/pdfgui/tests/run.py @@ -1,38 +1,34 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfgui by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2012-2024 Trustees of the Columbia University -# in the City of New York. All rights reserved. +# (c) 2012-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.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.pdfgui/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## - """Convenience module for executing all unit tests with - python -m diffpy.pdfgui.tests.run """ +import sys -if __name__ == "__main__": - import sys +import pytest - # show warnings by default - if not sys.warnoptions: - import os - import warnings - - warnings.simplefilter("default") - # also affect subprocesses - os.environ["PYTHONWARNINGS"] = "default" - from diffpy.pdfgui.tests import test - - # produce zero exit code for a successful test - sys.exit(not test().wasSuccessful()) +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)) + # call pytest and exit with the return code from pytest + exit_res = pytest.main(args) + sys.exit(exit_res) # End of file From 7dc7029fdaf121825b2d0e867eee74d770606cdb Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Thu, 1 Aug 2024 12:53:34 -0400 Subject: [PATCH 3/5] fix capitalization --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index bb30e2e4..d136f673 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,7 @@ help menu and follow the tutorial instructions. A detailed description is available in the doc/Farrow-jpcm-2007.pdf paper. -REQUIREMENTS +Requirements ------------------------------------------------------------------------ PDFgui requires Python 3.8+ or 2.7 and several third-party From 6c1a9f379d94a7005350404822f9a3fe88c695d0 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Thu, 1 Aug 2024 13:06:49 -0400 Subject: [PATCH 4/5] pkg_resources deprecation --- src/diffpy/pdfgui/gui/pdfguiglobals.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/diffpy/pdfgui/gui/pdfguiglobals.py b/src/diffpy/pdfgui/gui/pdfguiglobals.py index 96f20538..d72a2da2 100644 --- a/src/diffpy/pdfgui/gui/pdfguiglobals.py +++ b/src/diffpy/pdfgui/gui/pdfguiglobals.py @@ -16,8 +16,9 @@ """This module contains global parameters needed by PDFgui.""" import os.path +from importlib import resources -from pkg_resources import Requirement, resource_filename +from pkg_resources import Requirement from diffpy.pdfgui.gui import debugoptions @@ -31,7 +32,7 @@ isAltered = False # Resolve APPDATADIR base path to application data files. -_mydir = os.path.abspath(resource_filename(__name__, "")) +_mydir = os.path.abspath(str(resources.files(__name__).joinpath(""))) _upbasedir = os.path.normpath(_mydir + "/../../..") _development_mode = os.path.basename(_upbasedir) == "src" and os.path.isfile( os.path.join(_upbasedir, "../setup.py") @@ -47,7 +48,7 @@ if _development_mode: APPDATADIR = os.path.dirname(_mydir) else: - APPDATADIR = os.path.join(resource_filename(_req, ""), "diffpy/pdfgui") + APPDATADIR = os.path.join(str(resources.files(_req, "")), "diffpy/pdfgui") APPDATADIR = os.path.abspath(APPDATADIR) From e3db421444b06000cdfce922c503728a76e6ad86 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Thu, 1 Aug 2024 13:22:12 -0400 Subject: [PATCH 5/5] cookiecutter news file --- news/cookiecutter.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/cookiecutter.rst diff --git a/news/cookiecutter.rst b/news/cookiecutter.rst new file mode 100644 index 00000000..929ec43c --- /dev/null +++ b/news/cookiecutter.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Package reformatted to comply with new Billinge Group package structure + +**Deprecated:** + +* pkg_resources replaced with importlib + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +*