Skip to content

Commit 1521c33

Browse files
authored
Merge pull request #76 from cadenmyers13/new-scikit
fix: Update `.github/` and `.pre-commit-config.yaml`
2 parents e2a9438 + 4bc59e2 commit 1521c33

14 files changed

+91
-70
lines changed

Diff for: .codecov.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
coverage:
22
status:
3-
project: # more options at https://docs.codecov.com/docs/commit-status
3+
project: # more options at https://docs.codecov.com/docs/commit-status
44
default:
55
target: auto # use the coverage from the base commit, fail if coverage is lower
6-
threshold: 0% # allow the coverage to drop by
6+
threshold: 0% # allow the coverage to drop by
77

88
comment:
99
layout: " diff, flags, files"
1010
behavior: default
1111
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]
12+
require_base: false # [true :: must have a base report to post]
13+
require_head: false # [true :: must have a head report to post]
1414
hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]

Diff for: .github/ISSUE_TEMPLATE/release_checklist.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ assignees: ""
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.
15+
missing), tutorials, and other human-written text is up-to-date with any changes in the code.
1616
- [ ] Installation instructions in the README, documentation, and the website (e.g., diffpy.org) are updated.
1717
- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version.
1818
- [ ] 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.
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.
2020

2121
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:
2222

@@ -42,5 +42,5 @@ Please let @sbillinge know that all checks are done and the package is ready for
4242

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

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.
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

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- '*' # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml
7+
- "*" # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml
88

99
jobs:
1010
release:
1111
uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0
1212
with:
1313
project: diffpy.fourigui
14+
c_extension: false
15+
github_admin_username: sbillinge
1416
secrets:
1517
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
1618
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Check for News
33
on:
44
pull_request_target:
55
branches:
6-
- main
6+
- 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.fourigui

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14-
coverage:
14+
matrix-coverage:
1515
uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
1616
with:
1717
project: diffpy.fourigui

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

-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
name: Deploy Documentation on Release
22

33
on:
4-
release:
5-
types: [published]
64
workflow_dispatch:
75

86
jobs:
97
docs:
10-
permissions:
11-
contents: write
128
uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0
139
with:
1410
project: diffpy.fourigui

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
validate:
11+
tests-on-pr:
1212
uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0
1313
with:
1414
project: diffpy.fourigui

Diff for: .pre-commit-config.yaml

+26-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
default_language_version:
2-
python: python3
2+
python: python3
33
ci:
4-
autofix_commit_msg: |
5-
[pre-commit.ci] auto fixes from pre-commit hooks
6-
autofix_prs: true
7-
autoupdate_branch: 'pre-commit-autoupdate'
8-
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
9-
autoupdate_schedule: monthly
10-
skip: [no-commit-to-branch]
11-
submodules: false
4+
autofix_commit_msg: |
5+
[pre-commit.ci] auto fixes from pre-commit hooks
6+
autofix_prs: true
7+
autoupdate_branch: "pre-commit-autoupdate"
8+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
9+
autoupdate_schedule: monthly
10+
skip: [no-commit-to-branch]
11+
submodules: false
1212
repos:
1313
- repo: https://github.com/pre-commit/pre-commit-hooks
1414
rev: v4.6.0
@@ -47,6 +47,20 @@ repos:
4747
- repo: https://github.com/codespell-project/codespell
4848
rev: v2.3.0
4949
hooks:
50-
- id: codespell
51-
additional_dependencies:
52-
- tomli
50+
- id: codespell
51+
additional_dependencies:
52+
- tomli
53+
# prettier - multi formatter for .json, .yml, and .md files
54+
- repo: https://github.com/pre-commit/mirrors-prettier
55+
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
56+
hooks:
57+
- id: prettier
58+
additional_dependencies:
59+
- "prettier@^3.2.4"
60+
# docformatter - PEP 257 compliant docstring formatter
61+
- repo: https://github.com/s-weigand/docformatter
62+
rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
63+
hooks:
64+
- id: docformatter
65+
additional_dependencies: [tomli]
66+
args: [--in-place, --config, ./pyproject.toml]

