Skip to content

skpkg: final step, merge branch cookie into main #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 68 commits into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f353243
replace SCon with modern build tools, rewrite ...
Tieqiong Dec 28, 2024
6198d35
black autofix
Tieqiong Dec 28, 2024
8fac115
Merge pull request #36 from Tieqiong/setup
sbillinge Dec 28, 2024
d52d0a4
Merge pull request #37 from Tieqiong/black
sbillinge Dec 30, 2024
5df5dfb
add precommit and fix related checks
Tieqiong Jan 1, 2025
9219061
Merge pull request #38 from Tieqiong/precommit
sbillinge Jan 1, 2025
d14bb52
add PR test workflow and issue templates
Tieqiong Jan 1, 2025
c0fd7d6
pcmt
Tieqiong Jan 1, 2025
1bd4447
add cookie
Tieqiong Jan 2, 2025
4bf46d2
Merge pull request #39 from Tieqiong/workflow
sbillinge Jan 2, 2025
ea77121
move tests
Tieqiong Jan 11, 2025
abc8a9c
remove unnecessary files, add conftest
Tieqiong Jan 11, 2025
f01987a
easy tests
Tieqiong Jan 11, 2025
70e88e4
fix pytest
Tieqiong Jan 11, 2025
d0a96e8
help py3.11 find boost
Tieqiong Jan 11, 2025
8815174
add dependencies
Tieqiong Jan 11, 2025
95f2ef1
update CI
Tieqiong Jan 11, 2025
59f9471
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Jan 11, 2025
0ce4864
pcmt
Tieqiong Jan 11, 2025
81b3c03
git, codecov, cfgs, news dir, MANIFEST
Tieqiong Jan 11, 2025
4a8000a
AUTHORS, CHANGELOG, COC, LICENSEs, README
Tieqiong Jan 11, 2025
74ccfe1
gh workflows, conda-recipe, devutils
Tieqiong Jan 11, 2025
39eeb08
doc
Tieqiong Jan 11, 2025
b05530c
src
Tieqiong Jan 11, 2025
d2354a4
pyproject.toml
Tieqiong Jan 11, 2025
178507a
pcmt
Tieqiong Jan 11, 2025
5f34e62
Merge pull request #46 from Tieqiong/test
sbillinge Jan 11, 2025
cb402f9
Merge pull request #44 from Tieqiong/setup
sbillinge Jan 11, 2025
3ce7204
Merge pull request #45 from Tieqiong/deps
sbillinge Jan 11, 2025
fdceb92
Merge pull request #47 from Tieqiong/cookie
sbillinge Jan 11, 2025
50e6e81
srreal windows support
Tieqiong Feb 2, 2025
b83ee8f
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Feb 2, 2025
b075de8
Merge pull request #53 from Tieqiong/win
sbillinge Feb 2, 2025
d863058
skpkg: pc autofixes with updated config files
cadenmyers13 Jun 18, 2025
7a64d9d
chore: news
cadenmyers13 Jun 18, 2025
2ef09a4
chore: change to run on macos instead of ubuntu
cadenmyers13 Jun 18, 2025
a1420e4
Merge pull request #55 from cadenmyers13/pre-commit-auto
sbillinge Jun 20, 2025
2c7bf1f
find objcryst
Tieqiong Jun 20, 2025
99cd3d3
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Jun 20, 2025
12481e9
update conda requirements, correct objcryst flag
Tieqiong Jun 22, 2025
cabdcc7
force libdiffpy rc version
Tieqiong Jun 22, 2025
fa597f8
update tests
Tieqiong Jun 22, 2025
170f9c9
try removing extra insurance
Tieqiong Jun 22, 2025
a86ab58
make MSVC linker happy
Tieqiong Jun 22, 2025
2202fb8
Merge pull request #56 from Tieqiong/setup
sbillinge Jun 22, 2025
d3ecb25
skpkg: change black line length requirements to 79
cadenmyers13 Jun 23, 2025
703588b
skpkg: autofixes with linelength 79
cadenmyers13 Jun 23, 2025
d0f61e8
chore: news
cadenmyers13 Jun 23, 2025
412bbf5
skpkg: flake8 fixes in setup.py
cadenmyers13 Jun 23, 2025
e392485
skpkg: doc formatting autofixes
cadenmyers13 Jun 23, 2025
9b9f2a3
skpkg: add docformatting config to pyproject.toml
cadenmyers13 Jun 23, 2025
4f3d0df
Merge pull request #57 from cadenmyers13/pc-blackv2
sbillinge Jun 24, 2025
c1003ac
skpkg: gitignore, code of conduct updates, rm env.yml and prettierignore
cadenmyers13 Jun 24, 2025
6300597
skpkg: ignore_words.txt and pyproject.toml
cadenmyers13 Jun 24, 2025
462a18c
skpkg: github workflows dir
cadenmyers13 Jun 24, 2025
b24e60a
skpkg: change log header
cadenmyers13 Jun 24, 2025
b84b8d8
skpkg: readme
cadenmyers13 Jun 24, 2025
7410460
skpkg: user facing files and requirements
cadenmyers13 Jun 24, 2025
e2e5e0d
chore: news
cadenmyers13 Jun 24, 2025
830af7d
chore: add diffpy user group to readme
cadenmyers13 Jun 24, 2025
f2e0ddc
chore: more diffpy user group in readme
cadenmyers13 Jun 24, 2025
ad73cb4
chore: fix typo
cadenmyers13 Jun 24, 2025
ea1c888
chore: revert tests-on-pr.yml back to original
cadenmyers13 Jun 24, 2025
ac8a64d
chore: add blank lines
cadenmyers13 Jun 24, 2025
62b83e5
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Jun 24, 2025
1488319
ci: configure tests-on-pr.yml to run without environment.yml
cadenmyers13 Jun 25, 2025
e4a2700
skpkg: remove getting-started.rst
cadenmyers13 Jun 25, 2025
724018c
Merge pull request #58 from cadenmyers13/skpkg-migration
sbillinge Jun 26, 2025
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
13 changes: 8 additions & 5 deletions doc/source/examples/distanceprinter.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#!/usr/bin/env python

