From 4573f45b3c1d665de09b871af79b65bdcee4ad85 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 16:57:49 -0400 Subject: [PATCH 01/56] Modify MANIFEST.in to test files in sdist --- MANIFEST.in | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 3bcdfb4f..f1a78eec 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,14 +1,12 @@ -include AUTHORS.rst -include LICENSE -include README.rst -include requirements.txt - -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] - -recursive-include docs *.rst conf.py Makefile make.bat - -include diffpy.structure/version.py - -# If including data files in the package, add them like: -# include path/to/data_file +graft src +graft tests +graft requirements + +include AUTHORS.rst LICENSE*.rst README.rst + +# 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. From 01bb3032c78e79e8fecc601dbd8f7b350b79a3a0 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:22:06 -0400 Subject: [PATCH 02/56] Replace github workflows --- .github/workflows/check-news-item.yml | 12 +++++ .github/workflows/codecov.yml | 53 ------------------- .github/workflows/docs.yml | 48 ----------------- .github/workflows/main.yml | 42 --------------- .../matrix-and-codecov-on-merge-to-main.yml | 21 ++++++++ .github/workflows/publish-docs-on-release.yml | 14 +++++ .github/workflows/tests-on-pr.yml | 16 ++++++ 7 files changed, 63 insertions(+), 143 deletions(-) create mode 100644 .github/workflows/check-news-item.yml delete mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/main.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..1301ca85 --- /dev/null +++ b/.github/workflows/check-news-item.yml @@ -0,0 +1,12 @@ +name: Check for News + +on: + pull_request_target: + branches: + - main + +jobs: + build: + uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 + with: + project: diffpy.structure diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index fd96a710..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.structure - 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.structure 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.structure - 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 df2b392f..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.structure - 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.structure 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 33ece6cf..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.structure - 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.structure 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.structure - run: python -m pytest 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..c1905e0d --- /dev/null +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: null + +jobs: + coverage: + uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 + with: + project: diffpy.structure + c_extension: false + headless: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml new file mode 100644 index 00000000..1c5981db --- /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: + docs: + uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: diffpy.structure + 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..614b16f2 --- /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: + validate: + uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 + with: + project: diffpy.structure + c_extension: false + headless: false From 88414c00c4b6d611e13bfacdc2c40ee76f78dcd6 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:25:34 -0400 Subject: [PATCH 03/56] Add requirements, add pytest-cov --- requirements/build.txt | 2 -- requirements/run.txt | 4 ++-- requirements/test.txt | 1 + 3 files changed, 3 insertions(+), 4 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 diff --git a/requirements/run.txt b/requirements/run.txt index 5413a934..0fdcecb6 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,2 +1,2 @@ -numpy -pycifrw +numpy +pycifrw diff --git a/requirements/test.txt b/requirements/test.txt index 6f9ccf84..a7277865 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,4 +2,5 @@ flake8 pytest codecov coverage +pytest-cov pytest-env From 373dc722a43a2861afc5cdcbe328390e43e889e1 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:26:16 -0400 Subject: [PATCH 04/56] Delete gitattributes and add pre-commit config --- .gitattributes | 1 - .pre-commit-config.yaml | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index de811ba3..00000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -diffpy.structure/_version.py export-subst 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 31f61f530e6360f2454760495bec7a0db1bf787c Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:27:37 -0400 Subject: [PATCH 05/56] Remove devutils --- devutils/makesdist | 60 ---------- devutils/sgtbx_extra_groups.py | 210 --------------------------------- 2 files changed, 270 deletions(-) delete mode 100755 devutils/makesdist delete mode 100644 devutils/sgtbx_extra_groups.py diff --git a/devutils/makesdist b/devutils/makesdist deleted file mode 100755 index dccfaa99..00000000 --- a/devutils/makesdist +++ /dev/null @@ -1,60 +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") diff --git a/devutils/sgtbx_extra_groups.py b/devutils/sgtbx_extra_groups.py deleted file mode 100644 index 4cab28c2..00000000 --- a/devutils/sgtbx_extra_groups.py +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/env python - -"""Quick and extremely dirty script for generating code for SpaceGroup that -are defined in cctbx, but not in mmLib. It was used to generate module -sgtbxspacegroups. - -This is a utility script that should not be included with code distribution. - -Not to be included with code distributions. -""" - - -import math -import re - -import numpy -from cctbx import sgtbx - -from diffpy.structure.spacegroups import IsSpaceGroupIdentifier, SpaceGroup, SymOp, mmLibSpaceGroupList - - -def tupleToSGArray(tpl): - if not _rtarrays: - import diffpy.structure.SpaceGroups as sgmod - - for n in dir(sgmod): - if not n.startswith("Rot_") and not n.startswith("Tr_"): - continue - a = getattr(sgmod, n) - t = tuple(a.flatten()) - _rtarrays[t] = a - if len(tpl) == 3: - tpl = tuple([(x - math.floor(x)) for x in tpl]) - if tpl not in _rtarrays: - _rtarrays[tpl] = numpy.array(tpl, dtype=float) - return _rtarrays[tpl] - - -_rtarrays = {} - - -def mmSpaceGroupFromSymbol(symbol): - """Construct SpaceGroup instance from a string symbol using sgtbx data.""" - sginfo = sgtbx.space_group_info(symbol) - symop_list = [] - symop_list = getSymOpList(sginfo.group()) - sgtype = sginfo.type() - uhm = sgtype.lookup_symbol() - sgsmbls = sgtbx.space_group_symbols(uhm) - kw = {} - kw["number"] = sgtype.number() - kw["num_sym_equiv"] = len(symop_list) - kw["num_primitive_sym_equiv"] = countUniqueRotations(symop_list) - kw["short_name"] = sgsmbls.hermann_mauguin().replace(" ", "") - pgt = sgsmbls.point_group_type() - pgn = "PG" + re.sub(r"-(\d)", "\\1bar", pgt) - kw["point_group_name"] = pgn - kw["crystal_system"] = sgsmbls.crystal_system().upper() - kw["pdb_name"] = sgsmbls.hermann_mauguin() - kw["symop_list"] = symop_list - mmsg = SpaceGroup(**kw) - return mmsg - - -def adjustMMSpaceGroupNumber(mmsg): - sg0 = [x for x in mmLibSpaceGroupList if x.number == mmsg.number] - if sg0 and cmpSpaceGroups(sg0[0], mmsg): - return - while mmsg.number in sgnumbers: - mmsg.number += 1000 - sgnumbers.append(mmsg.number) - - -def getSymOpList(grp): - symop_list = [] - for op in grp: - r_sgtbx = op.r().as_double() - t_sgtbx = op.t().as_double() - R = tupleToSGArray(r_sgtbx) - t = tupleToSGArray(t_sgtbx) - symop_list.append(SymOp(R, t)) - return symop_list - - -def countUniqueRotations(symop_list): - unique_rotations = set() - for op in symop_list: - tpl = tuple(op.R.flatten()) - unique_rotations.add(tpl) - return len(unique_rotations) - - -def cmpSpaceGroups(sg0, sg1): - if sg0 is sg1: - return True - s0 = hashMMSpaceGroup(sg0) - s1 = hashMMSpaceGroup(sg1) - return s0 == s1 - - -def findEquivalentMMSpaceGroup(grp): - if not _equivmmsg: - for sgn in mmLibSpaceGroupList: - ssgn = hashMMSpaceGroup(sgn) - _equivmmsg.setdefault(ssgn, sgn) - ssg = hashSgtbxGroup(grp) - return _equivmmsg.get(ssg) - - -_equivmmsg = {} - - -def findEquivalentSgtbxSpaceGroup(sgmm): - if not _equivsgtbx: - for smbls in sgtbx.space_group_symbol_iterator(): - uhm = smbls.universal_hermann_mauguin() - grp = sgtbx.space_group_info(uhm).group() - hgrp = hashSgtbxGroup(grp) - _equivsgtbx.setdefault(hgrp, grp) - hgmm = hashMMSpaceGroup(sgmm) - return _equivsgtbx.get(hgmm) - - -_equivsgtbx = {} - - -def hashMMSpaceGroup(sg): - lines = [str(sg.number % 1000)] + sorted(map(str, sg.iter_symops())) - s = "\n".join(lines) - return s - - -def hashSgtbxGroup(grp): - n = grp.type().number() - lines = [str(n)] + sorted(map(str, getSymOpList(grp))) - s = "\n".join(lines) - return s - - -sgnumbers = [sg.number for sg in mmLibSpaceGroupList] - -_SGsrc = """\ -sg%(number)i = SpaceGroup( - number = %(number)i, - num_sym_equiv = %(num_sym_equiv)i, - num_primitive_sym_equiv = %(num_sym_equiv)i, - short_name = %(short_name)r, - point_group_name = %(point_group_name)r, - crystal_system = %(crystal_system)r, - pdb_name = %(pdb_name)r, - symop_list = [ - @SYMOPS@ - ] -) -""" - - -def SGCode(mmsg): - src0 = _SGsrc % mmsg.__dict__ - src1 = src0.replace("@SYMOPS@", SymOpsCode(mmsg)) - return src1 - - -def SymOpsCode(mmsg): - lst = ["%8s%s," % ("", SymOpCode(op)) for op in mmsg.iter_symops()] - src = "\n".join(lst).strip() - return src - - -def SymOpCode(op): - if not _rtnames: - import diffpy.structure.SpaceGroups as sgmod - - for n in dir(sgmod): - if not n.startswith("Rot_") and not n.startswith("Tr_"): - continue - a = getattr(sgmod, n) - at = tuple(a.flatten()) - _rtnames[at] = "sgmod." + n - nR = _rtnames[tuple(op.R.flatten())] - nt = _rtnames[tuple(op.t)] - src = "SymOp(%s, %s)" % (nR, nt) - return src - - -_rtnames = {} - - -def main(): - duplicates = set() - for smbls in sgtbx.space_group_symbol_iterator(): - uhm = smbls.universal_hermann_mauguin() - grp = sgtbx.space_group_info(uhm).group() - if findEquivalentMMSpaceGroup(grp): - continue - shn = smbls.hermann_mauguin().replace(" ", "") - if IsSpaceGroupIdentifier(shn): - continue - sg = mmSpaceGroupFromSymbol(uhm) - hsg = hashMMSpaceGroup(sg) - if hsg in duplicates: - continue - adjustMMSpaceGroupNumber(sg) - duplicates.add(hsg) - print(SGCode(sg)) - return - - -if __name__ == "__main__": - main() From 848b25e5727c180cb5b3dd892d87764f3774ad33 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:29:41 -0400 Subject: [PATCH 06/56] Add devutils script --- devutils/sgtbx_extra_groups.py | 210 +++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 devutils/sgtbx_extra_groups.py diff --git a/devutils/sgtbx_extra_groups.py b/devutils/sgtbx_extra_groups.py new file mode 100644 index 00000000..4cab28c2 --- /dev/null +++ b/devutils/sgtbx_extra_groups.py @@ -0,0 +1,210 @@ +#!/usr/bin/env python + +"""Quick and extremely dirty script for generating code for SpaceGroup that +are defined in cctbx, but not in mmLib. It was used to generate module +sgtbxspacegroups. + +This is a utility script that should not be included with code distribution. + +Not to be included with code distributions. +""" + + +import math +import re + +import numpy +from cctbx import sgtbx + +from diffpy.structure.spacegroups import IsSpaceGroupIdentifier, SpaceGroup, SymOp, mmLibSpaceGroupList + + +def tupleToSGArray(tpl): + if not _rtarrays: + import diffpy.structure.SpaceGroups as sgmod + + for n in dir(sgmod): + if not n.startswith("Rot_") and not n.startswith("Tr_"): + continue + a = getattr(sgmod, n) + t = tuple(a.flatten()) + _rtarrays[t] = a + if len(tpl) == 3: + tpl = tuple([(x - math.floor(x)) for x in tpl]) + if tpl not in _rtarrays: + _rtarrays[tpl] = numpy.array(tpl, dtype=float) + return _rtarrays[tpl] + + +_rtarrays = {} + + +def mmSpaceGroupFromSymbol(symbol): + """Construct SpaceGroup instance from a string symbol using sgtbx data.""" + sginfo = sgtbx.space_group_info(symbol) + symop_list = [] + symop_list = getSymOpList(sginfo.group()) + sgtype = sginfo.type() + uhm = sgtype.lookup_symbol() + sgsmbls = sgtbx.space_group_symbols(uhm) + kw = {} + kw["number"] = sgtype.number() + kw["num_sym_equiv"] = len(symop_list) + kw["num_primitive_sym_equiv"] = countUniqueRotations(symop_list) + kw["short_name"] = sgsmbls.hermann_mauguin().replace(" ", "") + pgt = sgsmbls.point_group_type() + pgn = "PG" + re.sub(r"-(\d)", "\\1bar", pgt) + kw["point_group_name"] = pgn + kw["crystal_system"] = sgsmbls.crystal_system().upper() + kw["pdb_name"] = sgsmbls.hermann_mauguin() + kw["symop_list"] = symop_list + mmsg = SpaceGroup(**kw) + return mmsg + + +def adjustMMSpaceGroupNumber(mmsg): + sg0 = [x for x in mmLibSpaceGroupList if x.number == mmsg.number] + if sg0 and cmpSpaceGroups(sg0[0], mmsg): + return + while mmsg.number in sgnumbers: + mmsg.number += 1000 + sgnumbers.append(mmsg.number) + + +def getSymOpList(grp): + symop_list = [] + for op in grp: + r_sgtbx = op.r().as_double() + t_sgtbx = op.t().as_double() + R = tupleToSGArray(r_sgtbx) + t = tupleToSGArray(t_sgtbx) + symop_list.append(SymOp(R, t)) + return symop_list + + +def countUniqueRotations(symop_list): + unique_rotations = set() + for op in symop_list: + tpl = tuple(op.R.flatten()) + unique_rotations.add(tpl) + return len(unique_rotations) + + +def cmpSpaceGroups(sg0, sg1): + if sg0 is sg1: + return True + s0 = hashMMSpaceGroup(sg0) + s1 = hashMMSpaceGroup(sg1) + return s0 == s1 + + +def findEquivalentMMSpaceGroup(grp): + if not _equivmmsg: + for sgn in mmLibSpaceGroupList: + ssgn = hashMMSpaceGroup(sgn) + _equivmmsg.setdefault(ssgn, sgn) + ssg = hashSgtbxGroup(grp) + return _equivmmsg.get(ssg) + + +_equivmmsg = {} + + +def findEquivalentSgtbxSpaceGroup(sgmm): + if not _equivsgtbx: + for smbls in sgtbx.space_group_symbol_iterator(): + uhm = smbls.universal_hermann_mauguin() + grp = sgtbx.space_group_info(uhm).group() + hgrp = hashSgtbxGroup(grp) + _equivsgtbx.setdefault(hgrp, grp) + hgmm = hashMMSpaceGroup(sgmm) + return _equivsgtbx.get(hgmm) + + +_equivsgtbx = {} + + +def hashMMSpaceGroup(sg): + lines = [str(sg.number % 1000)] + sorted(map(str, sg.iter_symops())) + s = "\n".join(lines) + return s + + +def hashSgtbxGroup(grp): + n = grp.type().number() + lines = [str(n)] + sorted(map(str, getSymOpList(grp))) + s = "\n".join(lines) + return s + + +sgnumbers = [sg.number for sg in mmLibSpaceGroupList] + +_SGsrc = """\ +sg%(number)i = SpaceGroup( + number = %(number)i, + num_sym_equiv = %(num_sym_equiv)i, + num_primitive_sym_equiv = %(num_sym_equiv)i, + short_name = %(short_name)r, + point_group_name = %(point_group_name)r, + crystal_system = %(crystal_system)r, + pdb_name = %(pdb_name)r, + symop_list = [ + @SYMOPS@ + ] +) +""" + + +def SGCode(mmsg): + src0 = _SGsrc % mmsg.__dict__ + src1 = src0.replace("@SYMOPS@", SymOpsCode(mmsg)) + return src1 + + +def SymOpsCode(mmsg): + lst = ["%8s%s," % ("", SymOpCode(op)) for op in mmsg.iter_symops()] + src = "\n".join(lst).strip() + return src + + +def SymOpCode(op): + if not _rtnames: + import diffpy.structure.SpaceGroups as sgmod + + for n in dir(sgmod): + if not n.startswith("Rot_") and not n.startswith("Tr_"): + continue + a = getattr(sgmod, n) + at = tuple(a.flatten()) + _rtnames[at] = "sgmod." + n + nR = _rtnames[tuple(op.R.flatten())] + nt = _rtnames[tuple(op.t)] + src = "SymOp(%s, %s)" % (nR, nt) + return src + + +_rtnames = {} + + +def main(): + duplicates = set() + for smbls in sgtbx.space_group_symbol_iterator(): + uhm = smbls.universal_hermann_mauguin() + grp = sgtbx.space_group_info(uhm).group() + if findEquivalentMMSpaceGroup(grp): + continue + shn = smbls.hermann_mauguin().replace(" ", "") + if IsSpaceGroupIdentifier(shn): + continue + sg = mmSpaceGroupFromSymbol(uhm) + hsg = hashMMSpaceGroup(sg) + if hsg in duplicates: + continue + adjustMMSpaceGroupNumber(sg) + duplicates.add(hsg) + print(SGCode(sg)) + return + + +if __name__ == "__main__": + main() From 84182c446614b1735757d2f9b97474fbd0375d3d Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:31:13 -0400 Subject: [PATCH 07/56] Resolve authors --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 9f6a419f..1abf16be 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,6 +1,7 @@ Authors ======= +Billinge Group and community contributors, Pavol Juhas, Christopher L. Farrow, Xiaohao Yang, From f3029fb1b42df9edb46b23a6f9204cd376de0085 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:31:47 -0400 Subject: [PATCH 08/56] Add updated doc --- .../api/diffpy.structure.example_package.rst | 31 +++++ doc/source/api/diffpy.structure.rst | 106 ++---------------- doc/source/conf.py | 14 --- doc/source/index.rst | 43 +------ 4 files changed, 43 insertions(+), 151 deletions(-) create mode 100644 doc/source/api/diffpy.structure.example_package.rst diff --git a/doc/source/api/diffpy.structure.example_package.rst b/doc/source/api/diffpy.structure.example_package.rst new file mode 100644 index 00000000..3595000a --- /dev/null +++ b/doc/source/api/diffpy.structure.example_package.rst @@ -0,0 +1,31 @@ +.. _example_package documentation: + +|title| +======= + +.. |title| replace:: diffpy.structure.example_package package + +.. automodule:: diffpy.structure.example_package + :members: + :undoc-members: + :show-inheritance: + +|foo| +----- + +.. |foo| replace:: diffpy.structure.example_package.foo module + +.. automodule:: diffpy.structure.example_package.foo + :members: + :undoc-members: + :show-inheritance: + +|bar| +----- + +.. |bar| replace:: diffpy.structure.example_package.bar module + +.. automodule:: diffpy.structure.example_package.foo + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.structure.rst b/doc/source/api/diffpy.structure.rst index 95ff1285..cdcc80ea 100644 --- a/doc/source/api/diffpy.structure.rst +++ b/doc/source/api/diffpy.structure.rst @@ -1,7 +1,9 @@ :tocdepth: -1 -diffpy.structure package -======================== +|title| +======= + +.. |title| replace:: diffpy.structure package .. automodule:: diffpy.structure :members: @@ -12,107 +14,17 @@ Subpackages ----------- .. toctree:: - :titlesonly: - - diffpy.structure.parsers - diffpy.structure.expansion - diffpy.structure.apps + diffpy.structure.example_package Submodules ---------- -diffpy.structure.spacegroups module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.spacegroups - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure._legacy_importer module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure._legacy_importer - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.structureerrors module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.structureerrors - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.spacegroupmod module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.spacegroupmod - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.utils module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.utils - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.lattice module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.lattice - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.structure module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.structure - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.mmlibspacegroups module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.mmlibspacegroups - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.symmetryutilities module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.symmetryutilities - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.atom module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.atom - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.pdffitstructure module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.pdffitstructure - :members: - :undoc-members: - :show-inheritance: +|module| +-------- -diffpy.structure.sgtbxspacegroups module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. |module| replace:: diffpy.structure.example_submodule module -.. automodule:: diffpy.structure.sgtbxspacegroups +.. automodule:: diffpy.structure.example_submodule :members: :undoc-members: :show-inheritance: diff --git a/doc/source/conf.py b/doc/source/conf.py index d3af3e37..f7b1c770 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -18,8 +18,6 @@ from importlib.metadata import version from pathlib import Path -autodoc_mock_imports = ["importlib.metadata"] - # 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 Path().resolve() to make it absolute, like shown here. @@ -48,8 +46,6 @@ "m2r", ] -autodoc_member_order = "groupwise" - # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -120,12 +116,6 @@ # Display all warnings for missing links. nitpicky = True -nitpick_ignore = [ - ("py:class", "array_like"), - ("py:class", "Parser"), - ("py:class", "CifFile"), -] - # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for @@ -297,7 +287,3 @@ # Example configuration for intersphinx: refer to the Python standard library. # intersphinx_mapping = {'http://docs.python.org/': None} -intersphinx_mapping = { - "python": ("https://docs.python.org/3", None), - "numpy": ("https://numpy.org/doc/stable/", None), -} diff --git a/doc/source/index.rst b/doc/source/index.rst index 4fabbaa1..54ec3695 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,57 +4,21 @@ .. |title| replace:: diffpy.structure documentation -diffpy.structure - Crystal structure container and parsers for structure formats. +diffpy.structure - Crystal structure container and parsers for structure formats.. | Software version |release|. | Last updated |today|. -The diffpy.structure package provides objects for storing atomic -coordinates, displacement parameters and other crystal structure data. -diffpy.structure supports import and export of structure data in several -structure formats such as CIF, PDB, xyz. It provides conversion -between fractional and absolute Cartesian coordinates, functions for -symmetry expansion from asymmetric unit and generation of symmetry -constraints for atom positions and displacement parameters. diffpy.structure -includes definitions of all space groups in over 500 symmetry settings. - ======= Authors ======= -diffpy.structure is developed by members of the Billinge Group at -Columbia University and at Brookhaven National Laboratory including -Pavol Juhás, Christopher L. Farrow, Xiaohao Yang, Simon J.L. Billinge. +diffpy.structure is developed by Billinge Group +and its community contributors. For a detailed list of contributors see https://github.com/diffpy/diffpy.structure/graphs/contributors. -Acknowledgments -=============== - -Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* -originate from the pymmlib project, http://pymmlib.sourceforge.net. -Less common settings of space groups were generating using the -Computational Crystallography Toolbox, -http://cctbx.sourceforge.net. - - -.. index:: citation, reference - -Reference -========= - -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). - ============ Installation ============ @@ -65,7 +29,6 @@ file included with the distribution. ================= Table of contents ================= - .. toctree:: :titlesonly: From de0ab3787eb328c5acf4dd65ffc29bcb5973a404 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:34:22 -0400 Subject: [PATCH 09/56] Remove legacy import --- src/diffpy/Structure.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/diffpy/Structure.py diff --git a/src/diffpy/Structure.py b/src/diffpy/Structure.py deleted file mode 100644 index 1f65df4b..00000000 --- a/src/diffpy/Structure.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.structure Complex Modeling Initiative -# (c) 2017 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. -# -############################################################################## - -"""Support import of old camel-case module names with `DeprecationWarning`. - -The imported camel-case modules are aliases for the current module -instances. Their `__name__` attributes are thus all in lower-case. - -Warning -------- -This module is deprecated and will be removed in the future. -""" - - -import sys - -# install legacy import hooks -import diffpy.structure._legacy_importer - -# replace this module with the new one -sys.modules["diffpy.Structure"] = diffpy.structure - -# End of file From 0500e49af3a6addda73ad837abd5e3c225b1b2f8 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:38:30 -0400 Subject: [PATCH 10/56] Add license --- LICENSE.rst | 2 +- LICENSE_DANSE.rst | 4 +- LICENSE_pymmlib.rst | 2 +- doc/source/license.rst | 169 +++++++++++++++++++++++++++++++++-------- 4 files changed, 143 insertions(+), 34 deletions(-) diff --git a/LICENSE.rst b/LICENSE.rst index f1fe010e..2e8d4ba9 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) 2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 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: diff --git a/LICENSE_DANSE.rst b/LICENSE_DANSE.rst index c05648e1..d56af619 100644 --- a/LICENSE_DANSE.rst +++ b/LICENSE_DANSE.rst @@ -9,13 +9,13 @@ 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). -Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. All rights reserved. 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 diff --git a/LICENSE_pymmlib.rst b/LICENSE_pymmlib.rst index e0b82c94..ef484f5a 100644 --- a/LICENSE_pymmlib.rst +++ b/LICENSE_pymmlib.rst @@ -1,5 +1,5 @@ .. code-block:: text - + The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. diff --git a/doc/source/license.rst b/doc/source/license.rst index cfab61c2..39176b12 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -7,33 +7,142 @@ License OPEN SOURCE LICENSE AGREEMENT ============================= -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. + +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) 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 dc12979efd51e6765b4f0df4dfb809e2255d848e Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:40:23 -0400 Subject: [PATCH 11/56] Resolve README --- README.rst | 22 +++++----------------- doc/source/license.rst | 2 +- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index 5dd3a227..5ae201ad 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.structure/actions/workflows/main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.structure/actions/workflows/main.yml +.. |CI| image:: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov-on-merge-to-main.yml .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.structure/branch/main/graph/badge.svg :target: https://codecov.io/gh/diffpy/diffpy.structure @@ -47,6 +47,7 @@ of symmetry constraints for atom positions and displacement parameters. diffpy.structure includes definitions of all space groups in over 500 symmetry settings. + For more information about the diffpy.structure library, please consult our `online documentation `_. Citation @@ -86,11 +87,7 @@ Then, to fully install ``diffpy.structure`` 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.structure_env`` environment, we will also have to install dependencies :: - - pip install -r https://raw.githubusercontent.com/diffpy/diffpy.structure/main/requirements/run.txt - -and then install the package :: +To install using ``pip`` into your ``diffpy.structure_env`` environment, type :: pip install diffpy.structure @@ -105,7 +102,7 @@ Support and Contribute `Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.structure. Please join the diffpy.structure users community by joining the Google group. The diffpy.structure 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.structure in a development mode, with its sources being directly used by Python @@ -130,15 +127,6 @@ Improvements and fixes are always appreciated. Before contribuing, please read our `Code of Conduct `_. -Acknowledgement ---------------- - -Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* -originate from the `pymmlib project `_. - -Less common settings of space groups were generating using the -`Computational Crystallography Toolbox `_. - Contact ------- diff --git a/doc/source/license.rst b/doc/source/license.rst index 39176b12..33a363ae 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -22,7 +22,7 @@ Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory -Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 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 89e8b4686caebce54a87c738b6f22c77f4f98a31 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:41:59 -0400 Subject: [PATCH 12/56] Use existing index.rst --- doc/source/index.rst | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 54ec3695..4fabbaa1 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,21 +4,57 @@ .. |title| replace:: diffpy.structure documentation -diffpy.structure - Crystal structure container and parsers for structure formats.. +diffpy.structure - Crystal structure container and parsers for structure formats. | Software version |release|. | Last updated |today|. +The diffpy.structure package provides objects for storing atomic +coordinates, displacement parameters and other crystal structure data. +diffpy.structure supports import and export of structure data in several +structure formats such as CIF, PDB, xyz. It provides conversion +between fractional and absolute Cartesian coordinates, functions for +symmetry expansion from asymmetric unit and generation of symmetry +constraints for atom positions and displacement parameters. diffpy.structure +includes definitions of all space groups in over 500 symmetry settings. + ======= Authors ======= -diffpy.structure is developed by Billinge Group -and its community contributors. +diffpy.structure is developed by members of the Billinge Group at +Columbia University and at Brookhaven National Laboratory including +Pavol Juhás, Christopher L. Farrow, Xiaohao Yang, Simon J.L. Billinge. For a detailed list of contributors see https://github.com/diffpy/diffpy.structure/graphs/contributors. +Acknowledgments +=============== + +Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* +originate from the pymmlib project, http://pymmlib.sourceforge.net. +Less common settings of space groups were generating using the +Computational Crystallography Toolbox, +http://cctbx.sourceforge.net. + + +.. index:: citation, reference + +Reference +========= + +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). + ============ Installation ============ @@ -29,6 +65,7 @@ file included with the distribution. ================= Table of contents ================= + .. toctree:: :titlesonly: From 9a93d8ebf9ca4071aade442d64c6bf3597505a49 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:42:59 -0400 Subject: [PATCH 13/56] Add sgroup acknowledgements in readme --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 5ae201ad..076bc7e3 100644 --- a/README.rst +++ b/README.rst @@ -127,6 +127,15 @@ Improvements and fixes are always appreciated. Before contribuing, please read our `Code of Conduct `_. +Acknowledgement +--------------- + +Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* +originate from the `pymmlib project `_. + +Less common settings of space groups were generating using the +`Computational Crystallography Toolbox `_. + Contact ------- From 2e992d9fa8505bef99561a8feba7adf429c7050c Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:48:19 -0400 Subject: [PATCH 14/56] Remove older import tests --- tests/test_oldimports.py | 77 ---------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 tests/test_oldimports.py diff --git a/tests/test_oldimports.py b/tests/test_oldimports.py deleted file mode 100644 index 9c6ff11d..00000000 --- a/tests/test_oldimports.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.structure Complex Modeling Initiative -# (c) 2017 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. -# -############################################################################## - -""" -Unit tests for imports of old camel-case names. -""" - - -import importlib -import sys -import unittest -import warnings - -import diffpy - -# ---------------------------------------------------------------------------- - - -class TestOldImports(unittest.TestCase): - - @classmethod - def setUpClass(cls): - "Uncache any already-imported old modules." - for modname in tuple(sys.modules): - if modname.startswith("diffpy.Structure"): - del sys.modules[modname] # pragma: no cover - return - - def test_00TopImport(self): - """check import of diffpy.Structure""" - with warnings.catch_warnings(): - warnings.simplefilter("ignore", category=DeprecationWarning) - import diffpy.Structure as m0 - self.assertIs(diffpy.structure, m0) - # second import should raise no warning - with warnings.catch_warnings(): - warnings.simplefilter("error") - import diffpy.Structure as m1 - self.assertIs(diffpy.structure, m1) - return - - def test_O1SubmoduleImport(self): - """check import of diffpy.Structure submodules.""" - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", category=DeprecationWarning) - import diffpy.Structure.SymmetryUtilities as symutil - - self.assertIs(DeprecationWarning, w[0].category) - self.assertIs(diffpy.structure.symmetryutilities, symutil) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", category=DeprecationWarning) - import diffpy.Structure.Parsers.P_cif as pcif - - self.assertIs(DeprecationWarning, w[0].category) - self.assertIs(diffpy.structure.parsers.p_cif, pcif) - self.assertRaises(ImportError, importlib.import_module, "diffpy.Structure.SSpaceGroups") - return - - -# End of class TestOldImports - -# ---------------------------------------------------------------------------- - -if __name__ == "__main__": - unittest.main() From 4cccb7a18c6cb077e9cb9a441a16c2246675ca59 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:51:13 -0400 Subject: [PATCH 15/56] Add api generated docs --- doc/source/api/diffpy.structure.apps.rst | 1 + .../api/diffpy.structure.example_package.rst | 31 ----- doc/source/api/diffpy.structure.expansion.rst | 1 + doc/source/api/diffpy.structure.parsers.rst | 1 + doc/source/api/diffpy.structure.rst | 107 ++++++++++++++++-- 5 files changed, 101 insertions(+), 40 deletions(-) delete mode 100644 doc/source/api/diffpy.structure.example_package.rst diff --git a/doc/source/api/diffpy.structure.apps.rst b/doc/source/api/diffpy.structure.apps.rst index 8b91adf5..5ac351dd 100644 --- a/doc/source/api/diffpy.structure.apps.rst +++ b/doc/source/api/diffpy.structure.apps.rst @@ -26,3 +26,4 @@ diffpy.structure.apps.anyeye module :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.structure.example_package.rst b/doc/source/api/diffpy.structure.example_package.rst deleted file mode 100644 index 3595000a..00000000 --- a/doc/source/api/diffpy.structure.example_package.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _example_package documentation: - -|title| -======= - -.. |title| replace:: diffpy.structure.example_package package - -.. automodule:: diffpy.structure.example_package - :members: - :undoc-members: - :show-inheritance: - -|foo| ------ - -.. |foo| replace:: diffpy.structure.example_package.foo module - -.. automodule:: diffpy.structure.example_package.foo - :members: - :undoc-members: - :show-inheritance: - -|bar| ------ - -.. |bar| replace:: diffpy.structure.example_package.bar module - -.. automodule:: diffpy.structure.example_package.foo - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/diffpy.structure.expansion.rst b/doc/source/api/diffpy.structure.expansion.rst index 34529fcd..afce983c 100644 --- a/doc/source/api/diffpy.structure.expansion.rst +++ b/doc/source/api/diffpy.structure.expansion.rst @@ -34,3 +34,4 @@ diffpy.structure.expansion.supercell_mod module :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.structure.parsers.rst b/doc/source/api/diffpy.structure.parsers.rst index 74a27bcb..54a88f2e 100644 --- a/doc/source/api/diffpy.structure.parsers.rst +++ b/doc/source/api/diffpy.structure.parsers.rst @@ -90,3 +90,4 @@ diffpy.structure.parsers.p_xyz module :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.structure.rst b/doc/source/api/diffpy.structure.rst index cdcc80ea..eb13f679 100644 --- a/doc/source/api/diffpy.structure.rst +++ b/doc/source/api/diffpy.structure.rst @@ -1,9 +1,7 @@ :tocdepth: -1 -|title| -======= - -.. |title| replace:: diffpy.structure package +diffpy.structure package +======================== .. automodule:: diffpy.structure :members: @@ -14,17 +12,108 @@ Subpackages ----------- .. toctree:: - diffpy.structure.example_package + :titlesonly: + + diffpy.structure.parsers + diffpy.structure.expansion + diffpy.structure.apps Submodules ---------- -|module| --------- +diffpy.structure.spacegroups module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.spacegroups + :members: + :undoc-members: + :show-inheritance: -.. |module| replace:: diffpy.structure.example_submodule module +diffpy.structure._legacy_importer module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. automodule:: diffpy.structure.example_submodule +.. automodule:: diffpy.structure._legacy_importer :members: :undoc-members: :show-inheritance: + +diffpy.structure.structureerrors module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.structureerrors + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.spacegroupmod module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.spacegroupmod + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.utils module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.utils + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.lattice module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.lattice + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.structure module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.structure + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.mmlibspacegroups module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.mmlibspacegroups + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.symmetryutilities module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.symmetryutilities + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.atom module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.atom + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.pdffitstructure module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.pdffitstructure + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.sgtbxspacegroups module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.sgtbxspacegroups + :members: + :undoc-members: + :show-inheritance: + From d3d5456af8a6a3b256f2837af3562aa41fbc86de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:53:16 +0000 Subject: [PATCH 16/56] [pre-commit.ci] auto fixes from pre-commit hooks --- doc/source/api/diffpy.structure.apps.rst | 1 - doc/source/api/diffpy.structure.expansion.rst | 1 - doc/source/api/diffpy.structure.parsers.rst | 1 - doc/source/api/diffpy.structure.rst | 1 - 4 files changed, 4 deletions(-) diff --git a/doc/source/api/diffpy.structure.apps.rst b/doc/source/api/diffpy.structure.apps.rst index 5ac351dd..8b91adf5 100644 --- a/doc/source/api/diffpy.structure.apps.rst +++ b/doc/source/api/diffpy.structure.apps.rst @@ -26,4 +26,3 @@ diffpy.structure.apps.anyeye module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.structure.expansion.rst b/doc/source/api/diffpy.structure.expansion.rst index afce983c..34529fcd 100644 --- a/doc/source/api/diffpy.structure.expansion.rst +++ b/doc/source/api/diffpy.structure.expansion.rst @@ -34,4 +34,3 @@ diffpy.structure.expansion.supercell_mod module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.structure.parsers.rst b/doc/source/api/diffpy.structure.parsers.rst index 54a88f2e..74a27bcb 100644 --- a/doc/source/api/diffpy.structure.parsers.rst +++ b/doc/source/api/diffpy.structure.parsers.rst @@ -90,4 +90,3 @@ diffpy.structure.parsers.p_xyz module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.structure.rst b/doc/source/api/diffpy.structure.rst index eb13f679..95ff1285 100644 --- a/doc/source/api/diffpy.structure.rst +++ b/doc/source/api/diffpy.structure.rst @@ -116,4 +116,3 @@ diffpy.structure.sgtbxspacegroups module :members: :undoc-members: :show-inheritance: - From 866aa7de0508e3af26ae8193667e49587f695763 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:56:28 -0400 Subject: [PATCH 17/56] Add news item of recut.rst --- 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..973fc92b --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Recookiecut package to the group standard + +**Security:** + +* From b67fbb76f6801df52d4a979c214133f7eb4faac0 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 21:45:30 -0400 Subject: [PATCH 18/56] Remove null in matrix and codecov.yml --- .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 c1905e0d..743193f7 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -8,7 +8,7 @@ on: types: - prereleased - published - workflow_dispatch: null + workflow_dispatch: jobs: coverage: From 3fdc6d0f37a94bee228f171cd2043da85d64e12d Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 3 Oct 2024 13:02:09 -0400 Subject: [PATCH 19/56] Add pip packages under pip.txt --- news/pip.rst | 23 +++++++++++++++++++++++ pyproject.toml | 2 +- requirements/{run.txt => conda.txt} | 0 requirements/pip.txt | 2 ++ 4 files changed, 26 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 206884bf..147c3705 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..0fdcecb6 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -0,0 +1,2 @@ +numpy +pycifrw From 5e2ff1e179d956f7571b6d5730e81845f27a355c Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Fri, 4 Oct 2024 18:08:25 +0000 Subject: [PATCH 20/56] Update CHANGELOG.rst --- CHANGELOG.rst | 17 +++++++++++++++++ news/folder.rst | 23 ----------------------- news/numpy2.rst | 23 ----------------------- news/pip.rst | 23 ----------------------- news/recut.rst | 23 ----------------------- news/version-test.rst | 23 ----------------------- 6 files changed, 17 insertions(+), 115 deletions(-) delete mode 100644 news/folder.rst delete mode 100644 news/numpy2.rst delete mode 100644 news/pip.rst delete mode 100644 news/recut.rst delete mode 100644 news/version-test.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0fde0ea2..be9a82a7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,23 @@ Release Notes .. current developments +3.2.2 +===== + +**Added:** + +* Unit test for version.py +* support for numpy >=2.0 + +**Fixed:** + +* tests folder at the root of the repo +* Add pip dependencies under pip.txt and conda dependencies under conda.txt +* element/label itemsize to 5 in _linkAtomAttribute to support numpy >=2.0 +* Recookiecut package to the group standard + + + 3.2.1 ===== diff --git a/news/folder.rst b/news/folder.rst deleted file mode 100644 index 63f83284..00000000 --- a/news/folder.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* tests folder at the root of the repo - -**Security:** - -* diff --git a/news/numpy2.rst b/news/numpy2.rst deleted file mode 100644 index af1631fa..00000000 --- a/news/numpy2.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* support for numpy >=2.0 - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* element/label itemsize to 5 in _linkAtomAttribute to support numpy >=2.0 - -**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 973fc92b..00000000 --- a/news/recut.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Recookiecut package to the group standard - -**Security:** - -* diff --git a/news/version-test.rst b/news/version-test.rst deleted file mode 100644 index 05c39477..00000000 --- a/news/version-test.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Unit test for version.py - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* From 541dde4355da052fce81f586d9c29a43ba570906 Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Tue, 22 Oct 2024 23:57:46 -0400 Subject: [PATCH 21/56] recut to align with the new release process --- .github/ISSUE_TEMPLATE/bug_feature.md | 16 ++++++++++++ .github/ISSUE_TEMPLATE/release_checklist.md | 22 ++++++++++++++++ .../workflows/build-wheel-release-upload.yml | 16 ++++++++++++ README.rst | 15 ++++++++--- news/recut.rst | 25 +++++++++++++++++++ src/diffpy/__init__.py | 1 + 6 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_feature.md create mode 100644 .github/ISSUE_TEMPLATE/release_checklist.md create mode 100644 .github/workflows/build-wheel-release-upload.yml create mode 100644 news/recut.rst 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. diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml new file mode 100644 index 00000000..9eb24167 --- /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.structure + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + PAT_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/README.rst b/README.rst index 076bc7e3..9ac19161 100644 --- a/README.rst +++ b/README.rst @@ -78,14 +78,16 @@ 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.structure_env`` :: - conda create -n diffpy.structure_env python=3 + conda create -n diffpy.structure_env diffpy.structure conda activate diffpy.structure_env -Then, to fully install ``diffpy.structure`` in our active environment, run :: +To confirm that the installation was successful, type :: - conda install diffpy.structure + python -c "import diffpy.structure; print(diffpy.structure.__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.structure_env`` environment, type :: @@ -97,6 +99,11 @@ and run the following :: pip install . +Getting Started +--------------- + +You may consult our `online documentation `_ for tutorials and API references. + Support and Contribute ---------------------- diff --git a/news/recut.rst b/news/recut.rst new file mode 100644 index 00000000..153d1bb0 --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,25 @@ +**Added:** + +* Use GitHub Actions to build, release, upload to PyPI +* Added issue template for PyPI/GitHub release +* Include GitHub Issues templates for bug report and feature request + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Add getting started section and re-arrange install success check instructions + +**Security:** + +* diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index ee55ab5f..3e7952ae 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -21,3 +21,4 @@ __path__ = extend_path(__path__, __name__) # End of file + From 4aa57b34d45c38e7f2f93fa739a3dbfdfb94c353 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 04:01:42 +0000 Subject: [PATCH 22/56] [pre-commit.ci] auto fixes from pre-commit hooks --- src/diffpy/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index 3e7952ae..ee55ab5f 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -21,4 +21,3 @@ __path__ = extend_path(__path__, __name__) # End of file - From c1bfa76abcd854581ad0582671c86ca8176d4041 Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Thu, 24 Oct 2024 15:27:35 -0400 Subject: [PATCH 23/56] add app sripts, fix python version, small updates anyeye --- pyproject.toml | 5 ++++- src/diffpy/structure/apps/anyeye.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 147c3705..16875161 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ maintainers = [ description = "Crystal structure container and parsers for structure formats." keywords = ['diffpy', 'crystal structure data storage CIF PDB'] readme = "README.rst" -requires-python = ">=3.10" +requires-python = ">=3.10, < 3.13" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -36,6 +36,9 @@ classifiers = [ Homepage = "https://github.com/diffpy/diffpy.structure/" Issues = "https://github.com/diffpy/diffpy.structure/issues/" +[project.scripts] +transtru = "diffpy.structure.apps.transtru:main" + [tool.setuptools-git-versioning] enabled = true template = "{tag}" diff --git a/src/diffpy/structure/apps/anyeye.py b/src/diffpy/structure/apps/anyeye.py index fbf549ca..b7904d8e 100755 --- a/src/diffpy/structure/apps/anyeye.py +++ b/src/diffpy/structure/apps/anyeye.py @@ -265,7 +265,7 @@ def main(): spawnargs = (pd["viewer"], pd["viewer"], pd["tmpfile"], env) # load strufile in atomeye if pd["watch"]: - signal.signal(signal.SIGCLD, signalHandler) + signal.signal(signal.SIGCHLD, signalHandler) os.spawnlpe(os.P_NOWAIT, *spawnargs) watchStructureFile(pd) else: From 959e5be971c228e8c39cfa698f155d3221c411ef Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Thu, 24 Oct 2024 15:32:47 -0400 Subject: [PATCH 24/56] add news --- news/toml.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 news/toml.rst diff --git a/news/toml.rst b/news/toml.rst new file mode 100644 index 00000000..600d0d47 --- /dev/null +++ b/news/toml.rst @@ -0,0 +1,24 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Added termial script for transtru app in pyproject.toml +* Changed requires-python to align with classifiers + +**Security:** + +* From 6fa73b649fb73b267e7cede848064432d5ec81eb Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Thu, 24 Oct 2024 15:33:35 -0400 Subject: [PATCH 25/56] change <3.13 to <=3.12 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 16875161..b64a1346 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ maintainers = [ description = "Crystal structure container and parsers for structure formats." keywords = ['diffpy', 'crystal structure data storage CIF PDB'] readme = "README.rst" -requires-python = ">=3.10, < 3.13" +requires-python = ">=3.10, <=3.12" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', From 6b4a018e24cfbcf17a8a46dbfbf4c68e8b248d2f Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Thu, 24 Oct 2024 15:39:12 -0400 Subject: [PATCH 26/56] change <=3.12 back to <3.13 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b64a1346..6076df58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ maintainers = [ description = "Crystal structure container and parsers for structure formats." keywords = ['diffpy', 'crystal structure data storage CIF PDB'] readme = "README.rst" -requires-python = ">=3.10, <=3.12" +requires-python = ">=3.10, <3.13" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', From b0a034406f9ee43f47f10467689c7def9e143de6 Mon Sep 17 00:00:00 2001 From: sbillinge Date: Thu, 24 Oct 2024 21:13:20 +0000 Subject: [PATCH 27/56] update changelog --- CHANGELOG.rst | 16 ++++++++++++++++ news/recut.rst | 25 ------------------------- news/toml.rst | 24 ------------------------ 3 files changed, 16 insertions(+), 49 deletions(-) delete mode 100644 news/recut.rst delete mode 100644 news/toml.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index be9a82a7..2c9a55f7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,22 @@ Release Notes .. current developments +3.2.3 +===== + +**Added:** + +* Use GitHub Actions to build, release, upload to PyPI +* Added issue template for PyPI/GitHub release +* Include GitHub Issues templates for bug report and feature request + +**Fixed:** + +* Add getting started section and re-arrange install success check instructions +* Added termial script for transtru app in pyproject.toml +* Changed requires-python to align with classifiers + + 3.2.2 ===== diff --git a/news/recut.rst b/news/recut.rst deleted file mode 100644 index 153d1bb0..00000000 --- a/news/recut.rst +++ /dev/null @@ -1,25 +0,0 @@ -**Added:** - -* Use GitHub Actions to build, release, upload to PyPI -* Added issue template for PyPI/GitHub release -* Include GitHub Issues templates for bug report and feature request - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Add getting started section and re-arrange install success check instructions - -**Security:** - -* diff --git a/news/toml.rst b/news/toml.rst deleted file mode 100644 index 600d0d47..00000000 --- a/news/toml.rst +++ /dev/null @@ -1,24 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Added termial script for transtru app in pyproject.toml -* Changed requires-python to align with classifiers - -**Security:** - -* From aac7cf39e22701dbb149c3b1faa5c1917bcbc2dd Mon Sep 17 00:00:00 2001 From: Tieqiong Zhang Date: Thu, 24 Oct 2024 22:39:59 -0400 Subject: [PATCH 28/56] Support Python 3.13, drop 3.10 --- news/3.13.rst | 23 +++++++++++++++++++++++ pyproject.toml | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 news/3.13.rst diff --git a/news/3.13.rst b/news/3.13.rst new file mode 100644 index 00000000..afb325da --- /dev/null +++ b/news/3.13.rst @@ -0,0 +1,23 @@ +**Added:** + +* Support for Python 3.13 + +**Changed:** + +* + +**Deprecated:** + +* Support for Python 3.10 + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 6076df58..dd1150c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ maintainers = [ description = "Crystal structure container and parsers for structure formats." keywords = ['diffpy', 'crystal structure data storage CIF PDB'] readme = "README.rst" -requires-python = ">=3.10, <3.13" +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 4b7ba36ea879bd492630efa1b8a86f0dcd1e0f99 Mon Sep 17 00:00:00 2001 From: sbillinge Date: Sat, 26 Oct 2024 20:32:44 +0000 Subject: [PATCH 29/56] update changelog --- CHANGELOG.rst | 12 ++++++++++++ news/3.13.rst | 23 ----------------------- 2 files changed, 12 insertions(+), 23 deletions(-) delete mode 100644 news/3.13.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2c9a55f7..2bf42c49 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,18 @@ Release Notes .. current developments +3.3.0 +===== + +**Added:** + +* Support for Python 3.13 + +**Deprecated:** + +* Support for Python 3.10 + + 3.2.3 ===== diff --git a/news/3.13.rst b/news/3.13.rst deleted file mode 100644 index afb325da..00000000 --- a/news/3.13.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Support for Python 3.13 - -**Changed:** - -* - -**Deprecated:** - -* Support for Python 3.10 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* From 3eb963d9d9c4ead06177266e05d46605c1702188 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 7 Nov 2024 21:39:43 -0500 Subject: [PATCH 30/56] Add news, codecov, codespell --- .codecov.yml | 42 +++++-------------- .codespell/ignore_lines.txt | 2 + .codespell/ignore_words.txt | 11 +++++ .coveragerc | 13 ------ .github/ISSUE_TEMPLATE/release_checklist.md | 14 +++++-- .../workflows/build-wheel-release-upload.yml | 2 +- .github/workflows/publish-docs-on-release.yml | 14 ------- .github/workflows/tests-on-pr.yml | 2 + news/codecov.rst | 24 +++++++++++ 9 files changed, 61 insertions(+), 63 deletions(-) create mode 100644 .codespell/ignore_lines.txt create mode 100644 .codespell/ignore_words.txt delete mode 100644 .coveragerc delete mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 news/codecov.rst diff --git a/.codecov.yml b/.codecov.yml index 04dd6510..5a94096e 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,34 +1,14 @@ -# codecov can find this file anywhere in the repo, so we don't need to clutter -# the root folder. -#comment: false - -codecov: - notify: - require_ci_to_pass: no - coverage: status: - patch: + project: # more options at https://docs.codecov.com/docs/commit-status default: - target: '70' - if_no_uploads: error - if_not_found: success - if_ci_failed: failure - project: - default: false - library: - target: auto - if_no_uploads: error - if_not_found: success - if_ci_failed: error - paths: '!*/tests/.*' - - tests: - target: 97.9% - paths: '*/tests/.*' - if_not_found: success - -flags: - tests: - paths: - - tests/ + target: auto # use the coverage from the base commit, fail if coverage is lower + threshold: 0% # allow the coverage to drop by + +comment: + layout: " diff, flags, files" + behavior: default + require_changes: false + require_base: false # [true :: must have a base report to post] + require_head: false # [true :: must have a head report to post] + hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage] 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/.coveragerc b/.coveragerc deleted file mode 100644 index 34ea3e4c..00000000 --- a/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -source = - diffpy.structure -[report] -omit = - */python?.?/* - */site-packages/nose/* - # ignore _version.py and versioneer.py - .*version.* - *_version.py - -exclude_lines = - if __name__ == '__main__': diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md index a87a44a8..b96c782d 100644 --- a/.github/ISSUE_TEMPLATE/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -13,10 +13,16 @@ assignees: "" - [ ] 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. +- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) updated. +- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version - [ ] 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. +version information and details about the pre-release here: + +### Post-release checklist + +Before closing this issue, please complete the following: + +- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. +- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml index 9eb24167..c89ca95c 100644 --- a/.github/workflows/build-wheel-release-upload.yml +++ b/.github/workflows/build-wheel-release-upload.yml @@ -1,4 +1,4 @@ -name: Release (GitHub/PyPI) +name: Release (GitHub/PyPI) and Deploy Docs on: workflow_dispatch: diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml deleted file mode 100644 index 1c5981db..00000000 --- a/.github/workflows/publish-docs-on-release.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Build and Deploy Docs - -on: - release: - types: - - published - workflow_dispatch: - -jobs: - docs: - uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 - with: - project: diffpy.structure - c_extension: false diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index 614b16f2..1dd2ee1b 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -14,3 +14,5 @@ jobs: project: diffpy.structure c_extension: false headless: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/news/codecov.rst b/news/codecov.rst new file mode 100644 index 00000000..1c91077e --- /dev/null +++ b/news/codecov.rst @@ -0,0 +1,24 @@ +**Added:** + +* Spelling check via Codespell in pre-commit +* Coverage report in each PR + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From bb873328e40427d43eac9d8b4c2f2b72572390db Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sat, 9 Nov 2024 16:10:59 -0500 Subject: [PATCH 31/56] Add conda-forge release checklist to GitHub Issue template --- .github/ISSUE_TEMPLATE/release_checklist.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md index b96c782d..0f560278 100644 --- a/.github/ISSUE_TEMPLATE/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -6,23 +6,30 @@ labels: "release" assignees: "" --- -### Release checklist for GitHub contributors +### PyPI/GitHub release checklist: - [ ] 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) updated. -- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version -- [ ] Grammar and writing quality have been checked (no typos). +- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) are updated. +- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version. +- [ ] Grammar and writing quality are checked (no typos). -Please mention @sbillinge when you are ready for release. Include any additional comments necessary, such as +Please mention @sbillinge here when you are ready for PyPI/GitHub release. Include any additional comments necessary, such as version information and details about the pre-release here: +### conda-forge release checklist: + + + +- [ ] New package dependencies listed in `conda.txt` and `test.txt` are added to `meta.yaml` in the feedstock. +- [ ] All relevant issues in the feedstock are addressed in the release PR. + ### Post-release checklist -Before closing this issue, please complete the following: + -- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. +- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments. - [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. From a3a6d267792b06ea71b167df8c40aa2ffead4de4 Mon Sep 17 00:00:00 2001 From: Tingwen Zhang Date: Sun, 1 Jun 2025 15:34:17 -0400 Subject: [PATCH 32/56] chored: fixed all static files --- CODE_OF_CONDUCT.rst => CODE-OF-CONDUCT.rst | 0 LICENSE_DANSE.rst => LICENSE-DANSE.rst | 0 LICENSE_pymmlib.rst => LICENSE-pymmlib.rst | 0 doc/source/{mod_atom.rst => mod-atom.rst} | 0 doc/source/{mod_lattice.rst => mod-lattice.rst} | 0 doc/source/{mod_spacegroup.rst => mod-spacegroup.rst} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename CODE_OF_CONDUCT.rst => CODE-OF-CONDUCT.rst (100%) rename LICENSE_DANSE.rst => LICENSE-DANSE.rst (100%) rename LICENSE_pymmlib.rst => LICENSE-pymmlib.rst (100%) rename doc/source/{mod_atom.rst => mod-atom.rst} (100%) rename doc/source/{mod_lattice.rst => mod-lattice.rst} (100%) rename doc/source/{mod_spacegroup.rst => mod-spacegroup.rst} (100%) diff --git a/CODE_OF_CONDUCT.rst b/CODE-OF-CONDUCT.rst similarity index 100% rename from CODE_OF_CONDUCT.rst rename to CODE-OF-CONDUCT.rst diff --git a/LICENSE_DANSE.rst b/LICENSE-DANSE.rst similarity index 100% rename from LICENSE_DANSE.rst rename to LICENSE-DANSE.rst diff --git a/LICENSE_pymmlib.rst b/LICENSE-pymmlib.rst similarity index 100% rename from LICENSE_pymmlib.rst rename to LICENSE-pymmlib.rst diff --git a/doc/source/mod_atom.rst b/doc/source/mod-atom.rst similarity index 100% rename from doc/source/mod_atom.rst rename to doc/source/mod-atom.rst diff --git a/doc/source/mod_lattice.rst b/doc/source/mod-lattice.rst similarity index 100% rename from doc/source/mod_lattice.rst rename to doc/source/mod-lattice.rst diff --git a/doc/source/mod_spacegroup.rst b/doc/source/mod-spacegroup.rst similarity index 100% rename from doc/source/mod_spacegroup.rst rename to doc/source/mod-spacegroup.rst From cd7ddd384b6ae863429e4efc4e92e17045166c45 Mon Sep 17 00:00:00 2001 From: Tingwen Zhang Date: Sun, 1 Jun 2025 15:38:23 -0400 Subject: [PATCH 33/56] chored: updated the link in README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 9ac19161..cf7020c2 100644 --- a/README.rst +++ b/README.rst @@ -132,7 +132,7 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contribuing, please read our `Code of Conduct `_. +Before contribuing, please read our `Code of Conduct `_. Acknowledgement --------------- From 2351e86f0d4057f39a0f25f3a5baedfe2754638e Mon Sep 17 00:00:00 2001 From: Kai Wagoner-Oshima Date: Sat, 7 Jun 2025 01:31:35 -0400 Subject: [PATCH 34/56] skpkg: apply black to all files in the project directory --- src/diffpy/structure/apps/__init__.py | 3 +-- src/diffpy/structure/expansion/supercell_mod.py | 3 +-- src/diffpy/structure/mmlibspacegroups.py | 3 +-- src/diffpy/structure/parsers/p_discus.py | 3 +-- src/diffpy/structure/parsers/p_pdffit.py | 3 +-- src/diffpy/structure/parsers/p_xyz.py | 6 +++--- src/diffpy/structure/parsers/structureparser.py | 3 +-- src/diffpy/structure/pdffitstructure.py | 3 +-- src/diffpy/structure/spacegroupmod.py | 3 +-- src/diffpy/structure/structure.py | 3 +-- src/diffpy/structure/structureerrors.py | 3 +-- src/diffpy/structure/utils.py | 3 +-- tests/test_lattice.py | 3 +-- tests/test_loadstructure.py | 3 +-- tests/test_p_cif.py | 3 +-- tests/test_p_discus.py | 3 +-- tests/test_p_pdffit.py | 3 +-- tests/test_parsers.py | 3 +-- tests/test_spacegroups.py | 3 +-- tests/test_structure.py | 3 +-- tests/test_supercell.py | 3 +-- tests/test_symmetryutilities.py | 3 +-- tests/test_version.py | 3 +-- 23 files changed, 25 insertions(+), 47 deletions(-) diff --git a/src/diffpy/structure/apps/__init__.py b/src/diffpy/structure/apps/__init__.py index 6f0249a8..15ad4702 100644 --- a/src/diffpy/structure/apps/__init__.py +++ b/src/diffpy/structure/apps/__init__.py @@ -13,5 +13,4 @@ # ############################################################################## -"""Script applications that use the `diffpy.structure` package. -""" +"""Script applications that use the `diffpy.structure` package.""" diff --git a/src/diffpy/structure/expansion/supercell_mod.py b/src/diffpy/structure/expansion/supercell_mod.py index b5760a3b..dee99d95 100644 --- a/src/diffpy/structure/expansion/supercell_mod.py +++ b/src/diffpy/structure/expansion/supercell_mod.py @@ -13,8 +13,7 @@ # ############################################################################## -"""This module contains functions for simple `Structure` manipulation. -""" +"""This module contains functions for simple `Structure` manipulation.""" import numpy diff --git a/src/diffpy/structure/mmlibspacegroups.py b/src/diffpy/structure/mmlibspacegroups.py index faa5ce2d..1acd2662 100644 --- a/src/diffpy/structure/mmlibspacegroups.py +++ b/src/diffpy/structure/mmlibspacegroups.py @@ -3,8 +3,7 @@ # This code is part of the PyMMLib distribution and governed by # its license.Please see the LICENSE_pymmlib file that should have been # included as part of this package. -"""Space groups defined as a part of the pymmlib. -""" +"""Space groups defined as a part of the pymmlib.""" from diffpy.structure.spacegroupmod import ( Rot_mX_mXY_mZ, diff --git a/src/diffpy/structure/parsers/p_discus.py b/src/diffpy/structure/parsers/p_discus.py index 3ee7e5fd..c7185cd8 100644 --- a/src/diffpy/structure/parsers/p_discus.py +++ b/src/diffpy/structure/parsers/p_discus.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Parser for DISCUS structure format -""" +"""Parser for DISCUS structure format""" import sys from functools import reduce diff --git a/src/diffpy/structure/parsers/p_pdffit.py b/src/diffpy/structure/parsers/p_pdffit.py index 692c417f..7fb7a56e 100644 --- a/src/diffpy/structure/parsers/p_pdffit.py +++ b/src/diffpy/structure/parsers/p_pdffit.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Parser for PDFfit structure format -""" +"""Parser for PDFfit structure format""" import sys from functools import reduce diff --git a/src/diffpy/structure/parsers/p_xyz.py b/src/diffpy/structure/parsers/p_xyz.py index cd540a90..9d19e0c6 100644 --- a/src/diffpy/structure/parsers/p_xyz.py +++ b/src/diffpy/structure/parsers/p_xyz.py @@ -15,9 +15,9 @@ """Parser for XYZ file format, where - * First line gives number of atoms. - * Second line has optional title. - * Remaining lines contain element, `x, y, z`. +* First line gives number of atoms. +* Second line has optional title. +* Remaining lines contain element, `x, y, z`. """ import sys diff --git a/src/diffpy/structure/parsers/structureparser.py b/src/diffpy/structure/parsers/structureparser.py index 2b748664..7a3ee3a3 100644 --- a/src/diffpy/structure/parsers/structureparser.py +++ b/src/diffpy/structure/parsers/structureparser.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Definition of StructureParser, a base class for specific parsers. -""" +"""Definition of StructureParser, a base class for specific parsers.""" class StructureParser(object): diff --git a/src/diffpy/structure/pdffitstructure.py b/src/diffpy/structure/pdffitstructure.py index cc3b66d1..414b10b9 100644 --- a/src/diffpy/structure/pdffitstructure.py +++ b/src/diffpy/structure/pdffitstructure.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Definition of PDFFitStructure class derived from Structure -""" +"""Definition of PDFFitStructure class derived from Structure""" from diffpy.structure.structure import Structure diff --git a/src/diffpy/structure/spacegroupmod.py b/src/diffpy/structure/spacegroupmod.py index c31b7cae..42fab5cf 100644 --- a/src/diffpy/structure/spacegroupmod.py +++ b/src/diffpy/structure/spacegroupmod.py @@ -3,8 +3,7 @@ # This code is part of the PyMMLib distribution and governed by # its license. Please see the LICENSE_pymmlib file that should have been # included as part of this package. -"""Symmetry operations as functions on vectors or arrays. -""" +"""Symmetry operations as functions on vectors or arrays.""" import numpy diff --git a/src/diffpy/structure/structure.py b/src/diffpy/structure/structure.py index f0cb515c..aee9ed75 100644 --- a/src/diffpy/structure/structure.py +++ b/src/diffpy/structure/structure.py @@ -13,8 +13,7 @@ # ############################################################################## -"""This module defines class `Structure`. -""" +"""This module defines class `Structure`.""" import codecs import copy as copymod diff --git a/src/diffpy/structure/structureerrors.py b/src/diffpy/structure/structureerrors.py index c930b9b7..89679369 100644 --- a/src/diffpy/structure/structureerrors.py +++ b/src/diffpy/structure/structureerrors.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Exceptions used in Structure package. -""" +"""Exceptions used in Structure package.""" class StructureFormatError(Exception): diff --git a/src/diffpy/structure/utils.py b/src/diffpy/structure/utils.py index e5fa3ce3..4fcee682 100644 --- a/src/diffpy/structure/utils.py +++ b/src/diffpy/structure/utils.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Small shared functions. -""" +"""Small shared functions.""" from collections.abc import Iterable as _Iterable diff --git a/tests/test_lattice.py b/tests/test_lattice.py index a2b22d38..c562d202 100644 --- a/tests/test_lattice.py +++ b/tests/test_lattice.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for Lattice class. -""" +"""Unit tests for Lattice class.""" import unittest diff --git a/tests/test_loadstructure.py b/tests/test_loadstructure.py index 4f099c7d..ad197420 100644 --- a/tests/test_loadstructure.py +++ b/tests/test_loadstructure.py @@ -1,7 +1,6 @@ #!/usr/bin/env python -"""Unit tests for the loadStructure factory. -""" +"""Unit tests for the loadStructure factory.""" import unittest diff --git a/tests/test_p_cif.py b/tests/test_p_cif.py index 62bb25db..d21b2597 100644 --- a/tests/test_p_cif.py +++ b/tests/test_p_cif.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for diffpy.structure.parsers.p_cif module -""" +"""Unit tests for diffpy.structure.parsers.p_cif module""" import unittest diff --git a/tests/test_p_discus.py b/tests/test_p_discus.py index 8959718e..83f4494e 100644 --- a/tests/test_p_discus.py +++ b/tests/test_p_discus.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for diffpy.structure.parsers.p_discus module -""" +"""Unit tests for diffpy.structure.parsers.p_discus module""" import re import unittest diff --git a/tests/test_p_pdffit.py b/tests/test_p_pdffit.py index f993cb4b..b33b6549 100644 --- a/tests/test_p_pdffit.py +++ b/tests/test_p_pdffit.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for diffpy.structure.parsers.p_pdffit module -""" +"""Unit tests for diffpy.structure.parsers.p_pdffit module""" import re import unittest diff --git a/tests/test_parsers.py b/tests/test_parsers.py index a3f7f3c1..55c5244d 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for structure.parsers module. -""" +"""Unit tests for structure.parsers module.""" import os import re diff --git a/tests/test_spacegroups.py b/tests/test_spacegroups.py index c9980e17..996a73d4 100644 --- a/tests/test_spacegroups.py +++ b/tests/test_spacegroups.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for diffpy.structure.spacegroups -""" +"""Unit tests for diffpy.structure.spacegroups""" import unittest diff --git a/tests/test_structure.py b/tests/test_structure.py index 9c1a6308..d79f5ed3 100644 --- a/tests/test_structure.py +++ b/tests/test_structure.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for Structure class. -""" +"""Unit tests for Structure class.""" import copy diff --git a/tests/test_supercell.py b/tests/test_supercell.py index 0e840dfa..68aa8092 100644 --- a/tests/test_supercell.py +++ b/tests/test_supercell.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for supercell.py -""" +"""Unit tests for supercell.py""" import unittest diff --git a/tests/test_symmetryutilities.py b/tests/test_symmetryutilities.py index c4de983b..377f7554 100644 --- a/tests/test_symmetryutilities.py +++ b/tests/test_symmetryutilities.py @@ -13,8 +13,7 @@ # ############################################################################## -"""Unit tests for SymmetryUtilities.py -""" +"""Unit tests for SymmetryUtilities.py""" import re import sys diff --git a/tests/test_version.py b/tests/test_version.py index e62433e1..de45655e 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,5 +1,4 @@ -"""Unit tests for __version__.py -""" +"""Unit tests for __version__.py""" import diffpy.structure From 5788f4f55392db1756d3ada7849c321761562625 Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 12:54:07 -0400 Subject: [PATCH 35/56] skpkg: linter config files; pyproject.toml --- .flake8 | 2 ++ .isort.cfg | 1 + pyproject.toml | 22 ++++++++++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.flake8 b/.flake8 index 2d2cb168..04d2d0b0 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,5 @@ +# As of now, flake8 does not natively support configuration via pyproject.toml +# https://github.com/microsoft/vscode-flake8/issues/135 [flake8] exclude = .git, diff --git a/.isort.cfg b/.isort.cfg index e0926f42..7ce0fb1f 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,4 +1,5 @@ [settings] +# Keep import statement below line_length character limit line_length = 115 multi_line_output = 3 include_trailing_comma = True diff --git a/pyproject.toml b/pyproject.toml index dd1150c9..46176534 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,13 +6,13 @@ build-backend = "setuptools.build_meta" name = "diffpy.structure" dynamic=['version', 'dependencies'] authors = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, + { name="Simon Billinge", email="sb2896@columbia.edu" }, ] maintainers = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, + { name="Simon Billinge", email="sb2896@columbia.edu" }, ] description = "Crystal structure container and parsers for structure formats." -keywords = ['diffpy', 'crystal structure data storage CIF PDB'] +keywords = ['diffpy', 'crystal structure data storage', 'CIF', 'PDB'] readme = "README.rst" requires-python = ">=3.11, <3.14" classifiers = [ @@ -32,13 +32,13 @@ classifiers = [ 'Topic :: Scientific/Engineering :: Chemistry', ] +[project.scripts] +transtru = "diffpy.structure.apps.transtru:main" + [project.urls] Homepage = "https://github.com/diffpy/diffpy.structure/" Issues = "https://github.com/diffpy/diffpy.structure/issues/" -[project.scripts] -transtru = "diffpy.structure.apps.transtru:main" - [tool.setuptools-git-versioning] enabled = true template = "{tag}" @@ -54,6 +54,16 @@ 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.docformatter] +recursive = true +wrap-summaries = 72 +wrap-descriptions = 72 + [tool.black] line-length = 115 include = '\.pyi?$' From 8f15f932838b81e7ba17b41d8fa071140589f37a Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 13:00:13 -0400 Subject: [PATCH 36/56] skpkg: init and version files --- src/diffpy/__init__.py | 11 +---------- src/diffpy/structure/version.py | 7 +++---- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index ee55ab5f..7ecfc294 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2024-2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # # File coded by: Billinge Group members and community contributors. @@ -12,12 +12,3 @@ # See LICENSE.rst for license information. # ############################################################################## - -"""Blank namespace package for module diffpy.""" - - -from pkgutil import extend_path - -__path__ = extend_path(__path__, __name__) - -# End of file diff --git a/src/diffpy/structure/version.py b/src/diffpy/structure/version.py index be7f6a2d..605c9101 100644 --- a/src/diffpy/structure/version.py +++ b/src/diffpy/structure/version.py @@ -1,18 +1,17 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2024-2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # -# File coded by: Billinge Group members and community contributors. +# File coded by: Chris Farrow, Pavol Juhas, Simon Billinge, Billinge Group members. # # See GitHub contributions for a more detailed list of contributors. -# https://github.com/diffpy/diffpy.structure/graphs/contributors +# https://github.com/diffpy/diffpy.structure/graphs/contributors # noqa: E501 # # See LICENSE.rst for license information. # ############################################################################## - """Definition of __version__.""" # We do not use the other three variables, but can be added back if needed. From 19d7d4c9d43701986f7dd77abde2848723a7cc03 Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 13:06:16 -0400 Subject: [PATCH 37/56] skpkg: structure/__init__.py --- src/diffpy/structure/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index f8106490..e736f8bf 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -1,10 +1,10 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2024-2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # -# File coded by: Billinge Group members and community contributors. +# File coded by: Chris Farrow, Pavol Juhas, Simon Billinge, Billinge Group members. # # See GitHub contributions for a more detailed list of contributors. # https://github.com/diffpy/diffpy.structure/graphs/contributors From fb7d421705685b2872ceae494a0423bb759107c7 Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 13:10:31 -0400 Subject: [PATCH 38/56] skpkg: tests/test_version.py --- tests/test_version.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_version.py b/tests/test_version.py index de45655e..5d55a864 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,9 +1,10 @@ -"""Unit tests for __version__.py""" +"""Unit tests for __version__.py.""" -import diffpy.structure +import diffpy.structure # noqa def test_package_version(): - """Ensure the package version is defined and not set to the initial placeholder.""" + """Ensure the package version is defined and not set to the initial + placeholder.""" assert hasattr(diffpy.structure, "__version__") assert diffpy.structure.__version__ != "0.0.0" From 1acf3f484d7988834c6db4fa21e3b8eef4b99bac Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 13:16:04 -0400 Subject: [PATCH 39/56] skpkg: docformatter --- src/diffpy/structure/__init__.py | 4 +- src/diffpy/structure/_legacy_importer.py | 6 +- src/diffpy/structure/apps/__init__.py | 1 - src/diffpy/structure/apps/anyeye.py | 9 +-- src/diffpy/structure/apps/transtru.py | 4 +- src/diffpy/structure/atom.py | 18 +++-- src/diffpy/structure/expansion/__init__.py | 1 - .../structure/expansion/makeellipsoid.py | 4 +- src/diffpy/structure/expansion/shapeutils.py | 1 - .../structure/expansion/supercell_mod.py | 7 +- src/diffpy/structure/lattice.py | 7 +- src/diffpy/structure/parsers/__init__.py | 1 - src/diffpy/structure/parsers/p_auto.py | 14 ++-- src/diffpy/structure/parsers/p_cif.py | 20 +++-- src/diffpy/structure/parsers/p_discus.py | 7 +- src/diffpy/structure/parsers/p_pdb.py | 6 +- src/diffpy/structure/parsers/p_pdffit.py | 3 +- src/diffpy/structure/parsers/p_rawxyz.py | 5 +- src/diffpy/structure/parsers/p_xcfg.py | 7 +- src/diffpy/structure/parsers/p_xyz.py | 3 +- .../structure/parsers/parser_index_mod.py | 1 - .../structure/parsers/structureparser.py | 1 - src/diffpy/structure/pdffitstructure.py | 3 +- src/diffpy/structure/sgtbxspacegroups.py | 6 +- src/diffpy/structure/spacegroupmod.py | 6 +- src/diffpy/structure/spacegroups.py | 8 +- src/diffpy/structure/structure.py | 38 +++++---- src/diffpy/structure/structureerrors.py | 1 - src/diffpy/structure/symmetryutilities.py | 50 +++++++----- src/diffpy/structure/utils.py | 4 +- tests/test_atom.py | 9 +-- tests/test_lattice.py | 23 +++--- tests/test_loadstructure.py | 14 ++-- tests/test_p_cif.py | 18 ++--- tests/test_p_discus.py | 15 ++-- tests/test_p_pdffit.py | 23 +++--- tests/test_parsers.py | 35 ++++---- tests/test_spacegroups.py | 3 +- tests/test_structure.py | 80 +++++++++---------- tests/test_supercell.py | 9 +-- tests/test_symmetryutilities.py | 38 ++++----- 41 files changed, 258 insertions(+), 255 deletions(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index e736f8bf..e66c0879 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -12,9 +12,7 @@ # See LICENSE.rst for license information. # ############################################################################## - -""" -Crystal structure container and parsers for structure formats. +"""Crystal structure container and parsers for structure formats. Classes related to the structure of materials: * Atom diff --git a/src/diffpy/structure/_legacy_importer.py b/src/diffpy/structure/_legacy_importer.py index e37a907f..56123c60 100644 --- a/src/diffpy/structure/_legacy_importer.py +++ b/src/diffpy/structure/_legacy_importer.py @@ -12,9 +12,8 @@ # See LICENSE.txt for license information. # ############################################################################## - -""" -Support import of old camel-case module names with DeprecationWarning. +"""Support import of old camel-case module names with +DeprecationWarning. The imported camel-case modules are aliases for the current module instances. Their `__name__` attributes are thus all in lower-case. @@ -61,6 +60,7 @@ def find_spec(self, fullname, path=None, target=None): class MapRenamedStructureModule(importlib.abc.Loader): """Loader for old camel-case module names. + Import the current module and alias it under the old name. """ diff --git a/src/diffpy/structure/apps/__init__.py b/src/diffpy/structure/apps/__init__.py index 15ad4702..98aa2feb 100644 --- a/src/diffpy/structure/apps/__init__.py +++ b/src/diffpy/structure/apps/__init__.py @@ -12,5 +12,4 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Script applications that use the `diffpy.structure` package.""" diff --git a/src/diffpy/structure/apps/anyeye.py b/src/diffpy/structure/apps/anyeye.py index b7904d8e..39122fee 100755 --- a/src/diffpy/structure/apps/anyeye.py +++ b/src/diffpy/structure/apps/anyeye.py @@ -12,9 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -""" -Anyeye view structure file in atomeye. +"""Anyeye view structure file in atomeye. Usage: ``anyeye [options] strufile`` @@ -65,7 +63,8 @@ def usage(style=None): - """Show usage info, for ``style=="brief"`` show only first 2 lines.""" + """Show usage info, for ``style=="brief"`` show only first 2 + lines.""" import os.path myname = os.path.basename(sys.argv[0]) @@ -175,7 +174,7 @@ def cleanUp(pd): def parseFormula(formula): - """Parse chemical formula and return a list of elements""" + """Parse chemical formula and return a list of elements.""" # remove all blanks formula = re.sub(r"\s", "", formula) if not re.match("^[A-Z]", formula): diff --git a/src/diffpy/structure/apps/transtru.py b/src/diffpy/structure/apps/transtru.py index 86c682db..4c8af03a 100755 --- a/src/diffpy/structure/apps/transtru.py +++ b/src/diffpy/structure/apps/transtru.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Translate structure file to different format. Usage: ``transtru INFMT..OUTFMT strufile`` @@ -44,7 +43,8 @@ def usage(style=None): - """Show usage info, for ``style=="brief"`` show only first 2 lines.""" + """Show usage info, for ``style=="brief"`` show only first 2 + lines.""" import os.path myname = os.path.basename(sys.argv[0]) diff --git a/src/diffpy/structure/atom.py b/src/diffpy/structure/atom.py index e531780b..beac9e7b 100644 --- a/src/diffpy/structure/atom.py +++ b/src/diffpy/structure/atom.py @@ -12,10 +12,8 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -""" -Provide class Atom for managing properties of an atom in structure model. -""" +"""Provide class Atom for managing properties of an atom in structure +model.""" import numpy @@ -176,7 +174,8 @@ def msdLat(self, vl): return msd def msdCart(self, vc): - """Calculate mean square displacement along the Cartesian vector. + """Calculate mean square displacement along the Cartesian + vector. Parameters ---------- @@ -252,7 +251,8 @@ def __copy__(self, target=None): @property def xyz_cartn(self): - """numpy.ndarray: Atom position in absolute Cartesian coordinates. + """numpy.ndarray: Atom position in absolute Cartesian + coordinates. This is computed from fractional coordinates `xyz` and the current `lattice` setup. Assignment to *xyz_cartn* or @@ -301,7 +301,8 @@ def anisotropy(self, value): @property def U(self): - """numpy.ndarray : The 3x3 matrix of anisotropic atomic displacements. + """numpy.ndarray : The 3x3 matrix of anisotropic atomic + displacements. For isotropic displacements (when `anisotropy` is ``False``) assignment to *U* uses only the first ``Unew[0, 0]`` element @@ -537,7 +538,8 @@ def __setitem__(self, idx, value): return def __array_wrap__(self, out_arr, context=None, return_scalar=None): - """Ensure math operations on this type yield standard numpy array.""" + """Ensure math operations on this type yield standard numpy + array.""" return out_arr.view(numpy.ndarray) diff --git a/src/diffpy/structure/expansion/__init__.py b/src/diffpy/structure/expansion/__init__.py index faa60ca3..8e6d02c1 100644 --- a/src/diffpy/structure/expansion/__init__.py +++ b/src/diffpy/structure/expansion/__init__.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Methods and classes for manipulating `Structure` instances. Package content: diff --git a/src/diffpy/structure/expansion/makeellipsoid.py b/src/diffpy/structure/expansion/makeellipsoid.py index 009be577..547096c2 100644 --- a/src/diffpy/structure/expansion/makeellipsoid.py +++ b/src/diffpy/structure/expansion/makeellipsoid.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Make a spheroid nanoparticle from a template structure.""" from math import ceil @@ -42,8 +41,7 @@ def makeSphere(S, radius): def makeEllipsoid(S, a, b=None, c=None): - """ - Cut a `Structure` out of another one. + """Cut a `Structure` out of another one. Parameters ---------- diff --git a/src/diffpy/structure/expansion/shapeutils.py b/src/diffpy/structure/expansion/shapeutils.py index 0e99df05..12ba80d6 100644 --- a/src/diffpy/structure/expansion/shapeutils.py +++ b/src/diffpy/structure/expansion/shapeutils.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Utilities for making shapes.""" diff --git a/src/diffpy/structure/expansion/supercell_mod.py b/src/diffpy/structure/expansion/supercell_mod.py index dee99d95..44d55408 100644 --- a/src/diffpy/structure/expansion/supercell_mod.py +++ b/src/diffpy/structure/expansion/supercell_mod.py @@ -12,8 +12,8 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""This module contains functions for simple `Structure` manipulation.""" +"""This module contains functions for simple `Structure` +manipulation.""" import numpy @@ -21,8 +21,7 @@ def supercell(S, mno): - """ - Perform supercell expansion for a `Structure`. + """Perform supercell expansion for a `Structure`. New `lattice` parameters are multiplied and fractional coordinates divided by corresponding multiplier. New `Atoms` are grouped with diff --git a/src/diffpy/structure/lattice.py b/src/diffpy/structure/lattice.py index fb51de04..5a623208 100644 --- a/src/diffpy/structure/lattice.py +++ b/src/diffpy/structure/lattice.py @@ -12,9 +12,8 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Class Lattice stores properties and provides simple operations in lattice -coordinate system. +"""Class Lattice stores properties and provides simple operations in +lattice coordinate system. Attributes ---------- @@ -442,6 +441,7 @@ def setLatBase(self, base): def abcABG(self): """Return the cell parameters in the standard setting. + Returns ------- tuple : @@ -452,6 +452,7 @@ def abcABG(self): def reciprocal(self): """Return the reciprocal lattice of the current lattice. + Returns ------- Lattice diff --git a/src/diffpy/structure/parsers/__init__.py b/src/diffpy/structure/parsers/__init__.py index 0d549b80..cb9bd4f8 100644 --- a/src/diffpy/structure/parsers/__init__.py +++ b/src/diffpy/structure/parsers/__init__.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Conversion plugins for various structure formats. The recognized structure formats are defined by subclassing `StructureParser`, diff --git a/src/diffpy/structure/parsers/p_auto.py b/src/diffpy/structure/parsers/p_auto.py index 745eb5a9..ab688987 100644 --- a/src/diffpy/structure/parsers/p_auto.py +++ b/src/diffpy/structure/parsers/p_auto.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Parser for automatic file format detection. This Parser does not provide the the `toLines()` method. @@ -54,6 +53,7 @@ def __init__(self, **kw): # parseLines helpers def _getOrderedFormats(self): """Build a list of relevance ordered structure formats. + This only works when `self.filename` has a known extension. """ from diffpy.structure.parsers import inputFormats @@ -77,7 +77,8 @@ def _getOrderedFormats(self): return ofmts def parseLines(self, lines): - """Detect format and create `Structure` instance from a list of lines. + """Detect format and create `Structure` instance from a list of + lines. Set format attribute to the detected file format. @@ -119,7 +120,8 @@ def parse(self, s): return self._wrapParseMethod("parse", s) def parseFile(self, filename): - """Detect format and create Structure instance from an existing file. + """Detect format and create Structure instance from an existing + file. Set format attribute to the detected file format. @@ -144,9 +146,9 @@ def parseFile(self, filename): return self._wrapParseMethod("parseFile", filename) def _wrapParseMethod(self, method, *args, **kwargs): - """A helper evaluator method that try the specified parse method with - each registered structure parser and return the first successful - resul. + """A helper evaluator method that try the specified parse method + with each registered structure parser and return the first + successful resul. Structure parsers that match structure file extension are tried first. diff --git a/src/diffpy/structure/parsers/p_cif.py b/src/diffpy/structure/parsers/p_cif.py index 6fba3b44..cb2f3fa1 100644 --- a/src/diffpy/structure/parsers/p_cif.py +++ b/src/diffpy/structure/parsers/p_cif.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Parser for basic CIF file format. Attributes @@ -267,7 +266,8 @@ def _tr_atom_site_aniso_B_23(a, value): _tr_atom_site_aniso_B_23 = staticmethod(_tr_atom_site_aniso_B_23) def _get_atom_setters(cifloop): - """Static method for finding translators of CifLoop items to data in `Atom` instance. + """Static method for finding translators of CifLoop items to + data in `Atom` instance. Parameters ---------- @@ -416,8 +416,8 @@ def _parseCifDataSource(self, datasource): return self.stru def _parseCifBlock(self, blockname): - """Translate CIF file block, skip blocks without `_atom_site_label`. - Updates data members `stru`, `eau`. + """Translate CIF file block, skip blocks without + `_atom_site_label`. Updates data members `stru`, `eau`. Parameters ---------- @@ -505,7 +505,8 @@ def _parse_atom_site_label(self, block): return def _parse_atom_site_aniso_label(self, block): - """Obtain value of anisotropic thermal displacements from a `CifBlock`. + """Obtain value of anisotropic thermal displacements from a + `CifBlock`. This method updates `U` members of `Atom` instances in `self.stru`. The `labelindex` dictionary has to be defined beforehand. @@ -599,7 +600,8 @@ def _parse_space_group_symop_operation_xyz(self, block): return def _expandAsymmetricUnit(self, block): - """Perform symmetry expansion of `self.stru` using `self.spacegroup`. + """Perform symmetry expansion of `self.stru` using + `self.spacegroup`. This method updates data in `stru` and `eau`. @@ -763,7 +765,8 @@ def toLines(self, stru): def leading_float(s, d=0.0): - """Extract the first float from a string and ignore trailing characters. + """Extract the first float from a string and ignore trailing + characters. Useful for extracting values from "value(std)" syntax. @@ -863,7 +866,8 @@ def getParser(eps=None): @contextmanager def _suppressCifParserOutput(): - """Context manager which suppresses diagnostic messages from CIF parser.""" + """Context manager which suppresses diagnostic messages from CIF + parser.""" from CifFile import yapps3_compiled_rt print_error = yapps3_compiled_rt.print_error diff --git a/src/diffpy/structure/parsers/p_discus.py b/src/diffpy/structure/parsers/p_discus.py index c7185cd8..8c59af54 100644 --- a/src/diffpy/structure/parsers/p_discus.py +++ b/src/diffpy/structure/parsers/p_discus.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Parser for DISCUS structure format""" +"""Parser for DISCUS structure format.""" import sys from functools import reduce @@ -24,8 +23,8 @@ class P_discus(StructureParser): - """Parser for DISCUS structure format. The parser chokes - on molecule and generator records. + """Parser for DISCUS structure format. The parser chokes on molecule + and generator records. Attributes ---------- diff --git a/src/diffpy/structure/parsers/p_pdb.py b/src/diffpy/structure/parsers/p_pdb.py index 6d0f95aa..a7d2d936 100644 --- a/src/diffpy/structure/parsers/p_pdb.py +++ b/src/diffpy/structure/parsers/p_pdb.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Basic parser for PDB structure format. Note @@ -281,9 +280,8 @@ def cryst1Lines(self, stru): return lines def atomLines(self, stru, idx): - """Build `ATOM` records and possibly `SIGATM`, `ANISOU` or `SIGUIJ` records - for `structure` stru `atom` number aidx. - """ + """Build `ATOM` records and possibly `SIGATM`, `ANISOU` or + `SIGUIJ` records for `structure` stru `atom` number aidx.""" lines = [] a = stru[idx] ad = a.__dict__ diff --git a/src/diffpy/structure/parsers/p_pdffit.py b/src/diffpy/structure/parsers/p_pdffit.py index 7fb7a56e..f0c50bd4 100644 --- a/src/diffpy/structure/parsers/p_pdffit.py +++ b/src/diffpy/structure/parsers/p_pdffit.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Parser for PDFfit structure format""" +"""Parser for PDFfit structure format.""" import sys from functools import reduce diff --git a/src/diffpy/structure/parsers/p_rawxyz.py b/src/diffpy/structure/parsers/p_rawxyz.py index 65e9588e..24ad293b 100644 --- a/src/diffpy/structure/parsers/p_rawxyz.py +++ b/src/diffpy/structure/parsers/p_rawxyz.py @@ -12,11 +12,10 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Parser for raw XYZ file format. -Raw XYZ is a 3 or 4 column text file with cartesian coordinates -of atoms and an optional first column for atom types. +Raw XYZ is a 3 or 4 column text file with cartesian coordinates of atoms +and an optional first column for atom types. """ import sys diff --git a/src/diffpy/structure/parsers/p_xcfg.py b/src/diffpy/structure/parsers/p_xcfg.py index 372e7ba8..3a29dee3 100644 --- a/src/diffpy/structure/parsers/p_xcfg.py +++ b/src/diffpy/structure/parsers/p_xcfg.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Parser for extended CFG format used by atomeye. Attributes @@ -287,7 +286,8 @@ def parseLines(self, lines): return stru def toLines(self, stru): - """Convert Structure stru to a list of lines in XCFG atomeye format. + """Convert Structure stru to a list of lines in XCFG atomeye + format. Parameters ---------- @@ -424,7 +424,8 @@ def getParser(): def _assign_auxiliaries(a, fields, auxiliaries, no_velocity): - """Assing auxiliary properties for `Atom` object when reading CFG format. + """Assing auxiliary properties for `Atom` object when reading CFG + format. Parameters ---------- diff --git a/src/diffpy/structure/parsers/p_xyz.py b/src/diffpy/structure/parsers/p_xyz.py index 9d19e0c6..5c08f99b 100644 --- a/src/diffpy/structure/parsers/p_xyz.py +++ b/src/diffpy/structure/parsers/p_xyz.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Parser for XYZ file format, where +"""Parser for XYZ file format, where. * First line gives number of atoms. * Second line has optional title. diff --git a/src/diffpy/structure/parsers/parser_index_mod.py b/src/diffpy/structure/parsers/parser_index_mod.py index 5bb6ba98..5f8c3ec7 100644 --- a/src/diffpy/structure/parsers/parser_index_mod.py +++ b/src/diffpy/structure/parsers/parser_index_mod.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Index of recognized structure formats, their IO capabilities and associated modules where they are defined. diff --git a/src/diffpy/structure/parsers/structureparser.py b/src/diffpy/structure/parsers/structureparser.py index 7a3ee3a3..f785b52e 100644 --- a/src/diffpy/structure/parsers/structureparser.py +++ b/src/diffpy/structure/parsers/structureparser.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Definition of StructureParser, a base class for specific parsers.""" diff --git a/src/diffpy/structure/pdffitstructure.py b/src/diffpy/structure/pdffitstructure.py index 414b10b9..73115db6 100644 --- a/src/diffpy/structure/pdffitstructure.py +++ b/src/diffpy/structure/pdffitstructure.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Definition of PDFFitStructure class derived from Structure""" +"""Definition of PDFFitStructure class derived from Structure.""" from diffpy.structure.structure import Structure diff --git a/src/diffpy/structure/sgtbxspacegroups.py b/src/diffpy/structure/sgtbxspacegroups.py index 0ba28fc2..30aacfcf 100644 --- a/src/diffpy/structure/sgtbxspacegroups.py +++ b/src/diffpy/structure/sgtbxspacegroups.py @@ -12,9 +12,9 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Extra space group representations generated using `sgtbx` module from `cctbx`. -Import of this module extends the `SpaceGroupList` in the `SpaceGroups` module. +"""Extra space group representations generated using `sgtbx` module from +`cctbx`. Import of this module extends the `SpaceGroupList` in the +`SpaceGroups` module. Attributes ---------- diff --git a/src/diffpy/structure/spacegroupmod.py b/src/diffpy/structure/spacegroupmod.py index 42fab5cf..9c35eae7 100644 --- a/src/diffpy/structure/spacegroupmod.py +++ b/src/diffpy/structure/spacegroupmod.py @@ -143,7 +143,8 @@ def __str__(self): return x def __call__(self, vec): - """Return symmetry-related position for the specified coordinates. + """Return symmetry-related position for the specified + coordinates. Parameters ---------- @@ -301,7 +302,8 @@ def check_group_name(self, name): return False def iter_equivalent_positions(self, vec): - """Generate symmetry equivalent positions for the specified position. + """Generate symmetry equivalent positions for the specified + position. The initial position must be in fractional coordinates and so are the symmetry equivalent positions yielded by iteration. diff --git a/src/diffpy/structure/spacegroups.py b/src/diffpy/structure/spacegroups.py index 414d56e5..a5d33372 100644 --- a/src/diffpy/structure/spacegroups.py +++ b/src/diffpy/structure/spacegroups.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Space group classes and definitions from mmLib and sgtbx. Attributes @@ -693,7 +692,8 @@ def GetSpaceGroup(sgid): def IsSpaceGroupIdentifier(sgid): - """Check if identifier can be used as an argument to `GetSpaceGroup`. + """Check if identifier can be used as an argument to + `GetSpaceGroup`. Returns ------- @@ -768,6 +768,7 @@ def _hashSymOpList(symops): def _buildSGLookupTable(): """Rebuild space group lookup table from the `SpaceGroupList` data. + This routine updates the global `_sg_lookup_table` dictionary. """ _sg_lookup_table.clear() @@ -809,7 +810,8 @@ def _buildSGLookupTable(): def _getSGHashLookupTable(): - """Return lookup table of symop hashes to standard `SpaceGroup` objects.""" + """Return lookup table of symop hashes to standard `SpaceGroup` + objects.""" if _sg_hash_lookup_table: return _sg_hash_lookup_table for sg in SpaceGroupList: diff --git a/src/diffpy/structure/structure.py b/src/diffpy/structure/structure.py index aee9ed75..5038bce2 100644 --- a/src/diffpy/structure/structure.py +++ b/src/diffpy/structure/structure.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """This module defines class `Structure`.""" import codecs @@ -28,7 +27,8 @@ class Structure(list): - """Define group of atoms in a specified lattice. Structure --> group of atoms. + """Define group of atoms in a specified lattice. Structure --> group + of atoms. `Structure` class is inherited from Python `list`. It contains a list of `Atom` instances. `Structure` overloads `setitem` and `setslice` @@ -183,7 +183,8 @@ def assignUniqueLabels(self): return def distance(self, aid0, aid1): - """Calculate distance between 2 `Atoms`, no periodic boundary conditions. + """Calculate distance between 2 `Atoms`, no periodic boundary + conditions. Parameters ---------- @@ -207,8 +208,7 @@ def distance(self, aid0, aid1): return self.lattice.dist(a0.xyz, a1.xyz) def angle(self, aid0, aid1, aid2): - """ - The bond angle at the second of three `Atoms` in degrees. + """The bond angle at the second of three `Atoms` in degrees. Parameters ---------- @@ -235,7 +235,7 @@ def angle(self, aid0, aid1, aid2): return self.lattice.angle(u10, u12) def placeInLattice(self, new_lattice): - """place structure into `new_lattice` coordinate system. + """Place structure into `new_lattice` coordinate system. Sets `lattice` to `new_lattice` and recalculate fractional coordinates of all `Atoms` so their absolute positions remain the same. @@ -352,7 +352,8 @@ def write(self, filename, format): return def writeStr(self, format): - """return string representation of the structure in specified format. + """Return string representation of the structure in specified + format. Note ---- @@ -367,14 +368,16 @@ def writeStr(self, format): return s def tolist(self): - """Return `Atoms` in this `Structure` as a standard Python list.""" + """Return `Atoms` in this `Structure` as a standard Python + list.""" rv = [a for a in self] return rv # Overloaded list Methods and Operators ---------------------------------- def append(self, a, copy=True): - """Append `Atom` to a structure and update its `lattice` attribute. + """Append `Atom` to a structure and update its `lattice` + attribute. Parameters ---------- @@ -571,7 +574,8 @@ def _fixlat(a): return def __add__(self, other): - """Return new `Structure` object with appended `Atoms` from other. + """Return new `Structure` object with appended `Atoms` from + other. Parameters ---------- @@ -604,7 +608,8 @@ def __iadd__(self, other): return self def __sub__(self, other): - """Return new `Structure` that has `Atoms` from the other removed. + """Return new `Structure` that has `Atoms` from the other + removed. Parameters ---------- @@ -639,8 +644,8 @@ def __isub__(self, other): return self def __mul__(self, n): - """Return new `Structure` with n-times concatenated `Atoms` from self. - `Atoms` and `lattice` in the new structure are all copies. + """Return new `Structure` with n-times concatenated `Atoms` from + self. `Atoms` and `lattice` in the new structure are all copies. Parameters ---------- @@ -660,8 +665,8 @@ def __mul__(self, n): __rmul__ = __mul__ def __imul__(self, n): - """Concatenate this `Structure` to n-times more `Atoms`. - For positive multiple the current `Atom` objects remain at the + """Concatenate this `Structure` to n-times more `Atoms`. For + positive multiple the current `Atom` objects remain at the beginning of this `Structure`. Parameters @@ -858,7 +863,8 @@ def _get_composition(self): # Private Methods -------------------------------------------------------- def __emptySharedStructure(self): - """Return empty `Structure` with standard attributes same as in self.""" + """Return empty `Structure` with standard attributes same as in + self.""" rv = Structure() rv.__dict__.update([(k, getattr(self, k)) for k in rv.__dict__]) return rv diff --git a/src/diffpy/structure/structureerrors.py b/src/diffpy/structure/structureerrors.py index 89679369..f9a2aaec 100644 --- a/src/diffpy/structure/structureerrors.py +++ b/src/diffpy/structure/structureerrors.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Exceptions used in Structure package.""" diff --git a/src/diffpy/structure/symmetryutilities.py b/src/diffpy/structure/symmetryutilities.py index b58e7c88..ea7a40d0 100644 --- a/src/diffpy/structure/symmetryutilities.py +++ b/src/diffpy/structure/symmetryutilities.py @@ -12,9 +12,8 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Symmetry utility functions such as expansion of asymmetric unit, -and generation of positional constraints. +"""Symmetry utility functions such as expansion of asymmetric unit, and +generation of positional constraints. Attributes ---------- @@ -132,8 +131,8 @@ def isconstantFormula(s): class _Position2Tuple(object): - """Create callable object that converts fractional coordinates to - a tuple of integers with given precision. For presision close to zero + """Create callable object that converts fractional coordinates to a + tuple of integers with given precision. For presision close to zero it will return a tuples of double. Note @@ -417,7 +416,8 @@ class GeneratorSite(object): ], dtype=float, ) - """numpy.ndarray: 6x3x3 array of independent components of U matrices.""" + """numpy.ndarray: 6x3x3 array of independent components of U + matrices.""" idx2Usymbol = {0: "U11", 1: "U12", 2: "U13", 3: "U12", 4: "U22", 5: "U23", 6: "U13", 7: "U23", 8: "U33"} """dict: Mapping of index to standard U symbol.""" @@ -467,7 +467,8 @@ def __init__(self, spacegroup, xyz, Uij=numpy.zeros((3, 3)), sgoffset=[0, 0, 0], return def signedRatStr(self, x): - """Convert floating point number to signed rational representation. + """Convert floating point number to signed rational + representation. Possible fractional are multiples of 1/3, 1/6, 1/7, 1/9, if these are not close, return `%+g` format. @@ -495,6 +496,7 @@ def signedRatStr(self, x): def _findNullSpace(self): """Calculate `self.null_space` from `self.invariants`. + Try to represent `self.null_space` using small integers. """ R0 = self.invariants[0].R @@ -525,7 +527,8 @@ def _findNullSpace(self): return def _findPosParameters(self): - """Find pparameters and their values for expressing `self.xyz`.""" + """Find pparameters and their values for expressing + `self.xyz`.""" usedsymbol = {} # parameter values depend on offset of self.xyz txyz = self.xyz @@ -542,8 +545,7 @@ def _findPosParameters(self): def _findUSpace(self): """Find independent U components with respect to invariant - rotations. - """ + rotations.""" n = len(self.invariants) R6zall = numpy.tile(-numpy.identity(6, dtype=float), (n, 1)) R6zall_iter = numpy.split(R6zall, n, axis=0) @@ -568,7 +570,8 @@ def _findUSpace(self): return def _findUParameters(self): - """Find Uparameters and their values for expressing `self.Uij`.""" + """Find Uparameters and their values for expressing + `self.Uij`.""" # permute indices as 00 11 22 01 02 12 10 20 21 diagorder = numpy.array((0, 4, 8, 1, 2, 5, 3, 6, 7)) Uijflat = self.Uij.flatten() @@ -583,7 +586,8 @@ def _findUParameters(self): return def _findeqUij(self): - """Adjust `self.Uij` and `self.eqUij` to be consistent with spacegroup.""" + """Adjust `self.Uij` and `self.eqUij` to be consistent with + spacegroup.""" self.Uij = numpy.zeros((3, 3), dtype=float) for i in range(len(self.Uparameters)): Usp = self.Uspace[i] @@ -598,7 +602,8 @@ def _findeqUij(self): return def positionFormula(self, pos, xyzsymbols=("x", "y", "z")): - """Formula of equivalent position with respect to generator site. + """Formula of equivalent position with respect to generator + site. Parameters ---------- @@ -646,7 +651,8 @@ def positionFormula(self, pos, xyzsymbols=("x", "y", "z")): return dict(zip(("x", "y", "z"), xyzformula)) def UFormula(self, pos, Usymbols=stdUsymbols): - """List of atom displacement formulas with custom parameter symbols. + """List of atom displacement formulas with custom parameter + symbols. Parameters ---------- @@ -902,7 +908,8 @@ def __init__(self, spacegroup, positions, Uijs=None, sgoffset=[0, 0, 0], eps=Non return def _findConstraints(self): - """Find constraints for positions and anisotropic displacements `Uij`.""" + """Find constraints for positions and anisotropic displacements + `Uij`.""" numpos = len(self.positions) # canonical xyzsymbols and Usymbols xyzsymbols = [smbl + str(i) for i in range(numpos) for smbl in "xyz"] @@ -994,7 +1001,8 @@ def translatesymbol(matchobj): return rv def positionFormulasPruned(self, xyzsymbols=None): - """List of position formula dictionaries with constant items removed. + """List of position formula dictionaries with constant items + removed. See also -------- @@ -1014,7 +1022,8 @@ def positionFormulasPruned(self, xyzsymbols=None): return rv def UparSymbols(self): - """Return list of standard atom displacement parameter symbols.""" + """Return list of standard atom displacement parameter + symbols.""" return [n for n, v in self.Upars] def UparValues(self): @@ -1022,7 +1031,8 @@ def UparValues(self): return [v for n, v in self.Upars] def UFormulas(self, Usymbols=None): - """List of atom displacement formulas with custom parameter symbols. + """List of atom displacement formulas with custom parameter + symbols. Parameters ---------- @@ -1059,8 +1069,8 @@ def translatesymbol(matchobj): return rv def UFormulasPruned(self, Usymbols=None): - """List of atom displacement formula dictionaries with constant items - removed. + """List of atom displacement formula dictionaries with constant + items removed. See Also -------- diff --git a/src/diffpy/structure/utils.py b/src/diffpy/structure/utils.py index 4fcee682..facab843 100644 --- a/src/diffpy/structure/utils.py +++ b/src/diffpy/structure/utils.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Small shared functions.""" from collections.abc import Iterable as _Iterable @@ -37,7 +36,8 @@ def isfloat(s): def atomBareSymbol(smbl): - """Remove atom type string stripped of isotope and ion charge symbols. + """Remove atom type string stripped of isotope and ion charge + symbols. This function removes any blank, isotope numbers (0-9), leading hyphens (-), and ion charge symbols (1-9)(+-) from the given atom type string, returning only the bare element symbol. diff --git a/tests/test_atom.py b/tests/test_atom.py index 67009e80..6c7dd32d 100644 --- a/tests/test_atom.py +++ b/tests/test_atom.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - -""" -Unit tests for the Atom class. -""" +"""Unit tests for the Atom class.""" import unittest @@ -31,7 +28,7 @@ class TestAtom(unittest.TestCase): def test___init__(self): - """check Atom.__init__()""" + """Check Atom.__init__()""" a = Atom() self.assertEqual("", a.element) self.assertTrue((a.xyz == 0).all()) @@ -78,7 +75,7 @@ def test___init__(self): # return def test_xyz_cartn(self): - """check Atom.xyz_cartn property""" + """Check Atom.xyz_cartn property.""" hexagonal = Lattice(1, 1, 1, 90, 90, 120) a0 = Atom("C", [0, 0, 0], lattice=hexagonal) a1 = Atom("C", [1, 1, 1], lattice=hexagonal) diff --git a/tests/test_lattice.py b/tests/test_lattice.py index c562d202..e98ec95c 100644 --- a/tests/test_lattice.py +++ b/tests/test_lattice.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Unit tests for Lattice class.""" import unittest @@ -26,7 +25,7 @@ class TestLattice(unittest.TestCase): - """test methods of Lattice class""" + """Test methods of Lattice class.""" def setUp(self): self.lattice = Lattice() @@ -52,7 +51,7 @@ def test___init__(self): return def test_setLatPar(self): - """check calculation of standard unit cell vectors""" + """Check calculation of standard unit cell vectors.""" from math import cos, radians, sqrt from numpy import dot @@ -74,7 +73,7 @@ def cosd(x): return def test_latpar_properties(self): - """check assignment to a, b, c, alpha, beta, gamma.""" + """Check assignment to a, b, c, alpha, beta, gamma.""" lat = self.lattice lat.a = 2 lat.b = 4 @@ -135,7 +134,7 @@ def test_readonly_properties(self): return def test_setLatBase(self): - """check calculation of unit cell rotation""" + """Check calculation of unit cell rotation.""" base = numpy.array([[1.0, 1.0, 0.0], [0.0, 1.0, 1.0], [1.0, 0.0, 1.0]]) self.lattice.setLatBase(base) self.assertAlmostEqual(self.lattice.a, numpy.sqrt(2.0), self.places) @@ -160,7 +159,7 @@ def test_setLatBase(self): return def test_reciprocal(self): - """check calculation of reciprocal lattice.""" + """Check calculation of reciprocal lattice.""" r1 = self.lattice.reciprocal() self.assertEqual((1, 1, 1, 90, 90, 90), r1.abcABG()) L2 = Lattice(2, 4, 8, 90, 90, 90) @@ -171,7 +170,7 @@ def test_reciprocal(self): return def test_dot(self): - """check dot product of lattice vectors.""" + """Check dot product of lattice vectors.""" L = self.lattice L.setLatPar(gamma=120) self.assertAlmostEqual(-0.5, L.dot([1, 0, 0], [0, 1, 0]), self.places) @@ -183,7 +182,7 @@ def test_dot(self): return def test_norm(self): - """check norm of a lattice vector.""" + """Check norm of a lattice vector.""" self.assertEqual(1, self.lattice.norm([1, 0, 0])) u = numpy.array([[3, 4, 0], [1, 1, 1]]) self.assertTrue(numpy.allclose([5, 3**0.5], self.lattice.norm(u))) @@ -192,7 +191,7 @@ def test_norm(self): return def test_rnorm(self): - """check norm of a reciprocal vector.""" + """Check norm of a reciprocal vector.""" L = self.lattice L.setLatPar(1, 1.5, 2.3, 80, 95, 115) r = L.reciprocal() @@ -203,7 +202,7 @@ def test_rnorm(self): return def test_dist(self): - """check dist function for distance between lattice points.""" + """Check dist function for distance between lattice points.""" L = self.lattice L.setLatPar(1, 1.5, 2.3, 80, 95, 115) u = [0.1, 0.3, 0.7] @@ -219,7 +218,7 @@ def test_dist(self): return def test_angle(self): - """check angle calculation between lattice vectors.""" + """Check angle calculation between lattice vectors.""" from math import acos, degrees L = self.lattice @@ -239,7 +238,7 @@ def test_angle(self): return def test_repr(self): - """check string representation of this lattice""" + """Check string representation of this lattice.""" r = repr(self.lattice) self.assertEqual(r, "Lattice()") self.lattice.setLatPar(1, 2, 3, 10, 20, 30) diff --git a/tests/test_loadstructure.py b/tests/test_loadstructure.py index ad197420..8bd1ec21 100644 --- a/tests/test_loadstructure.py +++ b/tests/test_loadstructure.py @@ -17,7 +17,7 @@ def prepare_fixture(self, datafile): self.datafile = datafile def test_xcfg(self): - """check loading of atomeye xcfg format""" + """Check loading of atomeye xcfg format.""" f = self.datafile("BubbleRaftShort.xcfg") stru = loadStructure(f) self.assertTrue(type(stru) is Structure) @@ -25,14 +25,14 @@ def test_xcfg(self): return def test_discus(self): - """check loading of discus file format""" + """Check loading of discus file format.""" f = self.datafile("Ni-discus.stru") stru = loadStructure(f) self.assertTrue(type(stru) is PDFFitStructure) return def test_cif(self): - """check loading of CIF file format""" + """Check loading of CIF file format.""" f = self.datafile("PbTe.cif") stru = loadStructure(f) self.assertTrue(isinstance(stru, Structure)) @@ -40,20 +40,22 @@ def test_cif(self): return def test_badfile(self): - """check loading of CIF file format""" + """Check loading of CIF file format.""" f = self.datafile("Ni-bad.stru") self.assertRaises(StructureFormatError, loadStructure, f) return def test_goodkwarg(self): - """check loading of CIF file and passing of parser keyword argument.""" + """Check loading of CIF file and passing of parser keyword + argument.""" f = self.datafile("graphite.cif") stru = loadStructure(f, eps=1e-10) self.assertEqual(8, len(stru)) return def test_badkwarg(self): - """check loading of xyz file format with invalid keyword argument""" + """Check loading of xyz file format with invalid keyword + argument.""" f = self.datafile("bucky.xyz") self.assertRaises(TypeError, loadStructure, f, eps=1e-10) return diff --git a/tests/test_p_cif.py b/tests/test_p_cif.py index d21b2597..5676120b 100644 --- a/tests/test_p_cif.py +++ b/tests/test_p_cif.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Unit tests for diffpy.structure.parsers.p_cif module""" +"""Unit tests for diffpy.structure.parsers.p_cif module.""" import unittest @@ -37,14 +36,14 @@ def tearDown(self): return def test_leading_float(self): - """check leading_float()""" + """Check leading_float()""" self.assertEqual(0.37, leading_float("0.37(3)")) self.assertEqual(0.37, leading_float("0.37ab\ncd")) self.assertRaises(ValueError, leading_float, "q1") return def test_getSymOp(self): - """check getSymOp()""" + """Check getSymOp()""" from diffpy.structure.spacegroups import Rot_X_mY_Z, SymOp, Tr_0_12_12 op = getSymOp("x,1/2-y,1/2+z") @@ -84,7 +83,7 @@ def tearDown(self): return def test_parse(self): - """check P_cif.parse()""" + """Check P_cif.parse()""" with open(self.pbteciffile) as fp1: sgood = fp1.read() with open(self.badciffile) as fp2: @@ -100,7 +99,7 @@ def test_parse(self): return def test_parseLines(self): - """check P_cif.parseLines()""" + """Check P_cif.parseLines()""" with open(self.pbteciffile) as fp1: goodlines = fp1.readlines() with open(self.badciffile) as fp2: @@ -116,7 +115,7 @@ def test_parseLines(self): return def test_parseFile(self): - """check P_cif.parseFile()""" + """Check P_cif.parseFile()""" # pbteciffile stru = self.pfile.parseFile(self.pbteciffile) self.assertEqual(8, len(stru)) @@ -199,7 +198,7 @@ def test_parseFile(self): # return def test_write_and_read(self): - """high-level check of P_cif.tostring()""" + """High-level check of P_cif.tostring()""" # high-level check stru_check = Structure() stru_check.read(self.cdsebulkpdffitfile) @@ -369,7 +368,8 @@ def test_curly_brace(self): return def test_getParser(self): - """Test passing of eps keyword argument by getParser function.""" + """Test passing of eps keyword argument by getParser + function.""" pcif = getParser("cif", eps=1e-6) grph = pcif.parseFile(self.graphiteciffile) self.assertEqual(8, len(grph)) diff --git a/tests/test_p_discus.py b/tests/test_p_discus.py index 83f4494e..71f0d695 100644 --- a/tests/test_p_discus.py +++ b/tests/test_p_discus.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Unit tests for diffpy.structure.parsers.p_discus module""" +"""Unit tests for diffpy.structure.parsers.p_discus module.""" import re import unittest @@ -27,7 +26,7 @@ class TestP_discus(unittest.TestCase): - """test Parser for PDFFit file format""" + """Test Parser for PDFFit file format.""" @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): @@ -39,7 +38,7 @@ def setUp(self): self.places = 8 def test_read_discus_Ni(self): - """check reading of Ni structure in discus format""" + """Check reading of Ni structure in discus format.""" stru = self.stru stru.read(self.datafile("Ni-discus.stru"), self.format) f_title = "structure Ni FCC" @@ -60,7 +59,7 @@ def test_read_discus_Ni(self): return def test_except_other_formats(self): - """check exceptions when reading files in other formats""" + """Check exceptions when reading files in other formats.""" badfiles = [ "LiCl-bad.cif", "PbTe.cif", @@ -84,7 +83,7 @@ def test_except_other_formats(self): return def test_ignored_lines(self): - """check skipping of ignored lines in the header""" + """Check skipping of ignored lines in the header.""" r1 = "ignored record 1\n" r2 = "ignored record 2\n" with open(self.datafile("Ni-discus.stru")) as fp: @@ -100,7 +99,7 @@ def test_ignored_lines(self): return def test_spdiameter_parsing(self): - """check parsing of spdiameter record from a file.""" + """Check parsing of spdiameter record from a file.""" stru = self.stru stru.read(self.datafile("Ni-discus.stru"), self.format) self.assertEqual(0, stru.pdffit["spdiameter"]) @@ -121,7 +120,7 @@ def test_spdiameter_parsing(self): return def test_stepcut_parsing(self): - """check parsing of stepcut record from a file.""" + """Check parsing of stepcut record from a file.""" stru = self.stru stru.read(self.datafile("Ni-discus.stru"), self.format) self.assertEqual(0, stru.pdffit["stepcut"]) diff --git a/tests/test_p_pdffit.py b/tests/test_p_pdffit.py index b33b6549..316f8ba2 100644 --- a/tests/test_p_pdffit.py +++ b/tests/test_p_pdffit.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Unit tests for diffpy.structure.parsers.p_pdffit module""" +"""Unit tests for diffpy.structure.parsers.p_pdffit module.""" import re import unittest @@ -28,7 +27,7 @@ class TestP_pdffit(unittest.TestCase): - """test Parser for PDFFit file format""" + """Test Parser for PDFFit file format.""" @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): @@ -40,7 +39,7 @@ def setUp(self): self.places = 8 def test_read_pdffit_ZnSb(self): - """check reading of ZnSb pdffit structure file""" + """Check reading of ZnSb pdffit structure file.""" stru = self.stru stru.read(self.datafile("ZnSb_RT_Q28X_VM_20_fxiso.rstr"), self.format) f_title = "Cell structure file of Zn4Sb3 #167 interstitial" @@ -85,7 +84,7 @@ def test_read_pdffit_ZnSb(self): self.assertAlmostEqual(s_sigo, f_sigo) def test_read_pdffit_Ni(self): - """check reading of Ni pdffit structure file""" + """Check reading of Ni pdffit structure file.""" stru = self.stru stru.read(self.datafile("Ni.stru"), self.format) f_title = "structure Ni FCC" @@ -118,7 +117,7 @@ def test_read_pdffit_Ni(self): self.assertAlmostEqual(s_o, f_o) def test_read_pdffit_Ni_prim123(self): - """check reading of Ni_prim supercell 1x2x3""" + """Check reading of Ni_prim supercell 1x2x3.""" stru = self.stru stru.read(self.datafile("Ni_prim123.stru"), self.format) s_lat = [ @@ -149,14 +148,14 @@ def test_read_pdffit_Ni_prim123(self): return def test_read_pdffit_bad(self): - """check exceptions when reading invalid pdffit file""" + """Check exceptions when reading invalid pdffit file.""" stru = self.stru self.assertRaises(StructureFormatError, stru.read, self.datafile("Ni-bad.stru"), self.format) self.assertRaises(StructureFormatError, stru.read, self.datafile("bucky.xyz"), self.format) return def test_writeStr_pdffit(self): - """check writing of normal xyz file""" + """Check writing of normal xyz file.""" stru = self.stru stru.read(self.datafile("Ni.stru"), self.format) with open(self.datafile("Ni.stru")) as fp: @@ -169,7 +168,7 @@ def test_writeStr_pdffit(self): return def test_huge_occupancy(self): - """check structure with huge occupancy can be read.""" + """Check structure with huge occupancy can be read.""" self.stru.read(self.datafile("Ni.stru"), self.format) self.stru[0].occupancy = 16e16 s_s = self.stru.writeStr(self.format) @@ -179,7 +178,7 @@ def test_huge_occupancy(self): return def test_ignored_lines(self): - """check skipping of ignored lines in the header""" + """Check skipping of ignored lines in the header.""" r1 = "ignored record 1" r2 = "ignored record 2" with open(self.datafile("Ni.stru")) as fp: @@ -195,7 +194,7 @@ def test_ignored_lines(self): return def test_spdiameter_parsing(self): - """check parsing of spdiameter record from a file.""" + """Check parsing of spdiameter record from a file.""" stru = self.stru stru.read(self.datafile("Ni.stru"), self.format) self.assertEqual(0, stru.pdffit["spdiameter"]) @@ -216,7 +215,7 @@ def test_spdiameter_parsing(self): return def test_stepcut_parsing(self): - """check parsing of stepcut record from a file.""" + """Check parsing of stepcut record from a file.""" stru = self.stru stru.read(self.datafile("Ni.stru"), self.format) self.assertEqual(0, stru.pdffit["stepcut"]) diff --git a/tests/test_parsers.py b/tests/test_parsers.py index 55c5244d..552154f0 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Unit tests for structure.parsers module.""" import os @@ -30,7 +29,7 @@ class TestP_xyz(unittest.TestCase): - """test Parser for xyz file format""" + """Test Parser for xyz file format.""" @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): @@ -53,7 +52,7 @@ def mktmpfile(self): return self.tmpnames[-1] def test_read_xyz(self): - """check reading of normal xyz file""" + """Check reading of normal xyz file.""" stru = self.stru stru.read(self.datafile("bucky.xyz"), self.format) s_els = [a.element for a in stru] @@ -62,7 +61,7 @@ def test_read_xyz(self): return def test_read_xyz_bad(self): - """check exceptions when reading invalid xyz file""" + """Check exceptions when reading invalid xyz file.""" stru = self.stru self.assertRaises(StructureFormatError, stru.read, self.datafile("bucky-bad1.xyz"), self.format) self.assertRaises(StructureFormatError, stru.read, self.datafile("bucky-bad2.xyz"), self.format) @@ -71,7 +70,7 @@ def test_read_xyz_bad(self): return def test_writeStr_xyz(self): - """check string representation of normal xyz file""" + """Check string representation of normal xyz file.""" stru = self.stru stru.title = "test of writeStr" stru.lattice = Lattice(1.0, 2.0, 3.0, 90.0, 90.0, 90.0) @@ -83,7 +82,7 @@ def test_writeStr_xyz(self): return def test_write_xyz(self): - """check writing of normal xyz file""" + """Check writing of normal xyz file.""" stru = self.stru stru.title = "test of writeStr" stru.lattice = Lattice(1.0, 2.0, 3.0, 90.0, 90.0, 90.0) @@ -104,7 +103,7 @@ def test_write_xyz(self): class TestP_rawxyz(unittest.TestCase): - """test Parser for rawxyz file format""" + """Test Parser for rawxyz file format.""" @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): @@ -116,7 +115,7 @@ def setUp(self): return def test_read_plainxyz(self): - """check reading of a plain xyz file""" + """Check reading of a plain xyz file.""" stru = self.stru stru.read(self.datafile("bucky-plain.xyz"), self.format) s_els = [a.element for a in stru] @@ -125,13 +124,13 @@ def test_read_plainxyz(self): return def test_read_plainxyz_bad(self): - """check exceptions when reading invalid plain xyz file""" + """Check exceptions when reading invalid plain xyz file.""" stru = self.stru self.assertRaises(StructureFormatError, stru.read, self.datafile("bucky-plain-bad.xyz"), self.format) return def test_read_rawxyz(self): - """check reading of raw xyz file""" + """Check reading of raw xyz file.""" stru = self.stru stru.read(self.datafile("bucky-raw.xyz"), self.format) s_els = [a.element for a in stru] @@ -143,14 +142,14 @@ def test_read_rawxyz(self): return def test_read_rawxyz_bad(self): - """check exceptions when reading unsupported xy file""" + """Check exceptions when reading unsupported xy file.""" stru = self.stru self.assertRaises(StructureFormatError, stru.read, self.datafile("hexagon-raw-bad.xyz"), self.format) self.assertRaises(StructureFormatError, stru.read, self.datafile("hexagon-raw.xy"), self.format) return def test_writeStr_rawxyz(self): - """check writing of normal xyz file""" + """Check writing of normal xyz file.""" stru = self.stru stru.title = "test of writeStr" stru.lattice = Lattice(1.0, 2.0, 3.0, 90.0, 90.0, 90.0) @@ -173,7 +172,7 @@ def test_writeStr_rawxyz(self): class TestP_pdb(unittest.TestCase): - """test Parser for PDB file format""" + """Test Parser for PDB file format.""" @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): @@ -185,7 +184,7 @@ def setUp(self): self.places = 3 def test_read_pdb_arginine(self): - """check reading of arginine PDB file""" + """Check reading of arginine PDB file.""" stru = self.stru stru.read(self.datafile("arginine.pdb"), self.format) f_els = [ @@ -233,7 +232,7 @@ def test_read_pdb_arginine(self): self.assertTrue(numpy.allclose(a0.xyz, [0.735, 2.219, 1.389])) def test_rwStr_pdb_CdSe(self): - """check conversion to PDB file format""" + """Check conversion to PDB file format.""" stru = self.stru stru.read(self.datafile("CdSe_bulk.stru"), "pdffit") s = stru.writeStr(self.format) @@ -274,7 +273,7 @@ def test_rwStr_pdb_CdSe(self): class TestP_xcfg(unittest.TestCase): - """test Parser for XCFG file format""" + """Test Parser for XCFG file format.""" @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): @@ -286,7 +285,7 @@ def setUp(self): self.places = 6 def test_read_xcfg(self): - """check reading of BubbleRaft XCFG file""" + """Check reading of BubbleRaft XCFG file.""" stru = self.stru stru.read(self.datafile("BubbleRaftShort.xcfg"), self.format) f_els = 500 * ["Ar"] @@ -306,7 +305,7 @@ def test_read_xcfg(self): return def test_rwStr_xcfg_CdSe(self): - """check conversion to XCFG file format""" + """Check conversion to XCFG file format.""" stru = self.stru stru.read(self.datafile("CdSe_bulk.stru"), "pdffit") s = stru.writeStr(self.format) diff --git a/tests/test_spacegroups.py b/tests/test_spacegroups.py index 996a73d4..bfd71382 100644 --- a/tests/test_spacegroups.py +++ b/tests/test_spacegroups.py @@ -12,8 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - -"""Unit tests for diffpy.structure.spacegroups""" +"""Unit tests for diffpy.structure.spacegroups.""" import unittest diff --git a/tests/test_structure.py b/tests/test_structure.py index d79f5ed3..65e851c1 100644 --- a/tests/test_structure.py +++ b/tests/test_structure.py @@ -12,7 +12,6 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - """Unit tests for Structure class.""" @@ -29,7 +28,7 @@ class TestStructure(unittest.TestCase): - """test methods of Structure class""" + """Test methods of Structure class.""" @pytest.fixture(autouse=True) def prepare_fixture(self, datafile): @@ -56,7 +55,7 @@ def setUp(self): return def test___init__(self): - """check Structure.__init__()""" + """Check Structure.__init__()""" atoms = [Atom("C", [0, 0, 0]), Atom("C", [0.5, 0.5, 0.5])] self.assertRaises(ValueError, Structure, atoms, filename=self.teifile) self.assertRaises(ValueError, Structure, lattice=Lattice(), filename=self.teifile) @@ -72,7 +71,7 @@ def test___init__(self): return def test_copy(self): - """check Structure.copy()""" + """Check Structure.copy()""" class MyDerivedStructure(Structure): def __copy__(self): @@ -96,7 +95,7 @@ def __copy__(self): return def test___copy__(self): - """check Structure.__copy__()""" + """Check Structure.__copy__()""" cdse = Structure(filename=self.cdsefile) cdse_str = cdse.writeStr("pdffit") cdse2 = copy.copy(cdse) @@ -119,7 +118,7 @@ def test___copy__(self): # return def test_assignUniqueLabels(self): - """check Structure.assignUniqueLabels()""" + """Check Structure.assignUniqueLabels()""" self.assertEqual("", "".join([a.label for a in self.stru])) self.stru.assignUniqueLabels() self.assertEqual("C1", self.stru[0].label) @@ -127,7 +126,7 @@ def test_assignUniqueLabels(self): return def test_distance(self): - """check Structure.distance()""" + """Check Structure.distance()""" from math import sqrt self.stru.assignUniqueLabels() @@ -139,7 +138,7 @@ def test_distance(self): return def test_angle(self): - """check Structure.angle()""" + """Check Structure.angle()""" cdse = Structure(filename=self.cdsefile) cdse.assignUniqueLabels() self.assertEqual(109, round(cdse.angle(0, 2, 1))) @@ -147,7 +146,8 @@ def test_angle(self): return def test_placeInLattice(self): - """check Structure.placeInLattice() -- conversion of coordinates""" + """Check Structure.placeInLattice() -- conversion of + coordinates.""" stru = self.stru new_lattice = Lattice(0.5, 0.5, 0.5, 90, 90, 60) stru.placeInLattice(new_lattice) @@ -173,14 +173,14 @@ def test_placeInLattice(self): # return def test_aslist(self): - """check Structure.tolist()""" + """Check Structure.tolist()""" lst = self.stru.tolist() self.assertEqual(tuple(lst), tuple(self.stru)) self.assertEqual(list, type(lst)) return def test_append(self): - """check Structure.append()""" + """Check Structure.append()""" a = Atom("Si", (0.1, 0.2, 0.3)) lat = self.stru.lattice self.stru.append(a) @@ -194,7 +194,7 @@ def test_append(self): return def test_insert(self): - """check Structure.insert()""" + """Check Structure.insert()""" a = Atom("Si", (0.1, 0.2, 0.3)) lat = self.stru.lattice self.stru.insert(1, a) @@ -208,7 +208,7 @@ def test_insert(self): return def test_extend(self): - """check Structure.extend()""" + """Check Structure.extend()""" stru = self.stru cdse = Structure(filename=self.cdsefile) lst = stru.tolist() @@ -220,7 +220,7 @@ def test_extend(self): return def test___getitem__(self): - """check Structure.__getitem__()""" + """Check Structure.__getitem__()""" stru = self.stru self.assertTrue(stru[0] is stru.tolist()[0]) intidx = list(range(len(stru)))[::-1] @@ -247,14 +247,14 @@ def test___getitem__(self): return def test___getitem__slice(self): - """check Structure.__getitem__() with a slice argument""" + """Check Structure.__getitem__() with a slice argument.""" stru = self.stru self.assertEqual([stru[0]], stru[:1].tolist()) self.assertEqual([stru[1], stru[0]], stru[::-1].tolist()) return def test___setitem__(self): - """check Structure.__setitem__()""" + """Check Structure.__setitem__()""" a = Atom("Si", (0.1, 0.2, 0.3)) lat = self.stru.lattice self.stru[1] = a @@ -268,7 +268,7 @@ def test___setitem__(self): return def test___setitem__slice(self): - """check Structure.__setitem__() with a slice argument""" + """Check Structure.__setitem__() with a slice argument.""" a = Atom("Si", (0.1, 0.2, 0.3)) lat = self.stru.lattice self.stru[:] = [a] @@ -282,7 +282,7 @@ def test___setitem__slice(self): return def test___add__(self): - """check Structure.__add__()""" + """Check Structure.__add__()""" stru = self.stru cdse = Structure(filename=self.cdsefile) total = stru + cdse @@ -298,7 +298,7 @@ def test___add__(self): return def test___iadd__(self): - """check Structure.__iadd__()""" + """Check Structure.__iadd__()""" stru = self.stru lat0 = stru.lattice lst = stru.tolist() @@ -315,7 +315,7 @@ def test___iadd__(self): return def test___sub__(self): - """check Structure.__sub__()""" + """Check Structure.__sub__()""" cdse = Structure(filename=self.cdsefile) cadmiums = cdse - cdse[2:] self.assertEqual(2, len(cadmiums)) @@ -328,7 +328,7 @@ def test___sub__(self): return def test___isub__(self): - """check Structure.__isub__()""" + """Check Structure.__isub__()""" cdse = Structure(filename=self.cdsefile) lat = cdse.lattice lst = cdse.tolist() @@ -342,7 +342,7 @@ def test___isub__(self): return def test___mul__(self): - """check Structure.__mul__()""" + """Check Structure.__mul__()""" cdse = Structure(filename=self.cdsefile) self.assertEqual(12, len(set(3 * cdse))) self.assertEqual(12, len(set(cdse * 3))) @@ -355,7 +355,7 @@ def test___mul__(self): return def test___imul__(self): - """check Structure.__imul__()""" + """Check Structure.__imul__()""" cdse = Structure(filename=self.cdsefile) lat = cdse.lattice els = cdse.element @@ -373,7 +373,7 @@ def test___imul__(self): return def test__get_lattice(self): - """check Structure._get_lattice()""" + """Check Structure._get_lattice()""" lat = Lattice() stru = Structure() self.assertEqual((1, 1, 1, 90, 90, 90), stru.lattice.abcABG()) @@ -382,14 +382,14 @@ def test__get_lattice(self): return def test__set_lattice(self): - """check Structure._set_lattice()""" + """Check Structure._set_lattice()""" lat = Lattice() self.stru.lattice = lat self.assertEqual(2 * [lat], [a.lattice for a in self.stru]) return def test_composition(self): - """check Structure.composition property""" + """Check Structure.composition property.""" stru = self.stru self.assertEqual({"C": 2}, stru.composition) stru *= 2 @@ -399,7 +399,7 @@ def test_composition(self): return def test_element(self): - """check Structure.element""" + """Check Structure.element.""" stru = self.stru cdse = self.cdse self.assertEqual("Cd Cd Se Se".split(), cdse.element.tolist()) @@ -409,7 +409,7 @@ def test_element(self): return def test_xyz(self): - """check Structure.xyz""" + """Check Structure.xyz.""" stru = self.stru self.assertEqual((2, 3), stru.xyz.shape) self.assertTrue(numpy.array_equal([1, 1, 1], stru.xyz[1])) @@ -427,7 +427,7 @@ def test_xyz(self): return def test_x(self): - """check Structure.x""" + """Check Structure.x.""" cdse = self.cdse self.assertEqual((4,), cdse.x.shape) self.assertAlmostEqual(0.6666, cdse.x[3], 5) @@ -438,7 +438,7 @@ def test_x(self): return def test_y(self): - """check Structure.y""" + """Check Structure.y.""" cdse = self.cdse self.assertEqual((4,), cdse.y.shape) self.assertAlmostEqual(0.3333, cdse.y[3], 5) @@ -449,7 +449,7 @@ def test_y(self): return def test_z(self): - """check Structure.z""" + """Check Structure.z.""" cdse = self.cdse self.assertEqual((4,), cdse.z.shape) self.assertAlmostEqual(0.87667, cdse.z[3], 5) @@ -460,7 +460,7 @@ def test_z(self): return def test_label(self): - """check Structure.label""" + """Check Structure.label.""" cdse = Structure(filename=self.cdsefile) self.assertEqual(4 * [""], cdse.label.tolist()) cdse.assignUniqueLabels() @@ -470,7 +470,7 @@ def test_label(self): return def test_occupancy(self): - """check Structure.occupancy""" + """Check Structure.occupancy.""" cdse = self.cdse self.assertTrue(numpy.array_equal(numpy.ones(4), cdse.occupancy)) self.stru.occupancy *= 0.5 @@ -480,7 +480,7 @@ def test_occupancy(self): return def test_xyz_cartn(self): - """check Structure.xyz_cartn""" + """Check Structure.xyz_cartn.""" pbte = copy.copy(self.pbte) self.assertEqual((8, 3), pbte.xyz_cartn.shape) self.assertTrue(numpy.allclose(6.461 / 2.0 * numpy.ones(3), pbte.xyz_cartn[0])) @@ -490,7 +490,7 @@ def test_xyz_cartn(self): return def test_anisotropy(self): - """check Structure.anisotropy""" + """Check Structure.anisotropy.""" self.assertEqual((2,), self.stru.anisotropy.shape) self.assertFalse(numpy.any(self.stru.anisotropy)) tei = copy.copy(self.tei) @@ -507,7 +507,7 @@ def test_anisotropy(self): return def test_U(self): - """check Structure.U""" + """Check Structure.U.""" stru = self.stru self.assertEqual((2, 3, 3), stru.U.shape) self.assertFalse(numpy.any(stru.anisotropy)) @@ -529,7 +529,7 @@ def test_U(self): return def test_Uisoequiv(self): - """check Structure.Uisoequiv""" + """Check Structure.Uisoequiv.""" tei = copy.copy(self.tei) self.assertEqual((16,), tei.Uisoequiv.shape) self.assertAlmostEqual(0.019227, tei.Uisoequiv[0], 6) @@ -542,7 +542,7 @@ def test_Uisoequiv(self): return def test_Uij(self): - """check Structure.Uij""" + """Check Structure.Uij.""" stru = self.stru stru[1].anisotropy = True stru[1].U = [[1.1, 0.12, 0.13], [0.12, 2.2, 0.23], [0.13, 0.23, 3.3]] @@ -557,7 +557,7 @@ def test_Uij(self): return def test_Bisoequiv(self): - """check Structure.Bisoequiv""" + """Check Structure.Bisoequiv.""" utob = 8 * numpy.pi**2 tei = copy.copy(self.tei) self.assertEqual((16,), tei.Bisoequiv.shape) @@ -571,7 +571,7 @@ def test_Bisoequiv(self): return def test_Bij(self): - """check Structure.Bij""" + """Check Structure.Bij.""" stru = self.stru stru[1].anisotropy = True stru[1].U = [[1.1, 0.12, 0.13], [0.12, 2.2, 0.23], [0.13, 0.23, 3.3]] diff --git a/tests/test_supercell.py b/tests/test_supercell.py index 68aa8092..d20434ca 100644 --- a/tests/test_supercell.py +++ b/tests/test_supercell.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Unit tests for supercell.py""" +"""Unit tests for supercell.py.""" import unittest @@ -50,14 +49,14 @@ def tearDown(self): return def test_exceptions(self): - """check argument checking of supercell.""" + """Check argument checking of supercell.""" self.assertRaises(ValueError, supercell, self.stru_ni, (0, 1, 1)) self.assertRaises(ValueError, supercell, self.stru_ni, (0, 1)) self.assertRaises(TypeError, supercell, list(self.stru_ni), (1, 1, 1)) return def test_ni_supercell(self): - """check supercell expansion for Ni.""" + """Check supercell expansion for Ni.""" ni_123 = supercell(self.stru_ni, (1, 2, 3)) self.assertEqual(6 * len(self.stru_ni), len(ni_123)) a, b, c = self.stru_ni.lattice.abcABG()[:3] @@ -73,7 +72,7 @@ def test_ni_supercell(self): return def test_cdse_supercell(self): - """check supercell expansion for CdSe.""" + """Check supercell expansion for CdSe.""" cdse_222 = supercell(self.stru_cdse, (2, 2, 2)) # new atoms should be grouped together elems = sum([8 * [a.element] for a in self.stru_cdse], []) diff --git a/tests/test_symmetryutilities.py b/tests/test_symmetryutilities.py index 377f7554..5e733906 100644 --- a/tests/test_symmetryutilities.py +++ b/tests/test_symmetryutilities.py @@ -12,8 +12,7 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## - -"""Unit tests for SymmetryUtilities.py""" +"""Unit tests for SymmetryUtilities.py.""" import re import sys @@ -45,7 +44,7 @@ def tearDown(self): return def test_isSpaceGroupLatPar(self): - """check isSpaceGroupLatPar()""" + """Check isSpaceGroupLatPar()""" triclinic = GetSpaceGroup("P1") monoclinic = GetSpaceGroup("P2") orthorhombic = GetSpaceGroup("P222") @@ -69,13 +68,13 @@ def test_isSpaceGroupLatPar(self): return def test_sgtbx_spacegroup_aliases(self): - """check GetSpaceGroup for non-standard aliases from sgtbx.""" + """Check GetSpaceGroup for non-standard aliases from sgtbx.""" self.assertIs(GetSpaceGroup("Fm3m"), GetSpaceGroup(225)) self.assertIs(GetSpaceGroup("Ia3d"), GetSpaceGroup("I a -3 d")) return def test_expandPosition(self): - """check expandPosition()""" + """Check expandPosition()""" # ok again Ni example fcc = GetSpaceGroup(225) pos, pops, pmult = expandPosition(fcc, [0, 0, 0]) @@ -86,14 +85,14 @@ def test_expandPosition(self): return def test_pruneFormulaDictionary(self): - """check pruneFormulaDictionary()""" + """Check pruneFormulaDictionary()""" fmdict = {"x": "3*y-0.17", "y": "0", "z": "0.13"} pruned = pruneFormulaDictionary(fmdict) self.assertEqual({"x": "3*y-0.17"}, pruned) return def test_isconstantFormula(self): - """check isconstantFormula()""" + """Check isconstantFormula()""" self.assertFalse(isconstantFormula("x-y+z")) self.assertTrue(isconstantFormula("6.023e23")) self.assertTrue(isconstantFormula("22/7")) @@ -119,14 +118,14 @@ def tearDown(self): return def test___init__(self): - """check _Position2Tuple.__init__()""" + """Check _Position2Tuple.__init__()""" self.assertNotEqual(0.0, self.pos2tuple.eps) self.pos2tuple = _Position2Tuple(1.0 / sys.maxsize / 2) self.assertEqual(0.0, self.pos2tuple.eps) return def test___call__(self): - """check _Position2Tuple.__call__()""" + """Check _Position2Tuple.__call__()""" pos2tuple = self.pos2tuple positions = numpy.zeros((100, 3), dtype=float) positions[:, 0] = numpy.arange(100) / 100.0 * pos2tuple.eps + 0.1 @@ -202,7 +201,7 @@ def tearDown(self): return def test___init__(self): - """check GeneratorSite.__init__()""" + """Check GeneratorSite.__init__()""" # check multiplicities self.assertEqual(2, self.g117c.multiplicity) self.assertEqual(4, self.g117h.multiplicity) @@ -230,7 +229,7 @@ def test_signedRatStr(self): return def test_positionFormula(self): - """check GeneratorSite.positionFormula()""" + """Check GeneratorSite.positionFormula()""" # 117c self.assertEqual([], self.g117c.pparameters) self.assertEqual([("x", self.x)], self.g117h.pparameters) @@ -265,7 +264,7 @@ def test_positionFormula_sg209(self): return def test_UFormula(self): - """check GeneratorSite.UFormula()""" + """Check GeneratorSite.UFormula()""" # Ref: Willis and Pryor, Thermal Vibrations in Crystallography, # Cambridge University Press 1975, p. 104-110 smbl = ("A", "B", "C", "D", "E", "F") @@ -315,7 +314,8 @@ def test_UFormula(self): return def test_UFormula_g186c_eqxyz(self): - """Check rotated U formulas at the symmetry positions of c-site in 186.""" + """Check rotated U formulas at the symmetry positions of c-site + in 186.""" sg186 = GetSpaceGroup(186) crules = [ {"U11": "A", "U22": "A", "U33": "C", "U12": "D", "U13": "E", "U23": "-E"}, @@ -354,7 +354,7 @@ def test_UFormula_self_reference(self): return def test__findUParameters(self): - """check GeneratorSite._findUParameters()""" + """Check GeneratorSite._findUParameters()""" # by default all Uparameters equal zero, this would fail for NaNs for gen in TestGeneratorSite.generators.values(): for usym, uval in gen.Uparameters: @@ -371,7 +371,7 @@ def test__findUParameters(self): return def test_eqIndex(self): - """check GeneratorSite.eqIndex()""" + """Check GeneratorSite.eqIndex()""" self.assertEqual(13, self.g227oc.eqIndex(self.g227oc.eqxyz[13])) return @@ -390,7 +390,7 @@ def tearDown(self): return def test___init__(self): - """check SymmetryConstraints.__init__()""" + """Check SymmetryConstraints.__init__()""" sg225 = GetSpaceGroup(225) # initialize from nested lists and arrays from ExpandAsymmetricUnit eau = ExpandAsymmetricUnit(sg225, [[0, 0, 0]]) @@ -430,7 +430,7 @@ def test_corepos(self): return def test_Uisotropy(self): - """check isotropy value for ADP-s at specified sites.""" + """Check isotropy value for ADP-s at specified sites.""" sg225 = GetSpaceGroup(225) corepos = [[0, 0, 0], [0.1, 0.13, 0.17]] eau = ExpandAsymmetricUnit(sg225, corepos) @@ -465,7 +465,7 @@ def test_Uisotropy(self): # return # def test_UparSymbols(self): - """check SymmetryConstraints.UparSymbols()""" + """Check SymmetryConstraints.UparSymbols()""" sg1 = GetSpaceGroup(1) sg225 = GetSpaceGroup(225) pos = [[0, 0, 0]] @@ -477,7 +477,7 @@ def test_UparSymbols(self): return def test_UparValues(self): - """check SymmetryConstraints.UparValues()""" + """Check SymmetryConstraints.UparValues()""" places = 12 sg1 = GetSpaceGroup(1) sg225 = GetSpaceGroup(225) From 4b7b89cc8522aee82b7a89541f23726b6040d046 Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 13:49:18 -0400 Subject: [PATCH 40/56] skpkg: new files --- .../pull_request_template.md | 15 ++ .github/workflows/publish-docs-on-release.yml | 12 ++ .pre-commit-config.yaml | 38 +++-- .readthedocs.yaml | 13 ++ CODE_OF_CONDUCT.rst | 133 ++++++++++++++++++ doc/source/img/.placeholder | 0 doc/source/snippets/.placeholder | 0 environment.yml | 6 - requirements/docs.txt | 1 + 9 files changed, 203 insertions(+), 15 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md create mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 .readthedocs.yaml create mode 100644 CODE_OF_CONDUCT.rst create mode 100644 doc/source/img/.placeholder create mode 100644 doc/source/snippets/.placeholder delete mode 100644 environment.yml diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 00000000..1099d862 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,15 @@ +### What problem does this PR address? + + + +### What should the reviewer(s) do? + + + + diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml new file mode 100644 index 00000000..461e8ac3 --- /dev/null +++ b/.github/workflows/publish-docs-on-release.yml @@ -0,0 +1,12 @@ +name: Deploy Documentation on Release + +on: + workflow_dispatch: + +jobs: + docs: + uses: scikit-package/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: diffpy.structure + c_extension: false + headless: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3070e199..0e4a84d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ default_language_version: - python: python3 + python: python3 ci: - autofix_commit_msg: | - [pre-commit.ci] auto fixes from pre-commit hooks - autofix_prs: true - autoupdate_branch: 'pre-commit-autoupdate' - autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' - autoupdate_schedule: monthly - skip: [no-commit-to-branch] - submodules: false + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit hooks + autofix_prs: true + autoupdate_branch: "pre-commit-autoupdate" + autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate" + autoupdate_schedule: monthly + skip: [no-commit-to-branch] + submodules: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 @@ -44,3 +44,23 @@ 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 + # prettier - multi formatter for .json, .yml, and .md files + - repo: https://github.com/pre-commit/mirrors-prettier + rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8 + hooks: + - id: prettier + additional_dependencies: + - "prettier@^3.2.4" + # docformatter - PEP 257 compliant docstring formatter + - repo: https://github.com/s-weigand/docformatter + rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c + hooks: + - id: docformatter + additional_dependencies: [tomli] + args: [--in-place, --config, ./pyproject.toml] diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..47f7a017 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,13 @@ +version: 2 + +build: + os: "ubuntu-22.04" + tools: + python: "latest" + +python: + install: + - requirements: requirements/docs.txt + +sphinx: + configuration: doc/source/conf.py diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst new file mode 100644 index 00000000..e8199ca5 --- /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, socioeconomic 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/doc/source/img/.placeholder b/doc/source/img/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/doc/source/snippets/.placeholder b/doc/source/snippets/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/environment.yml b/environment.yml deleted file mode 100644 index c7cd23cd..00000000 --- a/environment.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: diffpy.structure -channels: - - conda-forge -dependencies: - - python=3 - - pip diff --git a/requirements/docs.txt b/requirements/docs.txt index ab17b1c8..5f34c6ed 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,4 +1,5 @@ sphinx sphinx_rtd_theme +sphinx-copybutton doctr m2r From 9d7972e275592c1f9122cd5a4dbe64b1a2887100 Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 14:08:17 -0400 Subject: [PATCH 41/56] skpkg: docs --- doc/source/conf.py | 45 ++++++++++++++++++++++++++++++++++++------ doc/source/index.rst | 3 +++ doc/source/license.rst | 2 +- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index f7b1c770..6e3d83bc 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# diffpy.structure documentation build configuration file, created by +# diffpy.structure documentation build configuration file, created by # noqa: E501 # sphinx-quickstart on Thu Jan 30 15:49:41 2014. # # This file is execfile()d with the current directory set to its @@ -18,15 +18,21 @@ from importlib.metadata import version from pathlib import Path +# Attempt to import the version dynamically from GitHub tag. +try: + fullversion = version("diffpy.structure") +except Exception: + fullversion = "No version found. The correct version will appear in the released version." # noqa: E501 + # 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 Path().resolve() to make it absolute, like shown here. +# documentation root, use Path().resolve() to make it absolute, like shown here. # noqa: E501 # 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 = "Billinge Group members and community contributors" +ab_authors = "Chris Farrow, Pavol Juhas, Simon Billinge, Billinge Group members" # -- General configuration ------------------------------------------------ @@ -43,6 +49,7 @@ "sphinx.ext.viewcode", "sphinx.ext.intersphinx", "sphinx_rtd_theme", + "sphinx_copybutton", "m2r", ] @@ -68,7 +75,6 @@ # |version| and |release|, also used in various other places throughout the # built documents. -fullversion = version(project) # The short X.Y version. version = "".join(fullversion.split(".post")[:1]) # The full version, including alpha/beta/rc tags. @@ -88,6 +94,11 @@ # substitute YEAR in the copyright string copyright = copyright.replace("%Y", year) +# For sphinx_copybutton extension. +# Do not copy "$" for shell commands in code-blocks. +copybutton_prompt_text = r"^\$ " +copybutton_prompt_is_regexp = True + # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ["build"] @@ -123,6 +134,14 @@ # html_theme = "sphinx_rtd_theme" +html_context = { + "display_github": True, + "github_user": "diffpy", + "github_repo": "diffpy.structure", + "github_version": "main", + "conf_py_path": "/doc/source/", +} + # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. @@ -221,7 +240,13 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ("index", "diffpy.structure.tex", "diffpy.structure Documentation", ab_authors, "manual"), + ( + "index", + "diffpy.structure.tex", + "diffpy.structure Documentation", + ab_authors, + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of @@ -249,7 +274,15 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [("index", "diffpy.structure", "diffpy.structure Documentation", ab_authors, 1)] +man_pages = [ + ( + "index", + "diffpy.structure", + "diffpy.structure Documentation", + ab_authors, + 1, + ) +] # If true, show URL addresses after external links. # man_show_urls = False diff --git a/doc/source/index.rst b/doc/source/index.rst index 4fabbaa1..46e3b737 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -29,6 +29,7 @@ Pavol Juhás, Christopher L. Farrow, Xiaohao Yang, Simon J.L. Billinge. For a detailed list of contributors see https://github.com/diffpy/diffpy.structure/graphs/contributors. +=============== Acknowledgments =============== @@ -38,9 +39,11 @@ Less common settings of space groups were generating using the Computational Crystallography Toolbox, http://cctbx.sourceforge.net. +``diffpy.structure`` is built and maintained with `scikit-package `_. .. index:: citation, reference +========= Reference ========= diff --git a/doc/source/license.rst b/doc/source/license.rst index 33a363ae..00315fc7 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -22,7 +22,7 @@ Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory -Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 2024-2025, 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 04f6aa571ba85309df6d8df948ca54c6e57bc2de Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 14:30:04 -0400 Subject: [PATCH 42/56] skpkg: codespell src/ --- .codespell/ignore_words.txt | 19 ++++++++++++++++--- src/diffpy/structure/expansion/shapeutils.py | 2 +- src/diffpy/structure/parsers/p_auto.py | 2 +- src/diffpy/structure/parsers/p_discus.py | 2 +- src/diffpy/structure/parsers/p_xcfg.py | 2 +- src/diffpy/structure/spacegroupmod.py | 2 +- src/diffpy/structure/structure.py | 4 ++-- src/diffpy/structure/symmetryutilities.py | 2 +- 8 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt index 9757d7c0..e2ee211b 100644 --- a/.codespell/ignore_words.txt +++ b/.codespell/ignore_words.txt @@ -4,8 +4,21 @@ ;; abbreviation for "materials" often used in a journal title mater -;; alternative use of socioeconomic -socio-economic - ;; Frobenius norm used in np.linalg.norm fro + +;; "discus" is the name of a software package +discus +DISCUS + +;; chemical elements +Te +Nd + +;; /src/diffpy/structure/parsers/p_pdb.py:100 +;; pdb identifier +CONECT + +;; /src/diffpy/structure/parsers/p_xcfg.py:452 +;; used in a function +BU diff --git a/src/diffpy/structure/expansion/shapeutils.py b/src/diffpy/structure/expansion/shapeutils.py index 12ba80d6..16f6c4c3 100644 --- a/src/diffpy/structure/expansion/shapeutils.py +++ b/src/diffpy/structure/expansion/shapeutils.py @@ -32,7 +32,7 @@ def findCenter(S): """ best = -1 bestd = len(S) - center = [0.5, 0.5, 0.5] # the cannonical center + center = [0.5, 0.5, 0.5] # the canonical center for i in range(len(S)): d = S.lattice.dist(S[i].xyz, center) diff --git a/src/diffpy/structure/parsers/p_auto.py b/src/diffpy/structure/parsers/p_auto.py index ab688987..ae0ae05a 100644 --- a/src/diffpy/structure/parsers/p_auto.py +++ b/src/diffpy/structure/parsers/p_auto.py @@ -148,7 +148,7 @@ def parseFile(self, filename): def _wrapParseMethod(self, method, *args, **kwargs): """A helper evaluator method that try the specified parse method with each registered structure parser and return the first - successful resul. + successful result. Structure parsers that match structure file extension are tried first. diff --git a/src/diffpy/structure/parsers/p_discus.py b/src/diffpy/structure/parsers/p_discus.py index 8c59af54..e8220ca7 100644 --- a/src/diffpy/structure/parsers/p_discus.py +++ b/src/diffpy/structure/parsers/p_discus.py @@ -272,7 +272,7 @@ def _parse_unknown_record(self, words): Raises ------ StructureFormatError - Unkown record. + Unknown record. """ self.ignored_lines.append(self.line) return diff --git a/src/diffpy/structure/parsers/p_xcfg.py b/src/diffpy/structure/parsers/p_xcfg.py index 3a29dee3..ea432a6b 100644 --- a/src/diffpy/structure/parsers/p_xcfg.py +++ b/src/diffpy/structure/parsers/p_xcfg.py @@ -424,7 +424,7 @@ def getParser(): def _assign_auxiliaries(a, fields, auxiliaries, no_velocity): - """Assing auxiliary properties for `Atom` object when reading CFG + """Assign auxiliary properties for `Atom` object when reading CFG format. Parameters diff --git a/src/diffpy/structure/spacegroupmod.py b/src/diffpy/structure/spacegroupmod.py index 9c35eae7..b14d3023 100644 --- a/src/diffpy/structure/spacegroupmod.py +++ b/src/diffpy/structure/spacegroupmod.py @@ -7,7 +7,7 @@ import numpy -# 64 unique rotation matricies +# 64 unique rotation matrices Rot_Z_mY_X = numpy.array([[0.0, 0.0, 1.0], [0.0, -1.0, 0.0], [1.0, 0.0, 0.0]], float) Rot_Y_mX_mZ = numpy.array([[0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float) Rot_XmY_X_mZ = numpy.array([[1.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float) diff --git a/src/diffpy/structure/structure.py b/src/diffpy/structure/structure.py index 5038bce2..1193b929 100644 --- a/src/diffpy/structure/structure.py +++ b/src/diffpy/structure/structure.py @@ -453,7 +453,7 @@ def __getitem__(self, idx): Parameters ---------- - idx : int ot str ot Iterable + idx : int or str or Iterable `Atom` identifier. When integer use standard list lookup. For iterables use numpy lookup, this supports integer or boolean flag arrays. For string or string-containing iterables @@ -566,7 +566,7 @@ def _fixlat(a): keep = set(super(Structure, self).__getitem__(idx)) v1 = (a if a in keep else Atom(a) for a in value) vfinal = filter(_fixlat, v1) - # handle scalar assingment + # handle scalar assignment else: vfinal = Atom(value) if copy else value vfinal.lattice = self.lattice diff --git a/src/diffpy/structure/symmetryutilities.py b/src/diffpy/structure/symmetryutilities.py index ea7a40d0..94a08421 100644 --- a/src/diffpy/structure/symmetryutilities.py +++ b/src/diffpy/structure/symmetryutilities.py @@ -147,7 +147,7 @@ class _Position2Tuple(object): Attributes ---------- eps : float - Cutoff for equivalent coordinates. When two coordiantes map to the + Cutoff for equivalent coordinates. When two coordinates map to the same tuple, they are closer than `eps`. """ From c787b24e9ee24832a147cf45181f7974e1b26f29 Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 14:39:48 -0400 Subject: [PATCH 43/56] skpkg: .github/ --- .codecov.yml | 8 ++--- .github/ISSUE_TEMPLATE/release_checklist.md | 31 +++++++++++++------ .../workflows/build-wheel-release-upload.yml | 6 ++-- .github/workflows/check-news-item.yml | 6 ++-- .../matrix-and-codecov-on-merge-to-main.yml | 4 +-- .github/workflows/tests-on-pr.yml | 7 ++--- 6 files changed, 36 insertions(+), 26 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 5a94096e..4af5eb24 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,14 +1,14 @@ coverage: status: - project: # more options at https://docs.codecov.com/docs/commit-status + project: # more options at https://docs.codecov.com/docs/commit-status default: target: auto # use the coverage from the base commit, fail if coverage is lower - threshold: 0% # allow the coverage to drop by + threshold: 0% # allow the coverage to drop by comment: layout: " diff, flags, files" behavior: default require_changes: false - require_base: false # [true :: must have a base report to post] - require_head: false # [true :: must have a head report to post] + require_base: false # [true :: must have a base report to post] + require_head: false # [true :: must have a head report to post] hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage] diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md index 0f560278..6107962c 100644 --- a/.github/ISSUE_TEMPLATE/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -6,30 +6,41 @@ labels: "release" assignees: "" --- -### PyPI/GitHub release checklist: +### PyPI/GitHub rc-release preparation checklist: - [ ] 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. + missing), tutorials, and other human-written text is up-to-date with any changes in the code. +- [ ] Installation instructions in the README, documentation, and the website are updated. - [ ] Successfully run any tutorial examples or do functional testing with the latest Python version. - [ ] Grammar and writing quality are checked (no typos). +- [ ] Install `pip install build twine`, run `python -m build` and `twine check dist/*` to ensure that the package can be built and is correctly formatted for PyPI release. -Please mention @sbillinge here when you are ready for PyPI/GitHub release. Include any additional comments necessary, such as -version information and details about the pre-release here: +Please tag the maintainer (e.g., @username) in the comment here when you are ready for the PyPI/GitHub release. Include any additional comments necessary, such as version information and details about the pre-release here: -### conda-forge release checklist: +### PyPI/GitHub full-release preparation checklist: - +- [ ] Create a new conda environment and install the rc from PyPI (`pip install ==??`) +- [ ] License information on PyPI is correct. +- [ ] Docs are deployed successfully to `https:///`. +- [ ] Successfully run all tests, tutorial examples or do functional testing. +Please let the maintainer know that all checks are done and the package is ready for full release. + +### conda-forge release preparation checklist: + + + +- [ ] Ensure that the full release has appeared on PyPI successfully. - [ ] New package dependencies listed in `conda.txt` and `test.txt` are added to `meta.yaml` in the feedstock. -- [ ] All relevant issues in the feedstock are addressed in the release PR. +- [ ] Close any open issues on the feedstock. Reach out to the maintainer if you have questions. +- [ ] Tag the maintainer for conda-forge release. ### Post-release checklist -- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments. -- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. +- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments. +- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml index c89ca95c..caeb09c4 100644 --- a/.github/workflows/build-wheel-release-upload.yml +++ b/.github/workflows/build-wheel-release-upload.yml @@ -4,13 +4,15 @@ on: workflow_dispatch: push: tags: - - '*' # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml + - "*" # 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 + uses: scikit-package/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0 with: project: diffpy.structure + c_extension: false + maintainer_GITHUB_username: sbillinge secrets: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} PAT_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml index 1301ca85..e5853983 100644 --- a/.github/workflows/check-news-item.yml +++ b/.github/workflows/check-news-item.yml @@ -3,10 +3,10 @@ name: Check for News on: pull_request_target: branches: - - main + - main jobs: - build: - uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 + check-news-item: + uses: scikit-package/release-scripts/.github/workflows/_check-news-item.yml@v0 with: project: diffpy.structure 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 743193f7..235c9f71 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -11,8 +11,8 @@ on: workflow_dispatch: jobs: - coverage: - uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 + matrix-coverage: + uses: scikit-package/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: project: diffpy.structure c_extension: false diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index 1dd2ee1b..1ac611fb 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -1,15 +1,12 @@ name: Tests on PR on: - push: - branches: - - main pull_request: workflow_dispatch: jobs: - validate: - uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 + tests-on-pr: + uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr.yml@v0 with: project: diffpy.structure c_extension: false From 4db5ce9bbfe126ef2f65bf0759cf04501a62a346 Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 14:48:42 -0400 Subject: [PATCH 44/56] skpkg: readme --- .gitignore | 8 +------- CHANGELOG.rst | 4 ++-- LICENSE.rst | 2 +- README.rst | 8 +++++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index a25212ea..099e2948 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__/ .Python env/ build/ +_build/ develop-eggs/ dist/ downloads/ @@ -90,10 +91,3 @@ target/ # Ipython Notebook .ipynb_checkpoints - -# version information -setup.cfg -/src/diffpy/*/version.cfg - -# Rever -rever/ diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2bf42c49..1be318f0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ ============= -Release Notes +Release notes ============= .. current developments @@ -28,7 +28,7 @@ Release Notes **Fixed:** * Add getting started section and re-arrange install success check instructions -* Added termial script for transtru app in pyproject.toml +* Added terminal script for transtru app in pyproject.toml * Changed requires-python to align with classifiers diff --git a/LICENSE.rst b/LICENSE.rst index 2e8d4ba9..1f91b0ba 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) 2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 2024-2025, 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: diff --git a/README.rst b/README.rst index cf7020c2..694315b7 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ :target: https://diffpy.github.io/diffpy.structure :height: 100px -|PyPi| |Forge| |PythonVersion| |PR| +|PyPI| |Forge| |PythonVersion| |PR| |CI| |Codecov| |Black| |Tracking| @@ -26,7 +26,7 @@ .. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff -.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.structure +.. |PyPI| image:: https://img.shields.io/pypi/v/diffpy.structure :target: https://pypi.org/project/diffpy.structure/ .. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.structure @@ -132,7 +132,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 `_. Acknowledgement --------------- @@ -143,6 +143,8 @@ originate from the `pymmlib project `_. Less common settings of space groups were generating using the `Computational Crystallography Toolbox `_. +``diffpy.structure`` is built and maintained with `scikit-package `_. + Contact ------- From b19f51ac36839bdd968df5e83cee901d296e2f7f Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 14:50:52 -0400 Subject: [PATCH 45/56] skpkg: devutils docformatter --- devutils/sgtbx_extra_groups.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/devutils/sgtbx_extra_groups.py b/devutils/sgtbx_extra_groups.py index 4cab28c2..1c718fa8 100644 --- a/devutils/sgtbx_extra_groups.py +++ b/devutils/sgtbx_extra_groups.py @@ -1,10 +1,11 @@ #!/usr/bin/env python -"""Quick and extremely dirty script for generating code for SpaceGroup that -are defined in cctbx, but not in mmLib. It was used to generate module -sgtbxspacegroups. +"""Quick and extremely dirty script for generating code for SpaceGroup +that are defined in cctbx, but not in mmLib. It was used to generate +module sgtbxspacegroups. -This is a utility script that should not be included with code distribution. +This is a utility script that should not be included with code +distribution. Not to be included with code distributions. """ @@ -40,7 +41,8 @@ def tupleToSGArray(tpl): def mmSpaceGroupFromSymbol(symbol): - """Construct SpaceGroup instance from a string symbol using sgtbx data.""" + """Construct SpaceGroup instance from a string symbol using sgtbx + data.""" sginfo = sgtbx.space_group_info(symbol) symop_list = [] symop_list = getSymOpList(sginfo.group()) From c3a578a6251c64ca61a2f9f54458c181b30e1d9b Mon Sep 17 00:00:00 2001 From: Ting Date: Thu, 19 Jun 2025 15:06:02 -0400 Subject: [PATCH 46/56] skpkg: fixed CODE-OF-CONDUCT.rst --- CODE-OF-CONDUCT.rst | 2 +- CODE_OF_CONDUCT.rst | 133 -------------------------------------------- 2 files changed, 1 insertion(+), 134 deletions(-) delete mode 100644 CODE_OF_CONDUCT.rst diff --git a/CODE-OF-CONDUCT.rst b/CODE-OF-CONDUCT.rst index ff9c3561..e8199ca5 100644 --- a/CODE-OF-CONDUCT.rst +++ b/CODE-OF-CONDUCT.rst @@ -8,7 +8,7 @@ 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, +identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst deleted file mode 100644 index e8199ca5..00000000 --- a/CODE_OF_CONDUCT.rst +++ /dev/null @@ -1,133 +0,0 @@ -===================================== - 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, socioeconomic 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 `_ From 293dcd66327436d21919a01d6a46b8a7088b2b23 Mon Sep 17 00:00:00 2001 From: Yuchen Ethan Xiao Date: Tue, 22 Jul 2025 16:46:40 -0400 Subject: [PATCH 47/56] style: use `docs` and `requirements/tests.txt` according to the new group standard --- .flake8 | 2 +- .github/ISSUE_TEMPLATE/release_checklist.md | 2 +- .readthedocs.yaml | 2 +- {doc => docs}/Makefile | 0 {doc => docs}/make.bat | 0 {doc => docs}/manual/Makefile | 0 {doc => docs}/manual/requirements.txt | 0 {doc => docs}/source/_static/.placeholder | 0 {doc => docs}/source/api/diffpy.structure.apps.rst | 0 {doc => docs}/source/api/diffpy.structure.expansion.rst | 0 {doc => docs}/source/api/diffpy.structure.parsers.rst | 0 {doc => docs}/source/api/diffpy.structure.rst | 0 {doc => docs}/source/conf.py | 4 ++-- {doc => docs}/source/diffpy.structure.apps.rst | 0 {doc => docs}/source/diffpy.structure.expansion.rst | 0 {doc => docs}/source/diffpy.structure.parsers.rst | 0 {doc => docs}/source/img/.placeholder | 0 {doc => docs}/source/index.rst | 0 {doc => docs}/source/license.rst | 0 {doc => docs}/source/mod-atom.rst | 0 {doc => docs}/source/mod-lattice.rst | 0 {doc => docs}/source/mod-spacegroup.rst | 0 {doc => docs}/source/release.rst | 0 {doc => docs}/source/snippets/.placeholder | 0 requirements/{test.txt => tests.txt} | 0 25 files changed, 5 insertions(+), 5 deletions(-) rename {doc => docs}/Makefile (100%) rename {doc => docs}/make.bat (100%) rename {doc => docs}/manual/Makefile (100%) rename {doc => docs}/manual/requirements.txt (100%) rename {doc => docs}/source/_static/.placeholder (100%) rename {doc => docs}/source/api/diffpy.structure.apps.rst (100%) rename {doc => docs}/source/api/diffpy.structure.expansion.rst (100%) rename {doc => docs}/source/api/diffpy.structure.parsers.rst (100%) rename {doc => docs}/source/api/diffpy.structure.rst (100%) rename {doc => docs}/source/conf.py (99%) rename {doc => docs}/source/diffpy.structure.apps.rst (100%) rename {doc => docs}/source/diffpy.structure.expansion.rst (100%) rename {doc => docs}/source/diffpy.structure.parsers.rst (100%) rename {doc => docs}/source/img/.placeholder (100%) rename {doc => docs}/source/index.rst (100%) rename {doc => docs}/source/license.rst (100%) rename {doc => docs}/source/mod-atom.rst (100%) rename {doc => docs}/source/mod-lattice.rst (100%) rename {doc => docs}/source/mod-spacegroup.rst (100%) rename {doc => docs}/source/release.rst (100%) rename {doc => docs}/source/snippets/.placeholder (100%) rename requirements/{test.txt => tests.txt} (100%) diff --git a/.flake8 b/.flake8 index 04d2d0b0..a5105116 100644 --- a/.flake8 +++ b/.flake8 @@ -6,7 +6,7 @@ exclude = __pycache__, build, dist, - doc/source/conf.py + docs/source/conf.py max-line-length = 115 # 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 diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md index 6107962c..56bcd015 100644 --- a/.github/ISSUE_TEMPLATE/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -34,7 +34,7 @@ Please let the maintainer know that all checks are done and the package is ready - [ ] Ensure that the full release has appeared on PyPI successfully. -- [ ] New package dependencies listed in `conda.txt` and `test.txt` are added to `meta.yaml` in the feedstock. +- [ ] New package dependencies listed in `conda.txt` and `tests.txt` are added to `meta.yaml` in the feedstock. - [ ] Close any open issues on the feedstock. Reach out to the maintainer if you have questions. - [ ] Tag the maintainer for conda-forge release. diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 47f7a017..aaa88895 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,4 +10,4 @@ python: - requirements: requirements/docs.txt sphinx: - configuration: doc/source/conf.py + configuration: docs/source/conf.py diff --git a/doc/Makefile b/docs/Makefile similarity index 100% rename from doc/Makefile rename to docs/Makefile diff --git a/doc/make.bat b/docs/make.bat similarity index 100% rename from doc/make.bat rename to docs/make.bat diff --git a/doc/manual/Makefile b/docs/manual/Makefile similarity index 100% rename from doc/manual/Makefile rename to docs/manual/Makefile diff --git a/doc/manual/requirements.txt b/docs/manual/requirements.txt similarity index 100% rename from doc/manual/requirements.txt rename to docs/manual/requirements.txt diff --git a/doc/source/_static/.placeholder b/docs/source/_static/.placeholder similarity index 100% rename from doc/source/_static/.placeholder rename to docs/source/_static/.placeholder diff --git a/doc/source/api/diffpy.structure.apps.rst b/docs/source/api/diffpy.structure.apps.rst similarity index 100% rename from doc/source/api/diffpy.structure.apps.rst rename to docs/source/api/diffpy.structure.apps.rst diff --git a/doc/source/api/diffpy.structure.expansion.rst b/docs/source/api/diffpy.structure.expansion.rst similarity index 100% rename from doc/source/api/diffpy.structure.expansion.rst rename to docs/source/api/diffpy.structure.expansion.rst diff --git a/doc/source/api/diffpy.structure.parsers.rst b/docs/source/api/diffpy.structure.parsers.rst similarity index 100% rename from doc/source/api/diffpy.structure.parsers.rst rename to docs/source/api/diffpy.structure.parsers.rst diff --git a/doc/source/api/diffpy.structure.rst b/docs/source/api/diffpy.structure.rst similarity index 100% rename from doc/source/api/diffpy.structure.rst rename to docs/source/api/diffpy.structure.rst diff --git a/doc/source/conf.py b/docs/source/conf.py similarity index 99% rename from doc/source/conf.py rename to docs/source/conf.py index 6e3d83bc..15ccfef6 100644 --- a/doc/source/conf.py +++ b/docs/source/conf.py @@ -139,7 +139,7 @@ "github_user": "diffpy", "github_repo": "diffpy.structure", "github_version": "main", - "conf_py_path": "/doc/source/", + "conf_py_path": "/docs/source/", } # Theme options are theme-specific and customize the look and feel of a theme @@ -222,7 +222,7 @@ # Output file base name for HTML help builder. basename = "diffpy.structure".replace(" ", "").replace(".", "") -htmlhelp_basename = basename + "doc" +htmlhelp_basename = basename + "docs" # -- Options for LaTeX output --------------------------------------------- diff --git a/doc/source/diffpy.structure.apps.rst b/docs/source/diffpy.structure.apps.rst similarity index 100% rename from doc/source/diffpy.structure.apps.rst rename to docs/source/diffpy.structure.apps.rst diff --git a/doc/source/diffpy.structure.expansion.rst b/docs/source/diffpy.structure.expansion.rst similarity index 100% rename from doc/source/diffpy.structure.expansion.rst rename to docs/source/diffpy.structure.expansion.rst diff --git a/doc/source/diffpy.structure.parsers.rst b/docs/source/diffpy.structure.parsers.rst similarity index 100% rename from doc/source/diffpy.structure.parsers.rst rename to docs/source/diffpy.structure.parsers.rst diff --git a/doc/source/img/.placeholder b/docs/source/img/.placeholder similarity index 100% rename from doc/source/img/.placeholder rename to docs/source/img/.placeholder diff --git a/doc/source/index.rst b/docs/source/index.rst similarity index 100% rename from doc/source/index.rst rename to docs/source/index.rst diff --git a/doc/source/license.rst b/docs/source/license.rst similarity index 100% rename from doc/source/license.rst rename to docs/source/license.rst diff --git a/doc/source/mod-atom.rst b/docs/source/mod-atom.rst similarity index 100% rename from doc/source/mod-atom.rst rename to docs/source/mod-atom.rst diff --git a/doc/source/mod-lattice.rst b/docs/source/mod-lattice.rst similarity index 100% rename from doc/source/mod-lattice.rst rename to docs/source/mod-lattice.rst diff --git a/doc/source/mod-spacegroup.rst b/docs/source/mod-spacegroup.rst similarity index 100% rename from doc/source/mod-spacegroup.rst rename to docs/source/mod-spacegroup.rst diff --git a/doc/source/release.rst b/docs/source/release.rst similarity index 100% rename from doc/source/release.rst rename to docs/source/release.rst diff --git a/doc/source/snippets/.placeholder b/docs/source/snippets/.placeholder similarity index 100% rename from doc/source/snippets/.placeholder rename to docs/source/snippets/.placeholder diff --git a/requirements/test.txt b/requirements/tests.txt similarity index 100% rename from requirements/test.txt rename to requirements/tests.txt From a13bd26298d4aeb9dc4373ae3ad2f84ca207d38f Mon Sep 17 00:00:00 2001 From: Yuchen Ethan Xiao Date: Tue, 22 Jul 2025 16:52:46 -0400 Subject: [PATCH 48/56] chore: add news --- news/new-group-standard.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/new-group-standard.rst diff --git a/news/new-group-standard.rst b/news/new-group-standard.rst new file mode 100644 index 00000000..e1107145 --- /dev/null +++ b/news/new-group-standard.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Use the names CODE-OF-CONDUCT.rst, docs and requirements/tests.txt according to the new group standard. + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 5c747a3dd4047486ceb338e169f1260b3a5a1b8c Mon Sep 17 00:00:00 2001 From: Yuchen Ethan Xiao Date: Wed, 23 Jul 2025 19:01:42 -0400 Subject: [PATCH 49/56] fix: catch `YappsSyntaxError` as `StructureFormatErrro` --- news/catch-YapsSyntaxError.rst | 23 +++++++++++++++++++++++ src/diffpy/structure/parsers/p_cif.py | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 news/catch-YapsSyntaxError.rst diff --git a/news/catch-YapsSyntaxError.rst b/news/catch-YapsSyntaxError.rst new file mode 100644 index 00000000..7e35ae76 --- /dev/null +++ b/news/catch-YapsSyntaxError.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Let ``diffpy.structure`` pass the tests with ``pycifrw`` installed from ``PyPI``. + +**Security:** + +* diff --git a/src/diffpy/structure/parsers/p_cif.py b/src/diffpy/structure/parsers/p_cif.py index cb2f3fa1..c1d32fff 100644 --- a/src/diffpy/structure/parsers/p_cif.py +++ b/src/diffpy/structure/parsers/p_cif.py @@ -36,6 +36,7 @@ from diffpy.structure import Atom, Lattice, Structure from diffpy.structure.parsers import StructureParser from diffpy.structure.structureerrors import StructureFormatError +from CifFile.yapps3_compiled_rt import YappsSyntaxError # ---------------------------------------------------------------------------- @@ -408,7 +409,7 @@ def _parseCifDataSource(self, datasource): # stop after reading the first structure if self.stru is not None: break - except (StarError, ValueError, IndexError) as err: + except (YappsSyntaxError, StarError, ValueError, IndexError) as err: exc_type, exc_value, exc_traceback = sys.exc_info() emsg = str(err).strip() e = StructureFormatError(emsg) From b910f8767bdbeb83c2fbcfe0ae48d363437621eb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:17:18 +0000 Subject: [PATCH 50/56] [pre-commit.ci] auto fixes from pre-commit hooks --- src/diffpy/structure/parsers/p_cif.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffpy/structure/parsers/p_cif.py b/src/diffpy/structure/parsers/p_cif.py index c1d32fff..3d0611ab 100644 --- a/src/diffpy/structure/parsers/p_cif.py +++ b/src/diffpy/structure/parsers/p_cif.py @@ -32,11 +32,11 @@ from contextlib import contextmanager import numpy +from CifFile.yapps3_compiled_rt import YappsSyntaxError from diffpy.structure import Atom, Lattice, Structure from diffpy.structure.parsers import StructureParser from diffpy.structure.structureerrors import StructureFormatError -from CifFile.yapps3_compiled_rt import YappsSyntaxError # ---------------------------------------------------------------------------- From 2316eaa8bfc4eeaa0e5fc9a3f4a12b80ddccfb5e Mon Sep 17 00:00:00 2001 From: sbillinge <4254545+sbillinge@users.noreply.github.com> Date: Fri, 25 Jul 2025 01:01:32 +0000 Subject: [PATCH 51/56] update changelog --- CHANGELOG.rst | 17 +++++++++++++++++ news/catch-YapsSyntaxError.rst | 23 ----------------------- news/codecov.rst | 24 ------------------------ news/new-group-standard.rst | 23 ----------------------- 4 files changed, 17 insertions(+), 70 deletions(-) delete mode 100644 news/catch-YapsSyntaxError.rst delete mode 100644 news/codecov.rst delete mode 100644 news/new-group-standard.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1be318f0..66a1a4b8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,23 @@ Release notes .. current developments +3.3.1 +===== + +**Added:** + +* Spelling check via Codespell in pre-commit +* Coverage report in each PR + +**Changed:** + +* Use the names CODE-OF-CONDUCT.rst, docs and requirements/tests.txt according to the new group standard. + +**Fixed:** + +* Let ``diffpy.structure`` pass the tests with ``pycifrw`` installed from ``PyPI``. + + 3.3.0 ===== diff --git a/news/catch-YapsSyntaxError.rst b/news/catch-YapsSyntaxError.rst deleted file mode 100644 index 7e35ae76..00000000 --- a/news/catch-YapsSyntaxError.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Let ``diffpy.structure`` pass the tests with ``pycifrw`` installed from ``PyPI``. - -**Security:** - -* diff --git a/news/codecov.rst b/news/codecov.rst deleted file mode 100644 index 1c91077e..00000000 --- a/news/codecov.rst +++ /dev/null @@ -1,24 +0,0 @@ -**Added:** - -* Spelling check via Codespell in pre-commit -* Coverage report in each PR - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/new-group-standard.rst b/news/new-group-standard.rst deleted file mode 100644 index e1107145..00000000 --- a/news/new-group-standard.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* Use the names CODE-OF-CONDUCT.rst, docs and requirements/tests.txt according to the new group standard. - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* From 0a5d4414f597abb45a81919ca1439154d4ea27ee Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 21 Nov 2025 16:56:10 -0500 Subject: [PATCH 52/56] add deprecator --- src/diffpy/structure/__init__.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index e66c0879..4b531e89 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -33,8 +33,10 @@ * SymmetryError """ -# Interface definitions ------------------------------------------------------ +import sys + +import diffpy.structure as _structure from diffpy.structure.atom import Atom from diffpy.structure.lattice import Lattice from diffpy.structure.parsers import getParser @@ -45,6 +47,28 @@ # package version from diffpy.structure.version import __version__ +# Deprecations ------------------------------------------------------- +# Only use the backport for module shims + + +# @deprecated +# custom deprecator for diffpy.Structure module +class DeprecatedStructureModule: + """Proxy for backward compatibility of diffpy.Structure.""" + + def __getattr__(self, name): + import warnings + + warnings.warn( + "Module 'diffpy.Structure' is deprecated. Use 'diffpy.structure' instead.", + DeprecationWarning, + stacklevel=2, + ) + return getattr(_structure, name) + + +sys.modules["diffpy.Structure"] = DeprecatedStructureModule() + # top level routines From 275990058abfc1d914e0c40d11014da662ffb272 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 21 Nov 2025 16:56:53 -0500 Subject: [PATCH 53/56] news --- news/dep-warning1.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/dep-warning1.rst diff --git a/news/dep-warning1.rst b/news/dep-warning1.rst new file mode 100644 index 00000000..bd4b2fbd --- /dev/null +++ b/news/dep-warning1.rst @@ -0,0 +1,23 @@ +**Added:** + +* Add deprecation warning for ``diffpy.Structure`` import. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 73a6b13a856d8140eb6cee315674fb3a09b2ac53 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 21 Nov 2025 16:58:46 -0500 Subject: [PATCH 54/56] rm comment --- src/diffpy/structure/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index 4b531e89..3ab52b61 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -48,7 +48,6 @@ from diffpy.structure.version import __version__ # Deprecations ------------------------------------------------------- -# Only use the backport for module shims # @deprecated From 5841feb7e4502638bd85e7be1ca3bc40b8b05859 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Mon, 24 Nov 2025 09:56:08 -0500 Subject: [PATCH 55/56] update wording --- src/diffpy/structure/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index 3ab52b61..263ef216 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -59,7 +59,8 @@ def __getattr__(self, name): import warnings warnings.warn( - "Module 'diffpy.Structure' is deprecated. Use 'diffpy.structure' instead.", + "Module 'diffpy.Structure' is deprecated and will be removed in version 3.8. " + "Use 'diffpy.structure' instead.", DeprecationWarning, stacklevel=2, ) From 3c462a7b2414ebe2abe0022811d04bb62b87559d Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 25 Nov 2025 15:29:41 -0500 Subject: [PATCH 56/56] Update deprecation warning for diffpy.Structure module --- src/diffpy/structure/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index 263ef216..62778b45 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -59,7 +59,7 @@ def __getattr__(self, name): import warnings warnings.warn( - "Module 'diffpy.Structure' is deprecated and will be removed in version 3.8. " + "Module 'diffpy.Structure' is deprecated and will be removed in version 4.0. " "Use 'diffpy.structure' instead.", DeprecationWarning, stacklevel=2,