Diff for: news/workflows.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* Modify `.github` directory and `.pre-commit-config.yaml` to comply with renaming of package maintainer.
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

Diff for: src/diffpy/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
1615
"""Blank namespace package for module diffpy."""
1716

1817

Diff for: src/diffpy/fourigui/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
1615
"""Tool for visualizing 3D diffraction and PDF Images."""
1716

1817
# package version

Diff for: src/diffpy/fourigui/fourigui.py

+24-35
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self):
2121
self.initUI()
2222

2323
def initUI(self):
24-
"""Initialize the GUI for fourigui"""
24+
"""Initialize the GUI for fourigui."""
2525

2626
self.loaded = False # denotes whether a dataset is loaded
2727
self.transformed = False # denotes whether dataset is Fourier transformed
@@ -254,11 +254,10 @@ def initUI(self):
254254
frame11.place(x=WIDTH // 2, y=HEIGHT // 2) # , height=HEIGHT//2, width=WIDTH//2)
255255

256256
def load_cube(self):
257-
"""
258-
loads 3D array in h5py file format from the filename input panel
259-
3D array is expected to be a reconstructed reciprocal scattering volume
260-
when executed, one slide perpendicular to the selected axis will be plotted in the plot panel
261-
"""
257+
"""Loads 3D array in h5py file format from the filename input panel 3D
258+
array is expected to be a reconstructed reciprocal scattering volume
259+
when executed, one slide perpendicular to the selected axis will be
260+
plotted in the plot panel."""
262261

263262
filename = self.filename_entry.get()
264263
f = h5py.File(filename, "r")
@@ -327,7 +326,7 @@ def load_cube(self):
327326
self.intensity_upd_global()
328327

329328
def plot_plane(self):
330-
"""update plotted plane perpendicular to the selected axis"""
329+
"""Update plotted plane perpendicular to the selected axis."""
331330
if self.axis.get() == 0:
332331
self.im.set_data(self.cube[self.plane_num.get(), :, :])
333332
elif self.axis.get() == 1:
@@ -339,7 +338,7 @@ def plot_plane(self):
339338
self.canvas.draw()
340339

341340
def colorrange_upd(self):
342-
"""change color range in plot"""
341+
"""Change color range in plot."""
343342
try:
344343
if self.colorbarmin.get() and self.colorbarmax.get():
345344
vmin = float(self.colorbarmin.get())
@@ -359,7 +358,8 @@ def colorrange_upd(self):
359358
self.plot_plane()
360359

361360
def intensity_upd_local(self):
362-
"""show local intensity minimum, maximum and sum of current plotted plane"""
361+
"""Show local intensity minimum, maximum and sum of current plotted
362+
plane."""
363363
if self.axis.get() == 0:
364364
plane = self.cube[self.plane_num.get(), :, :]
365365
elif self.axis.get() == 1:
@@ -373,7 +373,7 @@ def intensity_upd_local(self):
373373
self.localnanratio["text"] = f"{round(nan_ratio, 2)}"
374374

375375
def intensity_upd_global(self):
376-
"""Load global intensity minimum, maximum and sum of 3D array"""
376+
"""Load global intensity minimum, maximum and sum of 3D array."""
377377
self.intensity_upd_local()
378378
nan_ratio = np.count_nonzero(np.isnan(self.cube)) / self.cube.size
379379
self.globalmax["text"] = f"{np.format_float_scientific(np.nanmax(self.cube), 1)}"
@@ -382,10 +382,8 @@ def intensity_upd_global(self):
382382
self.globalnanratio["text"] = "{}".format(round(nan_ratio, 2))
383383

384384
def fft(self):
385-
"""
386-
Fourier transform 3D array from reciprocal to real space
387-
the origin of reciprocal and real space is expected to be the central voxel
388-
"""
385+
"""Fourier transform 3D array from reciprocal to real space the origin
386+
of reciprocal and real space is expected to be the central voxel."""
389387

390388
def perform_fft(fftholder):
391389
fftholder = np.nan_to_num(fftholder)
@@ -438,10 +436,9 @@ def perform_fft(fftholder):
438436
self.intensity_upd_global()
439437

440438
def ifft(self):
441-
"""
442-
Inverse Fourier transform 3D array from real to reciprocal space
443-
the origin of real and reciprocal space is expected to be the central voxel
444-
"""
439+
"""Inverse Fourier transform 3D array from real to reciprocal space the
440+
origin of real and reciprocal space is expected to be the central
441+
voxel."""
445442
if not self.cutoff.get():
446443
self.cube_real = self.cube
447444
self.cube = self.cube_reci
@@ -455,8 +452,7 @@ def ifft(self):
455452
self.intensity_upd_global()
456453

457454
def applycutoff(self):
458-
"""
459-
shape the reciprocal-space array
455+
"""Shape the reciprocal-space array.
460456
461457
reassign all voxels with distance smaller than qmin and greater than qmax
462458
to np.nan.
@@ -507,9 +503,8 @@ def applycutoff(self):
507503
self.intensity_upd_global()
508504

509505
def redocutuff(self):
510-
"""
511-
Redo the cutoff operation depending on the current space (real or reciprocal).
512-
"""
506+
"""Redo the cutoff operation depending on the current space (real or
507+
reciprocal)."""
513508
if self.space.get(): # in real space
514509
self.cube_realcut = self.cube
515510
if not self.transformed:
@@ -522,9 +517,8 @@ def redocutuff(self):
522517
self.intensity_upd_global()
523518

524519
def newcutoff(self):
525-
"""
526-
Apply a new cutoff based on the current space and cutoff settings.
527-
"""
520+
"""Apply a new cutoff based on the current space and cutoff
521+
settings."""
528522
if self.cutoff.get():
529523
if self.space.get() and self.transformed:
530524
self.cube = self.cube_real
@@ -535,9 +529,8 @@ def newcutoff(self):
535529
self.applycutoff()
536530

537531
def plot_next_plane(self):
538-
"""
539-
Plot the next plane in the dataset, looping back to the first if at the end.
540-
"""
532+
"""Plot the next plane in the dataset, looping back to the first if at
533+
the end."""
541534
n = self.plane_num.get()
542535
if n == len(self.cube[self.axis.get()]) - 1:
543536
n = 0
@@ -547,9 +540,7 @@ def plot_next_plane(self):
547540
self.plot_plane()
548541

549542
def animation(self):
550-
"""
551-
slices through the 3D array along the selected axis
552-
"""
543+
"""Slices through the 3D array along the selected axis."""
553544
try:
554545
if not self.anientry.get():
555546
anispeed = 1
@@ -563,9 +554,7 @@ def animation(self):
563554
self.plot_next_plane()
564555

565556
def multiple_funcs(*funcs):
566-
"""
567-
Executes multiple functions passed as arguments in sequence.
568-
"""
557+
"""Executes multiple functions passed as arguments in sequence."""
569558
for func in funcs:
570559
func
571560

Diff for: src/diffpy/fourigui/version.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
1615
"""Definition of __version__."""
1716

1817
# We do not use the other three variables, but can be added back if needed.

Diff for: tests/test_version.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
"""Unit tests for __version__.py
2-
"""
1+
"""Unit tests for __version__.py."""
32

43
import diffpy.fourigui
54

65

76
def test_package_version():
8-
"""Ensure the package version is defined and not set to the initial placeholder."""
7+
"""Ensure the package version is defined and not set to the initial
8+
placeholder."""
99
assert hasattr(diffpy.fourigui, "__version__")
1010
assert diffpy.fourigui.__version__ != "0.0.0"

0 commit comments

Comments
 (0)