Skip to content

skpkg: line length fixes, GH workflow edits, and other small edits #136

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
Jun 12, 2025
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
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ assignees: ""
- [ ] 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 (e.g., diffpy.org) are updated.
- [ ] 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 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:
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 <package-name>==??`)
- [ ] License information on PyPI is correct.
- [ ] Docs are deployed successfully to `https://www.diffpy.org/<package-name>`.
- [ ] Docs are deployed successfully to `https://<github-username-or-orgname>/<package-name>`.
- [ ] Successfully run all tests, tutorial examples or do functional testing.

Please let @sbillinge know that all checks are done and the package is ready for full release.
Please let the maintainer know that all checks are done and the 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.-->
<!-- After the maintainer 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.
- [ ] Tag @sbillinge and @bobleesj for conda-forge release.
- [ ] 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

Expand Down
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### What problem does this PR address?

<!-- Provide a brief overview and link to the issue. Attach outputs, including screenshots (before/after), if helpful for the reviewer. -->

### What should the reviewer(s) do?

<!-- Merge the code, provide feedback, initiate a discussion, etc. -->

<!--
Use the following checklist items when applicable (select only what applies):
- [ ] This PR introduces a public-facing change (e.g., figures, CLI input/output, API).
- [ ] Documentation (e.g., tutorials, examples, README) has been updated.
- [ ] A tracking issue or plan to update documentation exists.
- [ ] This PR affects internal functionality only (no user-facing change).
-->
5 changes: 2 additions & 3 deletions .github/workflows/build-wheel-release-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ on:

jobs:
release:
uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0
uses: scikit-package/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0
with:
project: diffpy.pdffit2
c_extension: true
github_admin_username: sbillinge

maintainer_GITHUB_username: sbillinge
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 @@ -7,6 +7,6 @@ on:

jobs:
check-news-item:
uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0
uses: scikit-package/release-scripts/.github/workflows/_check-news-item.yml@v0
with:
project: diffpy.pdffit2
3 changes: 1 addition & 2 deletions .github/workflows/matrix-and-codecov-on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ on:

jobs:
matrix-coverage:
uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
uses: scikit-package/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
with:
project: diffpy.pdffit2
python_versions: "3.11, 3.12, 3.13"
c_extension: true
headless: false
secrets:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/publish-docs-on-release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
name: Deploy Documentation on Release

on:
release:
types: [published]
workflow_dispatch:

jobs:
docs:
permissions:
contents: write
uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0
uses: scikit-package/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0
with:
project: diffpy.pdffit2
c_extension: true
headless: false
python_version: 3.13
10 changes: 3 additions & 7 deletions .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
name: Tests on PR

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
validate:
uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0
tests-on-pr:
uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr.yml@v0
with:
project: diffpy.pdffi2
project: diffpy.pdffit2
c_extension: true
headless: false
python_version: 3.13
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "latest"

python:
install:
- requirements: requirements/docs.txt

sphinx:
configuration: doc/source/conf.py
40 changes: 37 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
from importlib.metadata import version
from pathlib import Path

# Attempt to import the version dynamically from GitHub tag.
try:
fullversion = version("diffpy.pdffit2")
except Exception:
fullversion = "No version found. The correct version will appear in the released version."

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use Path().resolve() to make it absolute, like shown here.
Expand All @@ -26,7 +32,7 @@
sys.path.insert(0, str(Path("../../src").resolve()))

# abbreviations
ab_authors = "Billinge Group members and community contributors"
ab_authors = "Billinge group and community members."

# -- General configuration ------------------------------------------------

Expand All @@ -43,6 +49,7 @@
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"sphinx_rtd_theme",
"sphinx_copybutton",
"m2r",
]

Expand Down Expand Up @@ -88,6 +95,11 @@
# substitute YEAR in the copyright string
copyright = copyright.replace("%Y", year)

# For sphinx_copybutton extension.
# Do not copy "$" for shell commands in code-blocks.
copybutton_prompt_text = r"^\$ "
copybutton_prompt_is_regexp = True

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["build"]
Expand Down Expand Up @@ -123,6 +135,14 @@
#
html_theme = "sphinx_rtd_theme"