"""Demonstration of using PairQuantity class for a printout of pair distances
in periodic and non-periodic structures."""
"""Demonstration of using PairQuantity class for a printout of pair
distances in periodic and non-periodic structures."""

from diffpy.srreal.pairquantity import PairQuantity
from diffpy.structure import Structure


class DistancePrinter(PairQuantity):
"""This PairQuantity class simply prints the visited pair distances and the
indices of the contributing atoms."""
"""This PairQuantity class simply prints the visited pair distances
and the indices of the contributing atoms."""

def _resetValue(self):
self.count = 0

def _addPairContribution(self, bnds, sumscale):
self.count += bnds.multiplicity() * sumscale / 2.0
print("%i %g %i %i" % (self.count, bnds.distance(), bnds.site0(), bnds.site1()))
print(
"%i %g %i %i"
% (self.count, bnds.distance(), bnds.site0(), bnds.site1())
)
return


Expand Down
4 changes: 2 additions & 2 deletions doc/source/examples/lennardjones/ljcalculator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

"""Demonstration of using PairQuantity class for calculation of Lennard Jones
potential.
"""Demonstration of using PairQuantity class for calculation of Lennard
Jones potential.

Vij = 4 * ( rij ** -12 - rij ** -6 )
"""
Expand Down
9 changes: 7 additions & 2 deletions doc/source/examples/parallelPDF.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

"""Demonstration of parallel PDF calculation using the multiprocessing package.
"""Demonstration of parallel PDF calculation using the multiprocessing
package.

A PDF of menthol structure is first calculated on a single core and then
on all computer CPUs. The script then compares both results and prints
Expand All @@ -25,7 +26,11 @@

# configure options parsing
parser = optparse.OptionParser("%prog [options]\n" + __doc__)
parser.add_option("--pyobjcryst", action="store_true", help="Use pyobjcryst to load the CIF file.")
parser.add_option(
"--pyobjcryst",
action="store_true",
help="Use pyobjcryst to load the CIF file.",
)
parser.allow_interspersed_args = True
opts, args = parser.parse_args(sys.argv[1:])

Expand Down
23 changes: 23 additions & 0 deletions news/pc-blackv2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* Configure ``black`` to have a linelength requirement of 79 characters.

**Security:**

* <news item>
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ignore-words = ".codespell/ignore_words.txt"
skip = "*.cif,*.dat"

[tool.black]
line-length = 115
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
Expand All @@ -78,3 +78,8 @@ exclude = '''
| tests/data
)/
'''

[tool.docformatter]
recursive = true
wrap-summaries = 72
wrap-descriptions = 72
15 changes: 11 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def get_boost_config():
conda_prefix = os.environ.get("CONDA_PREFIX")
if not conda_prefix:
raise EnvironmentError(
"Neither BOOST_PATH nor CONDA_PREFIX are set. " "Please install Boost or set BOOST_PATH."
"Neither BOOST_PATH nor CONDA_PREFIX are set. "
"Please install Boost or set BOOST_PATH."
)
if os.name == "nt":
inc = Path(conda_prefix) / "Library" / "include"
Expand All @@ -52,7 +53,8 @@ def get_objcryst_libraries():
conda_prefix = os.environ.get("CONDA_PREFIX")
if not conda_prefix:
raise EnvironmentError(
"CONDA_PREFIX is not set. Please install ObjCryst using conda and activate the environment."
"CONDA_PREFIX is not set. "
"Please install ObjCryst using conda and activate the environment."
)
if os.name == "nt":
libdir = Path(conda_prefix) / "Library" / "lib"
Expand All @@ -64,7 +66,8 @@ def get_objcryst_libraries():
stem = Path(fn).stem
if "objcryst" not in stem.lower():
continue
# strip a leading "lib" so that setuptools does -lObjCryst, not -llibObjCryst
# strip a leading "lib"
# so that setuptools does -lObjCryst, not -llibObjCryst
if os.name != "nt" and stem.startswith("lib"):
stem = stem[3:]
libs.append(stem)
Expand Down Expand Up @@ -99,7 +102,11 @@ def get_objcryst_libraries():

def create_extensions():
"Initialize Extension objects for the setup function."
ext = Extension("diffpy.srreal.srreal_ext", glob.glob("src/extensions/*.cpp"), **ext_kws)
ext = Extension(
"diffpy.srreal.srreal_ext",
glob.glob("src/extensions/*.cpp"),
**ext_kws,
)
return [ext]


Expand Down
3 changes: 2 additions & 1 deletion src/diffpy/srreal/_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@


def get_registry_docstrings(cls):
"""Build a dictionary of docstrings per each HasClassRegistry method.
"""Build a dictionary of docstrings per each HasClassRegistry
method.

Parameters
----------
Expand Down
3 changes: 2 additions & 1 deletion src/diffpy/srreal/_final_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@


def import_now():
"""Import all Python modules that tweak extension-defined classes."""
"""Import all Python modules that tweak extension-defined
classes."""
global _import_now_called
if _import_now_called:
return
Expand Down
6 changes: 3 additions & 3 deletions src/diffpy/srreal/atomradiitable.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def clone(self):
return copy.copy(self)

def type(self):
"""Unique string identifier of the CovalentRadiiTable type. This is
used for class registration and as an argument for the createByType
function.
"""Unique string identifier of the CovalentRadiiTable type. This
is used for class registration and as an argument for the
createByType function.

Return string.
"""
Expand Down
3 changes: 2 additions & 1 deletion src/diffpy/srreal/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def _getattr(self, name):


