Skip to content

Commit dd9f989

Browse files
authored
Re-cookiecut: implement codecov, install pdffit2 rc, limit to py3.12 (#235)
* Add codespell, github workflows * Reset codecov.yml, fix github CI with non-reusable * Add pre-commit - codespell * Manually install pdffit2 and wxpython diffpy.utils matplotlib * apply precomit * Conda install wxpython * Add news * Set latest python version in matrix CI to 3.12 * Fix spelling suggested by codespell
1 parent ed56f46 commit dd9f989

38 files changed

+263
-120
lines changed

Diff for: .codecov.yml

+11-31
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
1-
# codecov can find this file anywhere in the repo, so we don't need to clutter
2-
# the root folder.
3-
#comment: false
4-
5-
codecov:
6-
notify:
7-
require_ci_to_pass: no
8-
91
coverage:
102
status:
11-
patch:
3+
project: # more options at https://docs.codecov.com/docs/commit-status
124
default:
13-
target: '70'
14-
if_no_uploads: error
15-
if_not_found: success
16-
if_ci_failed: failure
17-
project:
18-
default: false
19-
library:
20-
target: auto
21-
if_no_uploads: error
22-
if_not_found: success
23-
if_ci_failed: error
24-
paths: '!*/tests/.*'
25-
26-
tests:
27-
target: 97.9%
28-
paths: '*/tests/.*'
29-
if_not_found: success
30-
31-
flags:
32-
tests:
33-
paths:
34-
- tests/
5+
target: auto # use the coverage from the base commit, fail if coverage is lower
6+
threshold: 0% # allow the coverage to drop by
7+
8+
comment:
9+
layout: " diff, flags, files"
10+
behavior: default
11+
require_changes: false
12+
require_base: false # [true :: must have a base report to post]
13+
require_head: false # [true :: must have a head report to post]
14+
hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]

Diff for: .codespell/ignore_lines.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
;; Please include filenames and explanations for each ignored line.
2+
;; See https://docs.openverse.org/meta/codespell.html for docs.

Diff for: .codespell/ignore_words.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
;; Please include explanations for each ignored word (lowercase).
2+
;; See https://docs.openverse.org/meta/codespell.html for docs.
3+
4+
;; abbreviation for "materials" often used in a journal title
5+
mater
6+
7+
;; alternative use of socioeconomic
8+
socio-economic
9+
10+
;; Frobenius norm used in np.linalg.norm
11+
fro
12+
13+
;; abbreviation for "structure"
14+
struc
15+
16+
;; method name within JournalPanel class
17+
onText
18+
19+
;; a method name within JournalPanel class
20+
delt

Diff for: .coveragerc

-13
This file was deleted.

Diff for: .github/ISSUE_TEMPLATE/release_checklist.md

+33-9
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,41 @@ labels: "release"
66
assignees: ""
77
---
88

9-
### Release checklist for GitHub contributors
9+
### PyPI/GitHub rc-release preparation checklist:
1010

1111
- [ ] All PRs/issues attached to the release are merged.
1212
- [ ] All the badges on the README are passing.
1313
- [ ] License information is verified as correct. If you are unsure, please comment below.
1414
- [ ] Locally rendered documentation contains all appropriate pages, including API references (check no modules are
15-
missing), tutorials, and other human written text is up-to-date with any changes in the code.
16-
- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) are updated and
17-
tested
18-
- [ ] Successfully run any tutorial examples or do functional testing in some other way.
19-
- [ ] Grammar and writing quality have been checked (no typos).
20-
21-
Please mention @sbillinge when you are ready for release. Include any additional comments necessary, such as
22-
version information and details about the pre-release.
15+
missing), tutorials, and other human-written text is up-to-date with any changes in the code.
16+
- [ ] Installation instructions in the README, documentation, and the website (e.g., diffpy.org) are updated.
17+
- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version.
18+
- [ ] Grammar and writing quality are checked (no typos).
19+
- [ ] 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.
20+
21+
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:
22+
23+
### PyPI/GitHub full-release preparation checklist:
24+
25+
- [ ] Create a new conda environment and install the rc from PyPI (`pip install <package-name>==??`)
26+
- [ ] License information on PyPI is correct.
27+
- [ ] Docs are deployed successfully to `https://www.diffpy.org/<package-name>`.
28+
- [ ] Successfully run all tests, tutorial examples or do functional testing.
29+
30+
Please let @sbillinge know that all checks are done and the package is ready for full release.
31+
32+
### conda-forge release preparation checklist:
33+
34+
<!-- After @sbillinge releases the PyPI package, please check the following when creating a PR for conda-forge release.-->
35+
36+
- [ ] Ensure that the full release has appeared on PyPI successfully.
37+
- [ ] New package dependencies listed in `conda.txt` and `test.txt` are added to `meta.yaml` in the feedstock.
38+
- [ ] Close any open issues on the feedstock. Reach out to @bobleesj if you have questions.
39+
- [ ] Tag @sbillinge and @bobleesj for conda-forge release.
40+
41+
### Post-release checklist
42+
43+
<!-- Before closing this issue, please complete the following: -->
44+
45+
- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments.
46+
- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures.

