Skip to content

Commit 8bab2cf

Browse files
authored
Merge pull request #136 from cadenmyers13/setup-CI
skpkg: line length fixes, GH workflow edits, and other small edits
2 parents d47b719 + 74add76 commit 8bab2cf

23 files changed

+472
-116
lines changed

.github/ISSUE_TEMPLATE/release_checklist.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,30 @@ assignees: ""
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
1515
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.
16+
- [ ] Installation instructions in the README, documentation, and the website 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).
1919
- [ ] 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

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:
21+
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:
2222

2323
### PyPI/GitHub full-release preparation checklist:
2424

2525
- [ ] Create a new conda environment and install the rc from PyPI (`pip install <package-name>==??`)
2626
- [ ] License information on PyPI is correct.
27-
- [ ] Docs are deployed successfully to `https://www.diffpy.org/<package-name>`.
27+
- [ ] Docs are deployed successfully to `https://<github-username-or-orgname>/<package-name>`.
2828
- [ ] Successfully run all tests, tutorial examples or do functional testing.
2929

30-
Please let @sbillinge know that all checks are done and the package is ready for full release.
30+
Please let the maintainer know that all checks are done and the package is ready for full release.
3131

3232
### conda-forge release preparation checklist:
3333

34-
<!-- After @sbillinge releases the PyPI package, please check the following when creating a PR for conda-forge release.-->
34+
<!-- After the maintainer releases the PyPI package, please check the following when creating a PR for conda-forge release.-->
3535

3636
- [ ] Ensure that the full release has appeared on PyPI successfully.
3737
- [ ] 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.
38+
- [ ] Close any open issues on the feedstock. Reach out to the maintainer if you have questions.
39+
- [ ] Tag the maintainer for conda-forge release.
4040

4141
### Post-release checklist
4242

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### What problem does this PR address?
2+
3+
<!-- Provide a brief overview and link to the issue. Attach outputs, including screenshots (before/after), if helpful for the reviewer. -->
4+
5+
### What should the reviewer(s) do?
6+
7+
<!-- Merge the code, provide feedback, initiate a discussion, etc. -->
8+
9+
<!--
10+
Use the following checklist items when applicable (select only what applies):
11+
- [ ] This PR introduces a public-facing change (e.g., figures, CLI input/output, API).
12+
- [ ] Documentation (e.g., tutorials, examples, README) has been updated.
13+
- [ ] A tracking issue or plan to update documentation exists.
14+
- [ ] This PR affects internal functionality only (no user-facing change).
15+
-->

.github/workflows/build-wheel-release-upload.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ on:
88

99
jobs:
1010
release:
11-
uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0
11+
uses: scikit-package/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0
1212
with:
1313
project: diffpy.pdffit2
1414
c_extension: true
15-
github_admin_username: sbillinge
16-
15+
maintainer_GITHUB_username: sbillinge
1716
secrets:
1817
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
1918
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}

.github/workflows/check-news-item.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ on:
77

88
jobs:
99
check-news-item:
10-
uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0
10+
uses: scikit-package/release-scripts/.github/workflows/_check-news-item.yml@v0
1111
with:
1212
project: diffpy.pdffit2

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ on:
1212

1313
jobs:
1414
matrix-coverage:
15-
uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
15+
uses: scikit-package/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
1616
with:
1717
project: diffpy.pdffit2
18-
python_versions: "3.11, 3.12, 3.13"
1918
c_extension: true
2019
headless: false
2120
secrets:
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
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
12-
uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0
8+
uses: scikit-package/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0
139
with:
1410
project: diffpy.pdffit2
1511
c_extension: true
1612
headless: false
17-
python_version: 3.13

.github/workflows/tests-on-pr.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
name: Tests on PR
22

33
on:
4-
push:
5-
branches:
6-
- main
74
pull_request:
85
workflow_dispatch:
96

107
jobs:
11-
validate:
12-
uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0
8+
tests-on-pr:
9+
uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr.yml@v0
1310
with:
14-
project: diffpy.pdffi2
11+
project: diffpy.pdffit2
1512
c_extension: true
1613
headless: false
17-
python_version: 3.13
1814
secrets:
1915
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.readthedocs.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "latest"
7+
8+
python:
9+
install:
10+
- requirements: requirements/docs.txt
11+
12+
sphinx:
13+
configuration: doc/source/conf.py