def _setattr(self, name, value):
"""Assign to C++ double attribute if Python attribute does not exist."""
"""Assign to C++ double attribute if Python attribute does not
exist."""
try:
object.__getattribute__(self, name)
except AttributeError:
Expand Down
4 changes: 2 additions & 2 deletions src/diffpy/srreal/bondcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@


def _init_kwargs(self, **kwargs):
"""Create a new instance of BondCalculator. Keyword arguments can be used
to configure calculator properties, for example:
"""Create a new instance of BondCalculator. Keyword arguments can be
used to configure calculator properties, for example:

bdc = BondCalculator(rmin=1.5, rmax=2.5)

Expand Down
13 changes: 9 additions & 4 deletions src/diffpy/srreal/devutils/tunePeakPrecision.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

"""Tune the peak precision parameter so that PDFCalculator gives equivalent
results to diffpy.pdffit2.
"""Tune the peak precision parameter so that PDFCalculator gives
equivalent results to diffpy.pdffit2.

Usage: tunePeakPrecision.py [qmax] [peakprecision] [createplot]
"""
Expand Down Expand Up @@ -108,7 +108,9 @@ def comparePDFCalculators(qmax, peakprecision=None):
rv = {}
rv["qmax"] = qmax
rv["peakprecision"] = (
peakprecision is None and PDFCalculator()._getDoubleAttr("peakprecision") or peakprecision
peakprecision is None
and PDFCalculator()._getDoubleAttr("peakprecision")
or peakprecision
)
ttic = time.clock()
rg0 = Gpdffit2(qmax)
Expand Down Expand Up @@ -175,7 +177,10 @@ def main():
processCommandLineArguments()
cmpdata = comparePDFCalculators(qmax, peakprecision)
print(
("qmax = %(qmax)g pkprec = %(peakprecision)g " + "grmsd = %(grmsd)g t0 = %(t0).3f t1 = %(t1).3f")
(
"qmax = %(qmax)g pkprec = %(peakprecision)g "
+ "grmsd = %(grmsd)g t0 = %(t0).3f t1 = %(t1).3f"
)
% cmpdata
)
if createplot:
Expand Down
3 changes: 2 additions & 1 deletion src/diffpy/srreal/eventticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See LICENSE.txt for license information.
#
##############################################################################
"""Class EventTicker -- storage of modification times of dependent objects."""
"""Class EventTicker -- storage of modification times of dependent
objects."""


# exported items
Expand Down
7 changes: 4 additions & 3 deletions src/diffpy/srreal/overlapcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See LICENSE_DANSE.txt for license information.
#
##############################################################################
"""Class OverlapCalculator -- calculator of atom overlaps in a structure."""
"""Class OverlapCalculator -- calculator of atom overlaps in a
structure."""


# exported items, these also makes them show in pydoc.
Expand Down Expand Up @@ -50,8 +51,8 @@


def _init_kwargs(self, **kwargs):
"""Create a new instance of OverlapCalculator. Keyword arguments can be
used to configure calculator properties, for example:
"""Create a new instance of OverlapCalculator. Keyword arguments can
be used to configure calculator properties, for example:

olc = OverlapCalculator(rmax=2.5)

Expand Down
3 changes: 2 additions & 1 deletion src/diffpy/srreal/pairquantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See LICENSE_DANSE.txt for license information.
#
##############################################################################
"""Class PairQuantity -- base class for Python defined calculators."""
"""Class PairQuantity -- base class for Python defined
calculators."""


# exported items
Expand Down
14 changes: 9 additions & 5 deletions src/diffpy/srreal/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def createParallelCalculator(pqobj, ncpu, pmap):
"""

