Skip to content

Commit 011fa4c

Browse files
committed
Merge branch 'main' into p3
2 parents 62ff646 + 3705663 commit 011fa4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5428
-4992
lines changed

.codecov.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# codecov can find this file anywhere in the repo, so we don't need to clutter
2+
# the root folder.
3+
#comment: false
4+
5+
codecov:
6+
notify:
7+
require_ci_to_pass: no
8+
9+
coverage:
10+
status:
11+
patch:
12+
default:
13+
target: '70'
14+
if_no_uploads: error
15+
if_not_found: success
16+
if_ci_failed: failure
17+
project:
18+
default: false
19+
library:
20+
target: auto
21+
if_no_uploads: error
22+
if_not_found: success
23+
if_ci_failed: error
24+
paths: '!*/tests/.*'
25+
26+
tests:
27+
target: 97.9%
28+
paths: '*/tests/.*'
29+
if_not_found: success
30+
31+
flags:
32+
tests:
33+
paths:
34+
- tests/

.coveragerc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[run]
2+
source =
3+
diffpy.srmise
4+
[report]
5+
omit =
6+
*/python?.?/*
7+
*/site-packages/nose/*
8+
# ignore _version.py and versioneer.py
9+
.*version.*
10+
*_version.py
11+
12+
exclude_lines =
13+
if __name__ == '__main__':

.flake8

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
exclude =
3+
.git,
4+
__pycache__,
5+
build,
6+
dist,
7+
doc/source/conf.py
8+
max-line-length = 115
9+
# Ignore some style 'errors' produced while formatting by 'black'
10+
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
11+
extend-ignore = E203

.github/workflows/docs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
release:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: conda-incubator/setup-miniconda@v2
21+
with:
22+
activate-environment: build
23+
auto-update-conda: true
24+
25+
- name: install requirements
26+
run: >-
27+
conda install -n build -c conda-forge
28+
--file requirements/build.txt
29+
--file requirements/run.txt
30+
--file requirements/docs.txt
31+
--quiet --yes
32+
33+
- name: install the package
34+
run: python -m pip install . --no-deps
35+
36+
- name: build documents
37+
run: make -C doc html
38+
39+
- name: Deploy
40+
uses: peaceiris/actions-gh-pages@v3
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
publish_dir: ./doc/build/html

.github/workflows/main.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- CI
8+
pull_request:
9+
workflow_dispatch:
10+
11+
jobs:
12+
miniconda:
13+
name: Miniconda ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: ["ubuntu-latest"]
18+
steps:
19+
- name: check out diffpy.srmise
20+
uses: actions/checkout@v3
21+
with:
22+
repository: diffpy/diffpy.srmise
23+
path: .
24+
fetch-depth: 0 # avoid shallow clone with no tags
25+
26+
- name: initialize miniconda
27+
# this uses a marketplace action that sets up miniconda in a way that makes
28+
# it easier to use. I tried setting it up without this and it was a pain
29+
uses: conda-incubator/setup-miniconda@v2
30+
with:
31+
activate-environment: test
32+
# environment.yml file is needed by this action. Because I don't want
33+
# maintain this but rather maintain the requirements files it just has
34+
# basic things in it like conda and pip
35+
environment-file: ./environment.yml
36+
python-version: 3
37+
auto-activate-base: false
38+
39+
- name: install diffpy.srmise requirements
40+
shell: bash -l {0}
41+
run: |
42+
conda config --set always_yes yes --set changeps1 no
43+
conda config --add channels conda-forge
44+
conda activate test
45+
conda install --file requirements/run.txt
46+
conda install --file requirements/test.txt
47+
pip install .
48+
49+
- name: Validate diffpy.srmise
50+
shell: bash -l {0}
51+
run: |
52+
conda activate test
53+
coverage run -m pytest -vv -s
54+
coverage report -m
55+
codecov

.github/workflows/pre-commit.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
pre-commit:
10+
# pull requests are a duplicate of a branch push if within the same repo.
11+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
12+
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v4
17+
- uses: pre-commit/[email protected]
18+
with:
19+
extra_args: --all-files

.isort.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[settings]
2+
line_length = 115
3+
multi_line_output = 3
4+
include_trailing_comma = True

.pre-commit-config.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
default_language_version:
2+
python: python3
3+
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
12+
repos:
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v4.6.0
15+
hooks:
16+
- id: check-yaml
17+
- id: end-of-file-fixer
18+
- id: trailing-whitespace
19+
exclude: '\.(rst|txt)$'
20+
- repo: https://github.com/psf/black
21+
rev: 24.4.2
22+
hooks:
23+
- id: black
24+
- repo: https://github.com/pycqa/flake8
25+
rev: 7.0.0
26+
hooks:
27+
- id: flake8
28+
- repo: https://github.com/pycqa/isort
29+
rev: 5.13.2
30+
hooks:
31+
- id: isort
32+
args: ["--profile", "black"]
33+
- repo: https://github.com/kynan/nbstripout
34+
rev: 0.7.1
35+
hooks:
36+
- id: nbstripout
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v4.4.0
39+
hooks:
40+
- id: no-commit-to-branch
41+
name: Prevent Commit to Main Branch
42+
args: ["--branch", "main"]
43+
stages: [pre-commit]

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ include doc/examples/README
99
recursive-include doc/manual/source *.rst *.txt
1010
include doc/manual/source/conf.py
1111
include doc/manual/Makefile
12-

devutils/prep.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env python
22
# Run examples and other scripts that should be updated before release.
33

4-
import io, os, sys
4+
import io
5+
import os
56
import re
7+
import sys
68

79
__basedir__ = os.getcwdu()
810

@@ -25,15 +27,15 @@ def test(self, call, *args, **kwds):
2527
except Exception, e:
2628
self.messages.append("%s: error, details below.\n%s" %(testname, e))
2729
finally:
28-
os.chdir(__basedir__)
29-
30+
os.chdir(__basedir__)
31+
3032
def report(self):
3133
print '==== Results of Tests ===='
3234
print '\n'.join(self.messages)
33-
35+
3436
def scrubeol(directory, filerestr):
3537
"""Use unix-style endlines for files in directory matched by regex string.
36-
38+
3739
Parameters
3840
----------
3941
directory - A directory to scrub
@@ -42,22 +44,22 @@ def scrubeol(directory, filerestr):
4244
os.chdir(directory)
4345
files = [re.match(filerestr, f) for f in os.listdir(".")]
4446
files = [f.group(0) for f in files if f]
45-
47+
4648
for f in files:
4749
original = open(f)
4850
text = unicode(original.read())
4951
original.close()
50-
52+
5153
updated = io.open(f, 'w', newline='\n')
5254
updated.write(text)
5355
updated.close()
54-
56+
5557
print "Updated %s to unix-style endlines." %f
5658

5759

5860
def rm(directory, filerestr):
5961
"""Delete files in directory matched by regex string.
60-
62+
6163
Parameters
6264
----------
6365
directory - A directory to scrub
@@ -66,20 +68,20 @@ def rm(directory, filerestr):
6668
os.chdir(directory)
6769
files = [re.match(filerestr, f) for f in os.listdir(".")]
6870
files = [f.group(0) for f in files if f]
69-
71+
7072
for f in files:
7173
os.remove(f)
72-
74+
7375
print "Deleted %s." %f
74-
76+
7577

7678

7779
if __name__ == "__main__":
7880

7981
# Temporarily add examples to path
8082
lib_path = os.path.abspath(os.path.join('..','doc','examples'))
8183
sys.path.append(lib_path)
82-
84+
8385
# Delete existing files that don't necessarily have a fixed name.
8486
rm("../doc/examples/output", r"known_dG.*\.pwa")
8587
rm("../doc/examples/output", r"unknown_dG.*\.pwa")
@@ -88,7 +90,7 @@ def rm(directory, filerestr):
8890
examples = Test()
8991
test_names = ["extract_single_peak",
9092
"parameter_summary",
91-
"fit_initial",
93+
"fit_initial",
9294
"query_results",
9395
"multimodel_known_dG1",
9496
"multimodel_known_dG2",
@@ -103,11 +105,11 @@ def rm(directory, filerestr):
103105
examples.test(test.run, plot=False)
104106

105107
examples.report()
106-
108+
107109
### Convert output of example files to Unix-style endlines for sdist.
108110
if os.linesep != '\n':
109111
print "==== Scrubbing Endlines ===="
110112
# All *.srmise and *.pwa files in examples directory.
111113
scrubeol("../doc/examples/output", r".*(\.srmise|\.pwa)")
112114

113-
115+

0 commit comments

Comments
 (0)