From fb9b340e38bc840eb978bfa1d8c81d1eb7797386 Mon Sep 17 00:00:00 2001 From: Yuchen Xiao Date: Fri, 8 May 2026 20:07:37 -0400 Subject: [PATCH] fix: set correct inputs in the workflow and update pre-commit --- .../workflows/build-wheel-release-upload.yml | 2 +- .github/workflows/publish-docs-on-release.yml | 12 ------- .pre-commit-config.yaml | 33 +++++++++++-------- news/fix-workflow.rst | 23 +++++++++++++ news/tmp.rst | 2 +- src/diffpy/apps/pdfadapter.py | 3 +- tests/helper.py | 1 + 7 files changed, 47 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 news/fix-workflow.rst diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml index 3999b16..1d0ab9e 100644 --- a/.github/workflows/build-wheel-release-upload.yml +++ b/.github/workflows/build-wheel-release-upload.yml @@ -12,7 +12,7 @@ jobs: with: project: diffpy.apps c_extension: false - maintainer_GITHUB_username: ycexiao, sbillinge + maintainer_GITHUB_username: sbillinge secrets: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} PAT_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml deleted file mode 100644 index 3e01636..0000000 --- a/.github/workflows/publish-docs-on-release.yml +++ /dev/null @@ -1,12 +0,0 @@ -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.apps - c_extension: false - headless: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e4a84d..8d20a4b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,56 +11,61 @@ ci: submodules: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: - id: check-yaml + exclude: '^{{ cookiecutter.github_repo_name }}/.*\.yml$' # {{ cookiecutter.github_repo_name }} contains jinja variables in .yml, hook fails - id: end-of-file-fixer - id: trailing-whitespace - id: check-case-conflict - id: check-merge-conflict - id: check-toml + exclude: '^{{ cookiecutter.github_repo_name }}/.*\.toml$' # {{ cookiecutter.github_repo_name }} contains jinja variables in pyproject.toml, hook fails - id: check-added-large-files - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 26.3.1 hooks: - id: black + exclude: '^({{ cookiecutter.github_repo_name }}/.*\.py|hooks/post_gen_project\.py)$' # {{ cookiecutter.github_repo_name }} contains jinja variables in .py, hook fails. hooks/post_gen_project.py contains jinja variables of # (c) {% now 'utc', '%Y' %} which is not a valid black format - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.3.0 hooks: - id: flake8 - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 8.0.1 hooks: - id: isort + exclude: "{{ cookiecutter.github_repo_name }}/tests/test_functions.py" # ignore test_functions.py as it contains jinja variables args: ["--profile", "black"] - repo: https://github.com/kynan/nbstripout - rev: 0.7.1 + rev: 0.9.1 hooks: - id: nbstripout - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: no-commit-to-branch name: Prevent Commit to Main Branch args: ["--branch", "main"] stages: [pre-commit] - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.2 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 + rev: 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 + types: [yaml, markdown, json] + # ruff - An extremely fast Python linter and code formatter, written in Rust. + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.12 hooks: - - id: docformatter - additional_dependencies: [tomli] - args: [--in-place, --config, ./pyproject.toml] + - id: ruff-check + args: [--fix, --config=pyproject.toml] + exclude: ^\{\{\s*cookiecutter\.github_repo_name\s*\}\}/ diff --git a/news/fix-workflow.rst b/news/fix-workflow.rst new file mode 100644 index 0000000..d9b86aa --- /dev/null +++ b/news/fix-workflow.rst @@ -0,0 +1,23 @@ +**Added:** + +* No news added: Fix workflow inputs. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/news/tmp.rst b/news/tmp.rst index c5df9cf..e081b56 100644 --- a/news/tmp.rst +++ b/news/tmp.rst @@ -1,6 +1,6 @@ **Added:** -* No news added: +* No news added: **Changed:** diff --git a/src/diffpy/apps/pdfadapter.py b/src/diffpy/apps/pdfadapter.py index dc9b850..5ea27ac 100644 --- a/src/diffpy/apps/pdfadapter.py +++ b/src/diffpy/apps/pdfadapter.py @@ -3,6 +3,8 @@ from pathlib import Path import numpy +from scipy.optimize import least_squares + from diffpy.srfit.fitbase import ( FitContribution, FitRecipe, @@ -12,7 +14,6 @@ from diffpy.srfit.pdf import PDFGenerator, PDFParser from diffpy.srfit.structure import constrainAsSpaceGroup from diffpy.structure.parsers import getParser -from scipy.optimize import least_squares class PDFAdapter: diff --git a/tests/helper.py b/tests/helper.py index f557162..b4b1a4f 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -1,4 +1,5 @@ import numpy as np + from diffpy.srfit.fitbase import FitContribution, FitRecipe, Profile from diffpy.srfit.pdf import PDFGenerator, PDFParser from diffpy.srfit.structure import constrainAsSpaceGroup