Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions news/cookiecutter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Package reformatted to comply with new Billinge Group package structure

**Deprecated:**

* pkg_resources replaced with importlib

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
2 changes: 1 addition & 1 deletion src/diffpy/pdfgui/control/pdfguimacros.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you test this? It is unlikely to work because this is a relative file-path.

fit = control.fits[0]
olist = makeRSeries(control, fit, 5, 20, 5)
print("\n".join(f[0].name for f in olist))
Expand Down
7 changes: 4 additions & 3 deletions src/diffpy/pdfgui/gui/pdfguiglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pkg_resources is deprecated so we want to get rid of this. I would put pkg_resources fixes on a separate PR tbh.


from diffpy.pdfgui.gui import debugoptions

Expand All @@ -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("")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whenever we touch lines of code that do path munging, switch the code to using pathlib.Path. Then do it for the full module. This also on a separate PR because it will be harder to merge.

_upbasedir = os.path.normpath(_mydir + "/../../..")
_development_mode = os.path.basename(_upbasedir) == "src" and os.path.isfile(
os.path.join(_upbasedir, "../setup.py")
Expand All @@ -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)

Expand Down
15 changes: 8 additions & 7 deletions src/diffpy/pdfgui/tests/debug.py
Original file line number Diff line number Diff line change
@@ -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.
#
##############################################################################

Expand Down
42 changes: 19 additions & 23 deletions src/diffpy/pdfgui/tests/run.py
Original file line number Diff line number Diff line change
@@ -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