doc/source/conf.py

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
from importlib.metadata import version
1919
from pathlib import Path
2020

21+
# Attempt to import the version dynamically from GitHub tag.
22+
try:
23+
fullversion = version("diffpy.pdffit2")
24+
except Exception:
25+
fullversion = "No version found. The correct version will appear in the released version."
26+
2127
# If extensions (or modules to document with autodoc) are in another directory,
2228
# add these directories to sys.path here. If the directory is relative to the
2329
# documentation root, use Path().resolve() to make it absolute, like shown here.
@@ -26,7 +32,7 @@
2632
sys.path.insert(0, str(Path("../../src").resolve()))
2733

2834
# abbreviations
29-
ab_authors = "Billinge Group members and community contributors"
35+
ab_authors = "Billinge group and community members."
3036

3137
# -- General configuration ------------------------------------------------
3238

@@ -43,6 +49,7 @@
4349
"sphinx.ext.viewcode",
4450
"sphinx.ext.intersphinx",
4551
"sphinx_rtd_theme",
52+
"sphinx_copybutton",
4653
"m2r",
4754
]
4855

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

98+
# For sphinx_copybutton extension.
99+
# Do not copy "$" for shell commands in code-blocks.
100+
copybutton_prompt_text = r"^\$ "
101+
copybutton_prompt_is_regexp = True
102+
91103
# List of patterns, relative to source directory, that match files and
92104
# directories to ignore when looking for source files.
93105
exclude_patterns = ["build"]
@@ -123,6 +135,14 @@
123135
#
124136
html_theme = "sphinx_rtd_theme"
125137

138+
html_context = {
139+
"display_github": True,
140+
"github_user": "diffpy",
141+
"github_repo": "diffpy.pdffit2",
142+
"github_version": "main",
143+
"conf_py_path": "/doc/source/",
144+
}
145+
126146
# Theme options are theme-specific and customize the look and feel of a theme
127147
# further. For a list of options available for each theme, see the
128148
# documentation.
@@ -221,7 +241,13 @@
221241
# (source start file, target name, title,
222242
# author, documentclass [howto, manual, or own class]).
223243
latex_documents = [
224-
("index", "diffpy.pdffit2.tex", "diffpy.pdffit2 Documentation", ab_authors, "manual"),
244+
(
245+
"index",
246+
"diffpy.pdffit2.tex",
247+
"diffpy.pdffit2 Documentation",
248+
ab_authors,
249+
"manual",
250+
),
225251
]
226252

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

250276
# One entry per manual page. List of tuples
251277
# (source start file, name, description, authors, manual section).
252-
man_pages = [("index", "diffpy.pdffit2", "diffpy.pdffit2 Documentation", ab_authors, 1)]
278+
man_pages = [
279+
(
280+
"index",
281+
"diffpy.pdffit2",
282+
"diffpy.pdffit2 Documentation",
283+
ab_authors,
284+
1,
285+
)
286+
]
253287

254288
# If true, show URL addresses after external links.
255289
# man_show_urls = False