Diff for: .github/workflows/build-wheel-release-upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release (GitHub/PyPI)
1+
name: Release (GitHub/PyPI) and Deploy Docs
22

33
on:
44
workflow_dispatch:

Diff for: .github/workflows/check-news-item.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- main
77

88
jobs:
9-
build:
9+
check-news-item:
1010
uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0
1111
with:
1212
project: diffpy.pdfgui

Diff for: .github/workflows/matrix-and-codecov-on-merge-to-main.yml

+58-7
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,61 @@ on:
1212

1313
jobs:
1414
coverage:
15-
uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
16-
with:
17-
project: diffpy.pdfgui
18-
c_extension: false
19-
headless: true
20-
secrets:
21-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
15+
defaults:
16+
run:
17+
shell: bash -l {0}
18+
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
24+
python-version: ["3.11", "3.12"]
25+
env:
26+
LATEST_PYTHON_VERSION: "3.12"
27+
steps:
28+
- name: Check out diffpy.pdfgui
29+
uses: actions/checkout@v4
30+
31+
- name: Initialize miniconda
32+
uses: conda-incubator/setup-miniconda@v3
33+
with:
34+
activate-environment: test
35+
auto-update-conda: true
36+
environment-file: environment.yml
37+
auto-activate-base: false
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Conda config
41+
run: >-
42+
conda config --set always_yes yes
43+
--set changeps1 no
44+
45+
- name: Install diffpy.pdfgui and requirements
46+
run: |
47+
conda install --file requirements/test.txt
48+
conda install wxpython diffpy.utils matplotlib-base
49+
pip install diffpy.pdffit2==1.4.4rc6
50+
python -m pip install . --no-deps
51+
52+
- name: Start Xvfb for ubuntu-latest only
53+
if: matrix.os == 'ubuntu-latest'
54+
run: |
55+
sudo apt-get install -y xvfb
56+
export DISPLAY=:99
57+
Xvfb :99 -screen 0 1024x768x16 &
58+
59+
- name: Validate diffpy.pdfgui
60+
run: |
61+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
62+
export DISPLAY=:99
63+
fi
64+
pytest --cov
65+
coverage report -m
66+
codecov
67+
68+
- name: Upload coverage to Codecov
69+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == env.LATEST_PYTHON_VERSION
70+
uses: codecov/codecov-action@v4
71+
env:
72+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Diff for: .github/workflows/publish-docs-on-release.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Build and Deploy Docs
1+
name: Deploy Documentation on Release
22

33
on:
44
release:
5-
types:
6-
- published
5+
types: [published]
76
workflow_dispatch:
87

98
jobs:
@@ -12,3 +11,5 @@ jobs:
1211
with:
1312
project: diffpy.pdfgui
1413
c_extension: false
14+
headless: true
15+
python_version: 3.12

Diff for: .github/workflows/tests-on-pr.yml

+49-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,52 @@ on:
99

1010
jobs:
1111
validate:
12-
uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0
13-
with:
14-
project: diffpy.pdfgui
15-
c_extension: false
16-
headless: true
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check out diffpy.pdfgui
19+
uses: actions/checkout@v4
20+
21+
- name: Initialize miniconda
22+
uses: conda-incubator/setup-miniconda@v3
23+
with:
24+
activate-environment: test
25+
auto-update-conda: true
26+
environment-file: environment.yml
27+
auto-activate-base: false
28+
python-version: 3.12
29+
30+
- name: Conda config
31+
run: >-
32+
conda config --set always_yes yes
33+
--set changeps1 no
34+
35+
- name: Install diffpy.pdfgui and requirements
36+
run: |
37+
conda install --file requirements/test.txt
38+
conda install wxpython diffpy.utils matplotlib-base
39+
pip install diffpy.pdffit2==1.4.4rc6
40+
python -m pip install . --no-deps
41+
42+
- name: Start Xvfb
43+
run: |
44+
sudo apt-get install -y xvfb
45+
export DISPLAY=:99
46+
Xvfb :99 -screen 0 1024x768x16 &
47+
48+
- name: Validate diffpy.pdfgui
49+
run: |
50+
export DISPLAY=:99
51+
pytest --cov
52+
coverage report -m
53+
codecov
54+
55+
- name: Upload coverage to Codecov
56+
uses: codecov/codecov-action@v4
57+
with:
58+
verbose: true
59+
fail_ci_if_error: true
60+
token: ${{ secrets.CODECOV_TOKEN }}