html_context = {
"display_github": True,
"github_user": "diffpy",
"github_repo": "diffpy.pdffit2",
"github_version": "main",
"conf_py_path": "/doc/source/",
}

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
Expand Down Expand Up @@ -221,7 +241,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
("index", "diffpy.pdffit2.tex", "diffpy.pdffit2 Documentation", ab_authors, "manual"),
(
"index",
"diffpy.pdffit2.tex",
"diffpy.pdffit2 Documentation",
ab_authors,
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -249,7 +275,15 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("index", "diffpy.pdffit2", "diffpy.pdffit2 Documentation", ab_authors, 1)]
man_pages = [
(
"index",
"diffpy.pdffit2",
"diffpy.pdffit2 Documentation",
ab_authors,
1,
)
]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand Down
23 changes: 23 additions & 0 deletions news/setup-CI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No news needed: line length fixes and other adjustments to copyright year.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ build-backend = "setuptools.build_meta"
name = "diffpy.pdffit2"
dynamic=['version', 'dependencies']
authors = [
{ name="Simon J.L. Billinge group", email="[email protected]" },
{ name="Simon Billinge", email="[email protected]" },
]
maintainers = [
{ name="Simon J.L. Billinge group", email="[email protected]" },
{ name="Simon Billinge", email="[email protected]" },
]
description = "PDFfit2 - real space structure refinement program."
keywords = ["PDF", "structure refinement"]
keywords = ['PDF', 'structure refinement']
readme = "README.rst"
requires-python = ">=3.11, <3.14"
classifiers = [
Expand Down Expand Up @@ -57,7 +57,7 @@ ignore-words = ".codespell/ignore_words.txt"
skip = "*.cif,*.dat,*.cc,*.h"

[tool.black]
line-length = 115
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
Expand Down
1 change: 1 addition & 0 deletions requirements/conda.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
diffpy.structure
numpy
1 change: 1 addition & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sphinx
sphinx_rtd_theme
sphinx-copybutton
doctr
m2r
1 change: 1 addition & 0 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
diffpy.structure
numpy
33 changes: 27 additions & 6 deletions setup.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def get_gsl_config():
return rv
else:
warnings.warn(
f"CONDA_PREFIX is set to {conda_prefix}, " "but GSL not found at those paths. Proceeding..."
f"CONDA_PREFIX is set to {conda_prefix}, "
"but GSL not found at those paths. Proceeding..."
)

# 2. Check using GSL_PATH.
Expand All @@ -76,7 +77,8 @@ def get_gsl_config():
return rv
else:
raise EnvironmentError(
f"GSL_PATH={gsl_path} is set, but {inc} or {lib} not found. " "Please verify your GSL_PATH."
f"GSL_PATH={gsl_path} is set, but {inc} or {lib} not found. "
"Please verify your GSL_PATH."
)

# 3. Try using the gsl-config executable (only on Unix-like systems).
Expand All @@ -92,8 +94,14 @@ def get_gsl_config():
lib_match = re.search(r"(?m)^[^#]*\s-L(\S+)", txt)
if prefix_match:
prefix_path = Path(prefix_match.group(1))
inc_dir = include_match.group(1) if include_match else (prefix_path / "include")
lib_dir = lib_match.group(1) if lib_match else (prefix_path / "lib")
inc_dir = (
include_match.group(1)
if include_match
else (prefix_path / "include")
)
lib_dir = (
lib_match.group(1) if lib_match else (prefix_path / "lib")
)
rv["include_dirs"].append(str(inc_dir))
rv["library_dirs"].append(str(lib_dir))
return rv
Expand Down Expand Up @@ -164,7 +172,14 @@ def create_extensions():

compiler_type = get_compiler_type()
if compiler_type in ("unix", "cygwin", "mingw32"):
extra_compile_args = ["-std=c++11", "-Wall", "-Wno-write-strings", "-O3", "-funroll-loops", "-ffast-math"]
extra_compile_args = [
"-std=c++11",
"-Wall",
"-Wno-write-strings",
"-O3",
"-funroll-loops",
"-ffast-math",
]
# Check for static GSL libraries and add them if found.
static_libs = [
os.path.join(p, "libgsl.a")
Expand All @@ -189,15 +204,21 @@ def create_extensions():
"extra_link_args": extra_link_args,
"extra_objects": extra_objects,
}
ext = Extension("diffpy.pdffit2.pdffit2", glob.glob("src/extensions/**/*.cc"), **ext_kws)
ext = Extension(
"diffpy.pdffit2.pdffit2",
glob.glob("src/extensions/**/*.cc"),
**ext_kws,
)
return [ext]


# Extensions not included in pyproject.toml
setup_args = dict(
ext_modules=[],
cmdclass={"build_ext": CustomBuildExt},
)


if __name__ == "__main__":
setup_args["ext_modules"] = create_extensions()
setup(**setup_args)
2 changes: 1 addition & 1 deletion src/diffpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# (c) 2008 trustees of the Michigan State University.
# All rights reserved.
# (c) 2024 The Trustees of Columbia University in the City of New York.
# (c) 2025 The Trustees of Columbia University in the City of New York.
# All rights reserved.
#
# File coded by: Billinge Group members and community contributors.
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/pdffit2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# (c) 2006 trustees of the Michigan State University.
# All rights reserved.
# (c) 2024 The Trustees of Columbia University in the City of New York.
# (c) 2025 The Trustees of Columbia University in the City of New York.
# All rights reserved.
#
# File coded by: Billinge Group members and community contributors.
Expand Down
Loading
Loading