class ParallelPairQuantity(Attributes):
"""Class for running parallel calculations. This is a proxy class to
the wrapper PairQuantity type with the same interface.
"""Class for running parallel calculations. This is a proxy
class to the wrapper PairQuantity type with the same interface.

Instance data:

Expand All @@ -70,7 +70,8 @@ def __init__(self, pqobj, ncpu, pmap):
return

def eval(self, stru=None):
"""Perform parallel calculation and return internal value array.
"""Perform parallel calculation and return internal value
array.

stru -- object that can be converted to StructureAdapter,
e.g., example diffpy Structure or pyobjcryst Crystal.
Expand Down Expand Up @@ -163,7 +164,9 @@ def proxymethod(self, *args, **kwargs):
return proxymethod

for n, f in inspect.getmembers(pqtype, inspect.isroutine):
ignore = n not in proxy_forced and (n.startswith("_") or hasattr(ParallelPairQuantity, n))
ignore = n not in proxy_forced and (
n.startswith("_") or hasattr(ParallelPairQuantity, n)
)
if ignore:
continue
setattr(ParallelPairQuantity, n, _make_proxymethod(n, f))
Expand Down Expand Up @@ -206,7 +209,8 @@ def _fdel(self):


def _parallelData(kwd):
"""Helper for calculating and fetching raw results from a worker node."""
"""Helper for calculating and fetching raw results from a worker
node."""
pqobj = kwd["pqobj"]
pqobj._setupParallelRun(kwd["cpuindex"], kwd["ncpu"])
pqobj.eval()
Expand Down
9 changes: 6 additions & 3 deletions src/diffpy/srreal/pdfbaseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@