Diff for: .pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ repos:
4444
name: Prevent Commit to Main Branch
4545
args: ["--branch", "main"]
4646
stages: [pre-commit]
47+
- repo: https://github.com/codespell-project/codespell
48+
rev: v2.3.0
49+
hooks:
50+
- id: codespell
51+
additional_dependencies:
52+
- tomli

Diff for: README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ trying to commit again.
132132

133133
Improvements and fixes are always appreciated.
134134

135-
Before contribuing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.pdfgui/blob/main/CODE_OF_CONDUCT.rst>`_.
135+
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.pdfgui/blob/main/CODE_OF_CONDUCT.rst>`_.
136136

137137
Contact
138138
-------

Diff for: doc/manual/html/readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
This directory need to be relativly the same as doc/build/html/manual from
1+
This directory need to be relatively the same as doc/build/html/manual from
22
doc/source/_static/images

Diff for: doc/manual/pdfgui.texinfo

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ requirements. This can be done either for all atoms in the structure or for an
243243
arbitrary subset - for example when it is known that only a certain species
244244
show a local distortion. The code for space group definitions was provided by
245245
the Python Macromolecular Library (mmLib,
246-
@url{http://pymmlib.sourceforge.net}). This was extened to include
246+
@url{http://pymmlib.sourceforge.net}). This was extended to include
247247
non-standard space groups using the Computational Crystallography Toolbox
248248
(cctbx, @uref{https://cctbx.github.io}). PDFgui also supports supercell
249249
expansion of a normal unit cell.

Diff for: news/codecov.rst

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
**Added:**
2+
3+
* Codecov coverage report in PRs
4+
* Spelling check with Codespell in pre-commit
5+
6+
**Changed:**
7+
8+
* <news item>
9+
10+
**Deprecated:**
11+
12+
* <news item>
13+
14+
**Removed:**
15+
16+
* <news item>
17+
18+
**Fixed:**
19+
20+
* <news item>
21+
22+
**Security:**
23+
24+
* <news item>

Diff for: pyproject.toml

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ maintainers = [
1414
description = "GUI for PDF simulation and structure refinement."
1515
keywords = ['PDF structure refinement GUI']
1616
readme = "README.rst"
17-
requires-python = ">=3.10"
17+
requires-python = ">=3.11, <3.13"
1818
classifiers = [
1919
'Development Status :: 5 - Production/Stable',
2020
'Environment :: Console',
@@ -25,7 +25,6 @@ classifiers = [
2525
'Operating System :: Microsoft :: Windows',
2626
'Operating System :: POSIX',
2727
'Operating System :: Unix',
28-
'Programming Language :: Python :: 3.10',
2928
'Programming Language :: Python :: 3.11',
3029
'Programming Language :: Python :: 3.12',
3130
'Topic :: Scientific/Engineering :: Physics',
@@ -54,6 +53,11 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default)
5453
[tool.setuptools.dynamic]
5554
dependencies = {file = ["requirements/pip.txt"]}
5655

56+
[tool.codespell]
57+
exclude-file = ".codespell/ignore_lines.txt"
58+
ignore-words = ".codespell/ignore_words.txt"
59+
skip = "*.cif,*.dat,*.html,*.m,*.textinfo"
60+
5761
[tool.black]
5862
line-length = 115
5963
include = '\.pyi?$'

Diff for: src/diffpy/pdfgui/control/calculation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def load(self, z, subpath):
252252
z -- zipped project file
253253
subpath -- path to its own storage within project file
254254
255-
returns a tree of internal hierachy
255+
returns a tree of internal hierarchy
256256
"""
257257
config = pickle.loads(z.read(subpath + "config"), encoding="latin1")
258258
self.rmin = config["rmin"]

Diff for: src/diffpy/pdfgui/control/fitstructure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class FitStructure(PDFStructure):
3535
Class data members:
3636
symposeps -- tolerance for recognizing site as symmetry position
3737
38-
Data members (in adition to those in PDFStructure):
38+
Data members (in addition to those in PDFStructure):
3939
owner -- instance of parent Fitting (set in Organizer.add())
4040
initial -- initial structure, same as self
4141
refined -- refined structure when available or None

0 commit comments

Comments
 (0)