Skip to content

Recut - support Py3.13, add checklist, codespell #100

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 2 additions & 0 deletions .codespell/ignore_lines.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Please include filenames and explanations for each ignored line.
;; See https://docs.openverse.org/meta/codespell.html for docs.
17 changes: 17 additions & 0 deletions .codespell/ignore_words.txt
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions .coveragerc

This file was deleted.

16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Bug Report or Feature Request
about: Report a bug or suggest a new feature!
title: ""
labels: ""
assignees: ""
---

### Problem

<!--
For a bug report, please copy and paste any error messages from the application or command-line here.
For a feature request, please state how the new functionality could benefit the community.
-->

### Proposed solution
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Release
about: Checklist and communication channel for PyPI and GitHub release
title: "Ready for <version-number> 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 <package-name>=??`)
- [ ] License information at Pypi is verified as correct.
- [ ] Docs deployed successfully to `<package-name>.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:

<!-- After @sbillinge releases the PyPI package, please check the following when creating a PR for conda-forge release.-->

- [ ] 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

<!-- Before closing this issue, please complete the following: -->

- [ ] 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.
16 changes: 16 additions & 0 deletions .github/workflows/build-wheel-release-upload.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion .github/workflows/check-news-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/matrix-and-codecov-on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/publish-docs-on-release.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
11 changes: 10 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
4 changes: 2 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Authors
=======

Billinge Group and community contibutors.
Billinge Group and community contributors.

----

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <examples/Ni_calculation.py>`.
The scripts can be downloaded :download:`here <examples/Ni_calculation.py>`.

=======================================
Example 2: Performing simple refinement
Expand Down
23 changes: 23 additions & 0 deletions news/py313.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Python 3.13 support

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* Python 3.10 support

**Fixed:**

* <news item>

**Security:**

* <news item>
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ maintainers = [
{ name="Simon J.L. Billinge group", email="[email protected]" },
]
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',
Expand All @@ -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',
]
Expand All @@ -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?$'
Expand Down
14 changes: 7 additions & 7 deletions src/diffpy/pdffit2/pdffit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
Loading