def makePDFBaseline(name, fnc, replace=False, **dbattrs):
"""Helper function for registering Python function as a PDFBaseline. This
is required for using Python function as PDFCalculator.baseline.
"""Helper function for registering Python function as a PDFBaseline.
This is required for using Python function as
PDFCalculator.baseline.

name -- unique string name for registering Python function in the
global registry of PDFBaseline types. This will be the
Expand Down Expand Up @@ -85,7 +86,9 @@ def fshiftedline(x, aline, bline):
"""
from diffpy.srreal.wraputils import _wrapAsRegisteredUnaryFunction

rv = _wrapAsRegisteredUnaryFunction(PDFBaseline, name, fnc, replace=replace, **dbattrs)
rv = _wrapAsRegisteredUnaryFunction(
PDFBaseline, name, fnc, replace=replace, **dbattrs
)
return rv


Expand Down
11 changes: 6 additions & 5 deletions src/diffpy/srreal/pdfcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@


def _defineCommonInterface(cls):
"""This function defines shared properties of PDF calculator classes."""
"""This function defines shared properties of PDF calculator
classes."""

cls.scale = propertyFromExtDoubleAttr(
"scale",
Expand Down Expand Up @@ -161,10 +162,10 @@ def _defineCommonInterface(cls):
)

def _call_kwargs(self, structure=None, **kwargs):
"""Calculate PDF for the given structure as an (r, G) tuple. Keyword
arguments can be used to configure calculator attributes, these
override any properties that may be passed from the structure, such as
spdiameter.
"""Calculate PDF for the given structure as an (r, G) tuple.
Keyword arguments can be used to configure calculator
attributes, these override any properties that may be passed
from the structure, such as spdiameter.

structure -- a structure object to be evaluated. Reuse the last
structure when None.
Expand Down
9 changes: 6 additions & 3 deletions src/diffpy/srreal/pdfenvelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@


def makePDFEnvelope(name, fnc, replace=False, **dbattrs):
"""Helper function for registering Python function as a PDFEnvelope. This
is required for using Python function as PDFCalculator envelope.
"""Helper function for registering Python function as a PDFEnvelope.
This is required for using Python function as PDFCalculator
envelope.

name -- unique string name for registering Python function in the
global registry of PDFEnvelope types. This will be the
Expand Down Expand Up @@ -115,7 +116,9 @@ def fexpdecay(x, expscale, exptail):
"""
from diffpy.srreal.wraputils import _wrapAsRegisteredUnaryFunction

rv = _wrapAsRegisteredUnaryFunction(PDFEnvelope, name, fnc, replace=replace, **dbattrs)
rv = _wrapAsRegisteredUnaryFunction(
PDFEnvelope, name, fnc, replace=replace, **dbattrs
)
return rv


Expand Down
Loading
Loading