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..186fda9d --- /dev/null +++ b/.codespell/ignore_words.txt @@ -0,0 +1,17 @@ +;; 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 + +;; class name within distutils module +ccompiler + +;; structure file format +discus diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index edd0c0ba..00000000 --- a/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -source = - diffpy.pdffit2 -[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/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..ba1d40ce --- /dev/null +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -0,0 +1,44 @@ +--- +name: Release +about: Checklist and communication channel for PyPI and GitHub release +title: "Ready for PyPI/GitHub release" +labels: "release" +assignees: "" +--- + +### 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. +- [ ] 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 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: + +### PyPI/GitHub full-release preparation checklist: +- [ ] Create a new conda environment and install the rc from pypi (`pip install =??`) +- [ ] License information at Pypi is verified as correct. +- [ ] Docs deployed successfully to `.github.io` +- [ ] Successfully run all tests, tutorial examples or do functional testing + +Please let @sbillinge know that all checks are done and 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. +- [ ] Close any open issues on the feedstock. Reach out to @bobleesj if you have questions +- [ ] let @sbillinge and @bobleesj when this is ready + +### 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. diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml new file mode 100644 index 00000000..546bbe6d --- /dev/null +++ b/.github/workflows/build-wheel-release-upload.yml @@ -0,0 +1,16 @@ +name: Release (GitHub/PyPI) and Deploy Docs + +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.pdffit2 + 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 6a842da5..7a766a5c 100644 --- a/.github/workflows/check-news-item.yml +++ b/.github/workflows/check-news-item.yml @@ -6,7 +6,7 @@ on: - main jobs: - build: + check-news-item: uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 with: project: diffpy.pdffit2 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 0270fdf4..0f2caa54 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -11,7 +11,7 @@ on: workflow_dispatch: jobs: - coverage: + matrix-coverage: uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: project: diffpy.pdffit2 diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml deleted file mode 100644 index ea18f1f0..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.pdffit2 - c_extension: true diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index 31ad817a..06a55303 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -8,9 +8,11 @@ on: workflow_dispatch: jobs: - validate: + tests-on-pr: uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 with: project: diffpy.pdffit2 c_extension: true headless: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4588061..9cf0556f 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: @@ -41,3 +44,9 @@ repos: name: Prevent Commit to Main Branch args: ["--branch", "main"] stages: [pre-commit] + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli diff --git a/AUTHORS.rst b/AUTHORS.rst index d6679278..23ef2b2f 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,7 +1,7 @@ Authors ======= -Billinge Group and community contibutors. +Billinge Group and community contributors. ---- @@ -17,7 +17,7 @@ Previous significant contributors to this code were Pavol Juhas, Chris Farrow, Jacques Bloch, Wenduo Zhou -Please see the github contributions and the header of each source file +Please see the github contributions and the header of each source file for a detailed list of contributors. This is an open-source project and we hope and expect that the list of contributors will expand with time. Many thanks to diff --git a/README.rst b/README.rst index fa90b318..d9f026af 100644 --- a/README.rst +++ b/README.rst @@ -121,7 +121,7 @@ and run the following :: pip install . To confirm that the installation was successful, run the following in a terminal :: - + python -c "import diffpy.pdffit2; print(diffpy.pdffit2.__version__)" Support and Contribute diff --git a/doc/source/examples.rst b/doc/source/examples.rst index f793e585..300cc54c 100644 --- a/doc/source/examples.rst +++ b/doc/source/examples.rst @@ -59,7 +59,7 @@ The first example shows how to calculates the PDF for FCC nickel and saves the r # display plot window, this must be the last command in the script plt.show() -The scripts can be downloaded :download:`here `. +The scripts can be downloaded :download:`here `. ======================================= Example 2: Performing simple refinement diff --git a/news/py313.rst b/news/py313.rst new file mode 100644 index 00000000..899bc269 --- /dev/null +++ b/news/py313.rst @@ -0,0 +1,23 @@ +**Added:** + +* Python 3.13 support + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* Python 3.10 support + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index a25ee157..8a1b15c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,9 +12,9 @@ maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] description = "PDFfit2 - real space structure refinement program." -keywords = ['PDF structure refinement'] +keywords = ["PDF", "structure refinement"] readme = "README.rst" -requires-python = ">=3.10" +requires-python = ">=3.11, <3.14" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -25,9 +25,9 @@ classifiers = [ 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Operating System :: Unix', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Chemistry', ] @@ -51,6 +51,11 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} +[tool.codespell] +exclude-file = ".codespell/ignore_lines.txt" +ignore-words = ".codespell/ignore_words.txt" +skip = "*.cif,*.dat,*.cc,*.h" + [tool.black] line-length = 115 include = '\.pyi?$' diff --git a/src/diffpy/pdffit2/pdffit.py b/src/diffpy/pdffit2/pdffit.py index 255e8b0f..11f6f253 100644 --- a/src/diffpy/pdffit2/pdffit.py +++ b/src/diffpy/pdffit2/pdffit.py @@ -301,7 +301,7 @@ def calc(self): Raises: pdffit2.calculationError when allocated space cannot - accomodate calculation + accommodate calculation pdffit.unassignedError when space for calculation has not been allocated """ @@ -572,7 +572,7 @@ def getR(self): This function should only be called after data has been loaded or calculated. Before a refinement, the list of r-points will reflect the - data. Afterwords, they will reflect the fit range. + data. Afterwards, they will reflect the fit range. Raises: pdffit2.unassignedError if no data exists @@ -599,7 +599,7 @@ def getpdf_obs(self): This function should only be called after data has been loaded or calculated. Before a refinement, the list of r-points will reflect the - data. Afterwords, they will reflect the fit range. + data. Afterwards, they will reflect the fit range. Raises: pdffit2.unassignedError if no data exists @@ -613,7 +613,7 @@ def getpdf_diff(self): This function should only be called after data has been loaded or calculated. Before a refinement, the list of r-points will reflect the - data. Afterwords, they will reflect the fit range. + data. Afterwards, they will reflect the fit range. Raises: pdffit2.unassignedError if no data exists @@ -880,7 +880,7 @@ def blen(self, *args): if isinstance(a2, numbers.Integral): a2 = atom_types[a2 - 1] except IndexError: - # index of non-existant atom type + # index of non-existent atom type return # arguments are OK here, get bond length dictionary bld = pdffit2.bond_length_types(self._handle, a1, a2, lb, ub) @@ -930,8 +930,8 @@ def bond_length_types(self, a1, a2, lb, ub): Return a dictionary of distance data containing - dij : list of bond lenghts within given bounds - ddij : list of bond legnth standard deviations + dij : list of bond lengths within given bounds + ddij : list of bond length standard deviations ij0 : pairs of atom indices starting from 0 ij1 : pairs of atom indices starting from 1