news/setup-CI.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* No news needed: line length fixes and other adjustments to copyright year.
4+
5+
**Changed:**
6+
7+
* <news item>
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>

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ build-backend = "setuptools.build_meta"
66
name = "diffpy.pdffit2"
77
dynamic=['version', 'dependencies']
88
authors = [
9-
{ name="Simon J.L. Billinge group", email="[email protected]" },
9+
{ name="Simon Billinge", email="[email protected]" },
1010
]
1111
maintainers = [
12-
{ name="Simon J.L. Billinge group", email="[email protected]" },
12+
{ name="Simon Billinge", email="[email protected]" },
1313
]
1414
description = "PDFfit2 - real space structure refinement program."
15-
keywords = ["PDF", "structure refinement"]
15+
keywords = ['PDF', 'structure refinement']
1616
readme = "README.rst"
1717
requires-python = ">=3.11, <3.14"
1818
classifiers = [
@@ -57,7 +57,7 @@ ignore-words = ".codespell/ignore_words.txt"
5757
skip = "*.cif,*.dat,*.cc,*.h"
5858

5959
[tool.black]
60-
line-length = 115
60+
line-length = 79
6161
include = '\.pyi?$'
6262
exclude = '''
6363
/(

requirements/conda.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
diffpy.structure
2+
numpy

requirements/docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
sphinx
22
sphinx_rtd_theme
3+
sphinx-copybutton
34
doctr
45
m2r

requirements/pip.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
diffpy.structure
2+
numpy

setup.py

100755100644
Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def get_gsl_config():
6262
return rv
6363
else:
6464
warnings.warn(
65-
f"CONDA_PREFIX is set to {conda_prefix}, " "but GSL not found at those paths. Proceeding..."
65+
f"CONDA_PREFIX is set to {conda_prefix}, "
66+
"but GSL not found at those paths. Proceeding..."
6667
)
6768

6869
# 2. Check using GSL_PATH.
@@ -76,7 +77,8 @@ def get_gsl_config():
7677
return rv
7778
else:
7879
raise EnvironmentError(
79-
f"GSL_PATH={gsl_path} is set, but {inc} or {lib} not found. " "Please verify your GSL_PATH."
80+
f"GSL_PATH={gsl_path} is set, but {inc} or {lib} not found. "
81+
"Please verify your GSL_PATH."
8082
)
8183

8284
# 3. Try using the gsl-config executable (only on Unix-like systems).
@@ -92,8 +94,14 @@ def get_gsl_config():
9294
lib_match = re.search(r"(?m)^[^#]*\s-L(\S+)", txt)
9395
if prefix_match:
9496
prefix_path = Path(prefix_match.group(1))
95-
inc_dir = include_match.group(1) if include_match else (prefix_path / "include")
96-
lib_dir = lib_match.group(1) if lib_match else (prefix_path / "lib")
97+
inc_dir = (
98+
include_match.group(1)
99+
if include_match
100+
else (prefix_path / "include")
101+
)
102+
lib_dir = (
103+
lib_match.group(1) if lib_match else (prefix_path / "lib")
104+
)
97105
rv["include_dirs"].append(str(inc_dir))
98106
rv["library_dirs"].append(str(lib_dir))
99107
return rv
@@ -164,7 +172,14 @@ def create_extensions():
164172

165173
compiler_type = get_compiler_type()
166174
if compiler_type in ("unix", "cygwin", "mingw32"):
167-
extra_compile_args = ["-std=c++11", "-Wall", "-Wno-write-strings", "-O3", "-funroll-loops", "-ffast-math"]
175+
extra_compile_args = [
176+
"-std=c++11",
177+
"-Wall",
178+
"-Wno-write-strings",
179+
"-O3",
180+
"-funroll-loops",
181+
"-ffast-math",
182+
]
168183
# Check for static GSL libraries and add them if found.
169184
static_libs = [
170185
os.path.join(p, "libgsl.a")
@@ -189,15 +204,21 @@ def create_extensions():
189204
"extra_link_args": extra_link_args,
190205
"extra_objects": extra_objects,
191206
}
192-
ext = Extension("diffpy.pdffit2.pdffit2", glob.glob("src/extensions/**/*.cc"), **ext_kws)
207+
ext = Extension(
208+
"diffpy.pdffit2.pdffit2",
209+
glob.glob("src/extensions/**/*.cc"),
210+
**ext_kws,
211+
)
193212
return [ext]
194213

195214

215+
# Extensions not included in pyproject.toml
196216
setup_args = dict(
197217
ext_modules=[],
198218
cmdclass={"build_ext": CustomBuildExt},
199219
)
200220

221+
201222
if __name__ == "__main__":
202223
setup_args["ext_modules"] = create_extensions()
203224
setup(**setup_args)

src/diffpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# (c) 2008 trustees of the Michigan State University.
55
# All rights reserved.
6-
# (c) 2024 The Trustees of Columbia University in the City of New York.
6+
# (c) 2025 The Trustees of Columbia University in the City of New York.
77
# All rights reserved.
88
#
99
# File coded by: Billinge Group members and community contributors.

src/diffpy/pdffit2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# (c) 2006 trustees of the Michigan State University.
55
# All rights reserved.
6-
# (c) 2024 The Trustees of Columbia University in the City of New York.
6+
# (c) 2025 The Trustees of Columbia University in the City of New York.
77
# All rights reserved.
88
#
99
# File coded by: Billinge Group members and community contributors.

0 commit comments

Comments
 (0)