From 44f7f5d9f91b81f3aa95eca409ab31f275c6c7b7 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Sat, 20 Sep 2025 18:02:12 -0400 Subject: [PATCH 1/8] skpkg: migrate src folder --- src/diffpy/__init__.py | 18 +++++------ src/diffpy/srxconfutils/__init__.py | 31 ++++++++----------- src/diffpy/srxconfutils/srxconfutils_app.py | 33 +++++++++++++++++++++ src/diffpy/srxconfutils/version.py | 33 ++++++++++----------- 4 files changed, 68 insertions(+), 47 deletions(-) create mode 100644 src/diffpy/srxconfutils/srxconfutils_app.py diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index 815245d..64cfe45 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -1,18 +1,14 @@ #!/usr/bin/env python ############################################################################## # -# dpx.confutils by Simon J. L. Billinge group -# (c) 2013 Trustees of the Columbia University -# in the City of New York. All rights reserved. +# (c) 2025 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Xiaohao Yang +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSENOTICE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.srxconfutils/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## -"""Blank namespace package.""" - -__import__("pkg_resources").declare_namespace(__name__) - -# End of file diff --git a/src/diffpy/srxconfutils/__init__.py b/src/diffpy/srxconfutils/__init__.py index af5892f..698badd 100644 --- a/src/diffpy/srxconfutils/__init__.py +++ b/src/diffpy/srxconfutils/__init__.py @@ -1,31 +1,24 @@ #!/usr/bin/env python ############################################################################## # -# dpx.confutils by Simon J. L. Billinge group -# (c) 2013 Trustees of the Columbia University -# in the City of New York. All rights reserved. +# (c) 2025 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Xiaohao Yang +# File coded by: Billinge Group members. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSENOTICE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.srxconfutils/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## +"""Configuration utilities for dpx project. -# package version -from diffpy.srxconfutils.version import __version__ - - -# unit tests -def test(): - """Execute all unit tests for the diffpy.pdfgetx package. - - Return a unittest TestResult object. - """ - from dpx.confutils.tests import test - - return test() +Part of xPDFsuite +""" +# package version +from diffpy.srxconfutils.version import __version__ # noqa # silence the pyflakes syntax checker assert __version__ or True diff --git a/src/diffpy/srxconfutils/srxconfutils_app.py b/src/diffpy/srxconfutils/srxconfutils_app.py new file mode 100644 index 0000000..f07f27b --- /dev/null +++ b/src/diffpy/srxconfutils/srxconfutils_app.py @@ -0,0 +1,33 @@ +import argparse + +from diffpy.srxconfutils.version import __version__ # noqa + + +def main(): + parser = argparse.ArgumentParser( + prog="diffpy.srxconfutils", + description=( + "Configuration utilities for dpx project. Part of xPDFsuite\n\n" + "For more information, visit: " + "https://github.com/diffpy/diffpy.srxconfutils/" + ), + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + + parser.add_argument( + "--version", + action="store_true", + help="Show the program's version number and exit", + ) + + args = parser.parse_args() + + if args.version: + print(f"diffpy.srxconfutils {__version__}") + else: + # Default behavior when no arguments are given + parser.print_help() + + +if __name__ == "__main__": + main() diff --git a/src/diffpy/srxconfutils/version.py b/src/diffpy/srxconfutils/version.py index 45736e1..cfc18b7 100644 --- a/src/diffpy/srxconfutils/version.py +++ b/src/diffpy/srxconfutils/version.py @@ -1,27 +1,26 @@ #!/usr/bin/env python ############################################################################## # -# dpx.confutils by Simon J. L. Billinge group -# (c) 2013 Trustees of the Columbia University -# in the City of New York. All rights reserved. +# (c) 2025 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Xiaohao Yang +# File coded by: Billinge Group members. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSENOTICE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.srxconfutils/graphs/contributors # noqa: E501 +# +# See LICENSE.rst for license information. # ############################################################################## -"""Definition of __version__ and __date__ for this package.""" - -# obtain version information -from pkg_resources import get_distribution +"""Definition of __version__.""" -_pkgname = __name__.rsplit(".", 1)[0] -__version__ = get_distribution(_pkgname).version +# We do not use the other three variables, but can be added back if needed. +# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] -# we assume that tag_date was used and __version__ ends in YYYYMMDD -__date__ = ( - __version__[-8:-4] + "-" + __version__[-4:-2] + "-" + __version__[-2:] -) +# obtain version information +from importlib.metadata import PackageNotFoundError, version -# End of file +try: + __version__ = version("diffpy.srxconfutils") +except PackageNotFoundError: + __version__ = "unknown" From 5f697c0a50b8f3eb60a2655d88c53dbbc4d220b1 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Sat, 20 Sep 2025 18:02:24 -0400 Subject: [PATCH 2/8] skpkg: migrate tests folder --- tests/conftest.py | 18 ++++++++++++++++++ tests/test_version.py | 10 ++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/test_version.py diff --git a/tests/conftest.py b/tests/conftest.py index 1242fa9..a3114ea 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,24 @@ +import json +from pathlib import Path + import pytest +@pytest.fixture +def user_filesystem(tmp_path): + base_dir = Path(tmp_path) + home_dir = base_dir / "home_dir" + home_dir.mkdir(parents=True, exist_ok=True) + cwd_dir = base_dir / "cwd_dir" + cwd_dir.mkdir(parents=True, exist_ok=True) + + home_config_data = {"username": "home_username", "email": "home@email.com"} + with open(home_dir / "diffpyconfig.json", "w") as f: + json.dump(home_config_data, f) + + yield tmp_path + + @pytest.fixture def temp_file(tmp_path): """Create a temporary file with known content.""" diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 0000000..e2d2c24 --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,10 @@ +"""Unit tests for __version__.py.""" + +import diffpy.srxconfutils # noqa + + +def test_package_version(): + """Ensure the package version is defined and not set to the initial + placeholder.""" + assert hasattr(diffpy.srxconfutils, "__version__") + assert diffpy.srxconfutils.__version__ != "0.0.0" From 24338ce4aa41fa493dafe6fd82d2ea32329cbb29 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Sat, 20 Sep 2025 18:07:57 -0400 Subject: [PATCH 3/8] skpkg: list dependencies in requirements folder --- requirements/conda.txt | 3 +++ requirements/docs.txt | 5 +++++ requirements/pip.txt | 1 - requirements/tests.txt | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 requirements/conda.txt create mode 100644 requirements/docs.txt create mode 100644 requirements/tests.txt diff --git a/requirements/conda.txt b/requirements/conda.txt new file mode 100644 index 0000000..73b057e --- /dev/null +++ b/requirements/conda.txt @@ -0,0 +1,3 @@ +numpy +traits +traitsui diff --git a/requirements/docs.txt b/requirements/docs.txt new file mode 100644 index 0000000..5f34c6e --- /dev/null +++ b/requirements/docs.txt @@ -0,0 +1,5 @@ +sphinx +sphinx_rtd_theme +sphinx-copybutton +doctr +m2r diff --git a/requirements/pip.txt b/requirements/pip.txt index 59ebc00..73b057e 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1,4 +1,3 @@ numpy -configparser traits traitsui diff --git a/requirements/tests.txt b/requirements/tests.txt new file mode 100644 index 0000000..a727786 --- /dev/null +++ b/requirements/tests.txt @@ -0,0 +1,6 @@ +flake8 +pytest +codecov +coverage +pytest-cov +pytest-env From 6de173e80918b9cb45d4998ab8efafd4f287acd3 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Sat, 20 Sep 2025 18:14:49 -0400 Subject: [PATCH 4/8] skpkg: add CI --- .github/workflows/tests-on-pr.yml | 16 ++++++ .gitignore | 89 ++++++++++++++++++++++++------- 2 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/tests-on-pr.yml diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml new file mode 100644 index 0000000..aa251fc --- /dev/null +++ b/.github/workflows/tests-on-pr.yml @@ -0,0 +1,16 @@ +name: Tests on PR + +on: + pull_request: + workflow_dispatch: + +jobs: + tests-on-pr: + uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr-no-codecov.yml@v0 + with: + project: diffpy.srxconfutils + c_extension: false + headless: false + run: | + conda install pre-commit + pre-commit run --all-files diff --git a/.gitignore b/.gitignore index b9f9b7d..099e294 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,93 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ *.py[cod] +*$py.class # C extensions *.so -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -temp -develop-eggs +# Distribution / packaging +.Python +env/ +build/ +_build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +venv/ +*.egg-info/ .installed.cfg -lib -lib64 -tags +*.egg +bin/ +temp/ +tags/ errors.err +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + # Installer logs pip-log.txt +pip-delete-this-directory.txt MANIFEST # Unit test / coverage reports +htmlcov/ +.tox/ .coverage -.tox +.coverage.* +.cache nosetests.xml +coverage.xml +*,cover +.hypothesis/ # Translations *.mo +*.pot # Mr Developer .mr.developer.cfg .project .pydevproject -.settings -# version information -setup.cfg -/dpx/confutils/version.cfg +# Django stuff: +*.log + +# Sphinx documentation +docs/build/ +docs/source/generated/ + +# pytest +.pytest_cache/ + +# PyBuilder +target/ + +# Editor files +# mac +.DS_Store +*~ + +# vim +*.swp +*.swo + +# pycharm +.idea/ + +# VSCode +.vscode/ + +# Ipython Notebook +.ipynb_checkpoints From 7f2205dd5293ffddbbb30d32e2b355d4769e8141 Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Sat, 20 Sep 2025 18:15:14 -0400 Subject: [PATCH 5/8] skpkg: add pyproject.toml --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 918ff52..80824ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,10 +6,10 @@ build-backend = "setuptools.build_meta" name = "diffpy.srxconfutils" dynamic=['version', 'dependencies'] authors = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, + { name="Simon J.L. Billinge group", email="sb2896@columbia.edu" }, ] maintainers = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, + { name="Simon J.L. Billinge group", email="sb2896@columbia.edu" }, ] description = "Configuration utilities for dpx project. Part of xPDFsuite" keywords = ['diffpy', 'pdf', 'data interpretation'] @@ -48,6 +48,9 @@ include = ["*"] # package names should match these glob patterns (["*"] by defa exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) +[project.scripts] +diffpy-srxconfutils = "diffpy.srxconfutils.app:main" + [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} From 14adc8d06300b7c59fc4e8a7ccaab435812a09cb Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Sun, 21 Sep 2025 01:29:51 -0400 Subject: [PATCH 6/8] skpkg: add the rest of the github files --- .github/ISSUE_TEMPLATE/bug_feature.md | 16 ++ .github/ISSUE_TEMPLATE/release_checklist.md | 46 +++++ .../pull_request_template.md | 15 ++ .../workflows/build-wheel-release-upload.yml | 163 ++++++++++++++++++ .github/workflows/check-news-item.yml | 12 ++ .../matrix-and-codecov-on-merge-to-main.yml | 19 ++ .github/workflows/release-github.yml | 163 ++++++++++++++++++ 7 files changed, 434 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_feature.md create mode 100644 .github/ISSUE_TEMPLATE/release_checklist.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md create mode 100644 .github/workflows/build-wheel-release-upload.yml create mode 100644 .github/workflows/check-news-item.yml create mode 100644 .github/workflows/matrix-and-codecov-on-merge-to-main.yml create mode 100644 .github/workflows/release-github.yml diff --git a/.github/ISSUE_TEMPLATE/bug_feature.md b/.github/ISSUE_TEMPLATE/bug_feature.md new file mode 100644 index 0000000..b3454de --- /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 0000000..56bcd01 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -0,0 +1,46 @@ +--- +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 the website are updated. +- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version. +- [ ] Grammar and writing quality are checked (no typos). +- [ ] 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. + +Please tag the maintainer (e.g., @username) in the comment here when you are ready for the 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 on PyPI is correct. +- [ ] Docs are deployed successfully to `https:///`. +- [ ] Successfully run all tests, tutorial examples or do functional testing. + +Please let the maintainer know that all checks are done and the 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 `tests.txt` are added to `meta.yaml` in the feedstock. +- [ ] Close any open issues on the feedstock. Reach out to the maintainer if you have questions. +- [ ] Tag the maintainer for conda-forge release. + +### 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/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..1099d86 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,15 @@ +### What problem does this PR address? + + + +### What should the reviewer(s) do? + + + + diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml new file mode 100644 index 0000000..f809eb3 --- /dev/null +++ b/.github/workflows/build-wheel-release-upload.yml @@ -0,0 +1,163 @@ +name: Release on GitHub + +on: + workflow_call: + secrets: + PAT_TOKEN: + description: "GitHub Personal Access Token" + required: true + +env: + TAG: ${{ github.ref_name }} + +defaults: + run: + shell: bash {0} + +jobs: + prepare-release: + if: ${{ ! contains(github.ref, 'rc') }} + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + ref: main + + - name: Update CHANGELOG + run: | + wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/update-changelog.py + python update-changelog.py "$TAG" + rm update-changelog.py + + - name: Commit updated CHANGELOG.rst + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . + if ! git diff --cached --quiet; then + git commit -m "update changelog for $TAG" + git push origin main + else + echo "No CHANGELOG.rst changes" + fi + + - name: New tag + run: | + git fetch --tags + git tag -d "$TAG" 2>/dev/null || true + git push origin ":$TAG" 2>/dev/null || true + git tag "$TAG" + git push origin "$TAG" + + - name: Get CHANGELOG.txt + run: | + wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/get-latest-changelog.py + python get-latest-changelog.py "$TAG" + rm get-latest-changelog.py + + - name: Upload changelog.txt + uses: actions/upload-artifact@v4 + with: + name: changelog + path: CHANGELOG.txt + + release: + needs: [prepare-release] + if: always() + runs-on: ubuntu-latest + env: + REPO_FULL: ${{ github.repository }} + PAT_TOKEN: ${{ secrets.PAT_TOKEN }} + steps: + - name: Check prepare release + run: | + if [[ ${{ needs.prepare-release.result }} != 'success' && "$TAG" != *rc* ]]; then + echo "::error::Skipping release job because prepare-release failed" + exit 78 + fi + echo "Continuing with release job" + + - name: Download built wheels + uses: actions/download-artifact@v4 + with: + path: dist/ + + - name: Download changelog + if: ${{ needs.prepare-release.result == 'success' }} + uses: actions/download-artifact@v4 + with: + name: changelog + path: . + + - name: Download instructions + uses: actions/download-artifact@v4 + with: + name: instructions + path: . + + - name: Zip wheels and instructions into dist/pdfgetx-$TAG-wheels.zip + run: | + mkdir -p dist + find dist -type f -name '*.whl' | zip -j dist/pdfgetx-"$TAG"-wheels.zip -@ + zip -j dist/pdfgetx-"$TAG"-wheels.zip INSTRUCTIONS.txt + + - name: Prepare release metadata + id: meta + run: | + if [[ "$TAG" == *rc* ]]; then + PRERELEASE=true + TITLE="Pre-release $TAG" + BODY_RAW="Changelog: https://github.com/$REPO_FULL/commits/$TAG" + else + PRERELEASE=false + TITLE="Release $TAG" + BODY_RAW=$( payload.json + + echo "Release metadata:" + cat payload.json + + - name: Create GitHub Release + id: create_release + run: | + set -euo pipefail + + HTTP_STATUS=$( + curl --silent --output resp.json --write-out "%{http_code}" \ + -X POST "https://api.github.com/repos/$REPO_FULL/releases" \ + -H "Accept: application/vnd.github+json" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $PAT_TOKEN" \ + --data @payload.json + ) + if [[ "$HTTP_STATUS" -ne 201 ]]; then + echo "::error::Failed to create release (status $HTTP_STATUS)" + exit 1 + fi + + UPLOAD_URL=$(jq -r .upload_url resp.json | sed 's/{.*}//') + echo "upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT + + - name: Upload pdfgetx-$TAG-wheels.zip + if: steps.create_release.outputs.upload_url != '' + run: | + FILE=dist/pdfgetx-$TAG-wheels.zip + echo "Uploading asset: $FILE" + curl --silent --fail --data-binary @"$FILE" \ + -H "Content-Type: application/zip" \ + -H "Authorization: Bearer $PAT_TOKEN" \ + "${{ steps.create_release.outputs.upload_url }}?name=$(basename "$FILE")" diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml new file mode 100644 index 0000000..4857a2c --- /dev/null +++ b/.github/workflows/check-news-item.yml @@ -0,0 +1,12 @@ +name: Check for News + +on: + pull_request_target: + branches: + - main + +jobs: + check-news-item: + uses: scikit-package/release-scripts/.github/workflows/_check-news-item.yml@v0 + with: + project: diffpy.srxconfutils diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml new file mode 100644 index 0000000..4745dc9 --- /dev/null +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: + +jobs: + matrix-coverage: + uses: scikit-package/release-scripts/.github/workflows/_matrix-no-codecov-on-merge-to-main.yml@v0 + with: + project: diffpy.srxconfutils + c_extension: false + headless: false diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml new file mode 100644 index 0000000..f809eb3 --- /dev/null +++ b/.github/workflows/release-github.yml @@ -0,0 +1,163 @@ +name: Release on GitHub + +on: + workflow_call: + secrets: + PAT_TOKEN: + description: "GitHub Personal Access Token" + required: true + +env: + TAG: ${{ github.ref_name }} + +defaults: + run: + shell: bash {0} + +jobs: + prepare-release: + if: ${{ ! contains(github.ref, 'rc') }} + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + ref: main + + - name: Update CHANGELOG + run: | + wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/update-changelog.py + python update-changelog.py "$TAG" + rm update-changelog.py + + - name: Commit updated CHANGELOG.rst + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . + if ! git diff --cached --quiet; then + git commit -m "update changelog for $TAG" + git push origin main + else + echo "No CHANGELOG.rst changes" + fi + + - name: New tag + run: | + git fetch --tags + git tag -d "$TAG" 2>/dev/null || true + git push origin ":$TAG" 2>/dev/null || true + git tag "$TAG" + git push origin "$TAG" + + - name: Get CHANGELOG.txt + run: | + wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/get-latest-changelog.py + python get-latest-changelog.py "$TAG" + rm get-latest-changelog.py + + - name: Upload changelog.txt + uses: actions/upload-artifact@v4 + with: + name: changelog + path: CHANGELOG.txt + + release: + needs: [prepare-release] + if: always() + runs-on: ubuntu-latest + env: + REPO_FULL: ${{ github.repository }} + PAT_TOKEN: ${{ secrets.PAT_TOKEN }} + steps: + - name: Check prepare release + run: | + if [[ ${{ needs.prepare-release.result }} != 'success' && "$TAG" != *rc* ]]; then + echo "::error::Skipping release job because prepare-release failed" + exit 78 + fi + echo "Continuing with release job" + + - name: Download built wheels + uses: actions/download-artifact@v4 + with: + path: dist/ + + - name: Download changelog + if: ${{ needs.prepare-release.result == 'success' }} + uses: actions/download-artifact@v4 + with: + name: changelog + path: . + + - name: Download instructions + uses: actions/download-artifact@v4 + with: + name: instructions + path: . + + - name: Zip wheels and instructions into dist/pdfgetx-$TAG-wheels.zip + run: | + mkdir -p dist + find dist -type f -name '*.whl' | zip -j dist/pdfgetx-"$TAG"-wheels.zip -@ + zip -j dist/pdfgetx-"$TAG"-wheels.zip INSTRUCTIONS.txt + + - name: Prepare release metadata + id: meta + run: | + if [[ "$TAG" == *rc* ]]; then + PRERELEASE=true + TITLE="Pre-release $TAG" + BODY_RAW="Changelog: https://github.com/$REPO_FULL/commits/$TAG" + else + PRERELEASE=false + TITLE="Release $TAG" + BODY_RAW=$( payload.json + + echo "Release metadata:" + cat payload.json + + - name: Create GitHub Release + id: create_release + run: | + set -euo pipefail + + HTTP_STATUS=$( + curl --silent --output resp.json --write-out "%{http_code}" \ + -X POST "https://api.github.com/repos/$REPO_FULL/releases" \ + -H "Accept: application/vnd.github+json" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $PAT_TOKEN" \ + --data @payload.json + ) + if [[ "$HTTP_STATUS" -ne 201 ]]; then + echo "::error::Failed to create release (status $HTTP_STATUS)" + exit 1 + fi + + UPLOAD_URL=$(jq -r .upload_url resp.json | sed 's/{.*}//') + echo "upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT + + - name: Upload pdfgetx-$TAG-wheels.zip + if: steps.create_release.outputs.upload_url != '' + run: | + FILE=dist/pdfgetx-$TAG-wheels.zip + echo "Uploading asset: $FILE" + curl --silent --fail --data-binary @"$FILE" \ + -H "Content-Type: application/zip" \ + -H "Authorization: Bearer $PAT_TOKEN" \ + "${{ steps.create_release.outputs.upload_url }}?name=$(basename "$FILE")" From 36f9ec3ac5db8c417a5f443a99934fdb9abc704c Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Sun, 21 Sep 2025 01:32:59 -0400 Subject: [PATCH 7/8] chore: change pdfgetx to srxconfutils in the .github workflow files --- .github/workflows/build-wheel-release-upload.yml | 10 +++++----- .github/workflows/release-github.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml index f809eb3..3e78d1d 100644 --- a/.github/workflows/build-wheel-release-upload.yml +++ b/.github/workflows/build-wheel-release-upload.yml @@ -98,11 +98,11 @@ jobs: name: instructions path: . - - name: Zip wheels and instructions into dist/pdfgetx-$TAG-wheels.zip + - name: Zip wheels and instructions into dist/srxconfutils-$TAG-wheels.zip run: | mkdir -p dist - find dist -type f -name '*.whl' | zip -j dist/pdfgetx-"$TAG"-wheels.zip -@ - zip -j dist/pdfgetx-"$TAG"-wheels.zip INSTRUCTIONS.txt + find dist -type f -name '*.whl' | zip -j dist/srxconfutils-"$TAG"-wheels.zip -@ + zip -j dist/srxconfutils-"$TAG"-wheels.zip INSTRUCTIONS.txt - name: Prepare release metadata id: meta @@ -152,10 +152,10 @@ jobs: UPLOAD_URL=$(jq -r .upload_url resp.json | sed 's/{.*}//') echo "upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT - - name: Upload pdfgetx-$TAG-wheels.zip + - name: Upload srxconfutils-$TAG-wheels.zip if: steps.create_release.outputs.upload_url != '' run: | - FILE=dist/pdfgetx-$TAG-wheels.zip + FILE=dist/srxconfutils-$TAG-wheels.zip echo "Uploading asset: $FILE" curl --silent --fail --data-binary @"$FILE" \ -H "Content-Type: application/zip" \ diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index f809eb3..3e78d1d 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -98,11 +98,11 @@ jobs: name: instructions path: . - - name: Zip wheels and instructions into dist/pdfgetx-$TAG-wheels.zip + - name: Zip wheels and instructions into dist/srxconfutils-$TAG-wheels.zip run: | mkdir -p dist - find dist -type f -name '*.whl' | zip -j dist/pdfgetx-"$TAG"-wheels.zip -@ - zip -j dist/pdfgetx-"$TAG"-wheels.zip INSTRUCTIONS.txt + find dist -type f -name '*.whl' | zip -j dist/srxconfutils-"$TAG"-wheels.zip -@ + zip -j dist/srxconfutils-"$TAG"-wheels.zip INSTRUCTIONS.txt - name: Prepare release metadata id: meta @@ -152,10 +152,10 @@ jobs: UPLOAD_URL=$(jq -r .upload_url resp.json | sed 's/{.*}//') echo "upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT - - name: Upload pdfgetx-$TAG-wheels.zip + - name: Upload srxconfutils-$TAG-wheels.zip if: steps.create_release.outputs.upload_url != '' run: | - FILE=dist/pdfgetx-$TAG-wheels.zip + FILE=dist/srxconfutils-$TAG-wheels.zip echo "Uploading asset: $FILE" curl --silent --fail --data-binary @"$FILE" \ -H "Content-Type: application/zip" \ From 9691ebc607bedda4d6b6f830407d792ce2595aef Mon Sep 17 00:00:00 2001 From: Zhi Ming Xu Date: Tue, 23 Sep 2025 14:56:18 -0400 Subject: [PATCH 8/8] chore: fix copyright dates and delete dpx --- src/diffpy/__init__.py | 4 ++-- src/diffpy/srxconfutils/__init__.py | 6 +++--- src/diffpy/srxconfutils/version.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index 64cfe45..2af95ff 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -1,10 +1,10 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2025 The Trustees of Columbia University in the City of New York. +# (c) 2013-2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # -# File coded by: Billinge Group members and community contributors. +# File coded by: Xiaohao Yang and Billinge Group members. # # See GitHub contributions for a more detailed list of contributors. # https://github.com/diffpy/diffpy.srxconfutils/graphs/contributors diff --git a/src/diffpy/srxconfutils/__init__.py b/src/diffpy/srxconfutils/__init__.py index 698badd..e07b832 100644 --- a/src/diffpy/srxconfutils/__init__.py +++ b/src/diffpy/srxconfutils/__init__.py @@ -1,10 +1,10 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2025 The Trustees of Columbia University in the City of New York. +# (c) 2013-2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # -# File coded by: Billinge Group members. +# File coded by: Xiaohao Yang and Billinge Group members. # # See GitHub contributions for a more detailed list of contributors. # https://github.com/diffpy/diffpy.srxconfutils/graphs/contributors @@ -12,7 +12,7 @@ # See LICENSE.rst for license information. # ############################################################################## -"""Configuration utilities for dpx project. +"""Configuration utilities for project. Part of xPDFsuite """ diff --git a/src/diffpy/srxconfutils/version.py b/src/diffpy/srxconfutils/version.py index cfc18b7..dbd80dd 100644 --- a/src/diffpy/srxconfutils/version.py +++ b/src/diffpy/srxconfutils/version.py @@ -1,10 +1,10 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2025 The Trustees of Columbia University in the City of New York. +# (c) 2013-2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # -# File coded by: Billinge Group members. +# File coded by: Xiaohao Yang and Billinge Group members. # # See GitHub contributions for a more detailed list of contributors. # https://github.com/diffpy/diffpy.srxconfutils/graphs/contributors # noqa: E501