Skip to content

Commit 758c7a8

Browse files
authored
Merge pull request #61 from diffpy/cookie
merge of cookie into main
2 parents c4a2989 + 09d65b5 commit 758c7a8

File tree

119 files changed

+4802
-4057
lines changed

Some content is hidden

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

119 files changed

+4802
-4057
lines changed

.codecov.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
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+
15
fixes:
26
- ".*/site-packages/::src/"
7+
8+
codecov:
9+
notify:
10+
require_ci_to_pass: no
11+
12+
coverage:
13+
status:
14+
patch:
15+
default:
16+
target: '70'
17+
if_no_uploads: error
18+
if_not_found: success
19+
if_ci_failed: failure
20+
project:
21+
default: false
22+
library:
23+
target: auto
24+
if_no_uploads: error
25+
if_not_found: success
26+
if_ci_failed: error
27+
paths: '!*/tests/.*'
28+
29+
tests:
30+
target: 97.9%
31+
paths: '*/tests/.*'
32+
if_not_found: success
33+
34+
flags:
35+
tests:
36+
paths:
37+
- tests/

.coveragerc

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
# Configuration of the coverage.py tool for reporting test coverage.
2-
1+
[run]
2+
source =
3+
diffpy.pdffit2
4+
omit =
5+
# exclude debug.py from codecov report
6+
*/tests/debug.py
37
[report]
8+
omit =
9+
*/python?.?/*
10+
*/site-packages/nose/*
11+
# ignore _version.py and versioneer.py
12+
.*version.*
13+
*_version.py
414
# RE patterns for lines to be excluded from consideration.
515
exclude_lines =
6-
## Have to re-enable the standard pragma
16+
# Have to re-enable the standard pragma
717
pragma: no cover
8-
## Don't complain if tests don't hit defensive assertion code:
18+
# Don't complain if tests don't hit defensive assertion code:
919
raise AssertionError
1020
raise NotImplementedError
1121
^[ ]*assert False
1222

13-
## Don't complain if non-runnable code isn't run:
23+
# Don't complain if non-runnable code isn't run:
1424
^[ ]*@unittest.skip\b
1525
^[ ]{4}unittest.main()
16-
if __name__ == .__main__.:
17-
18-
19-
[run]
20-
omit =
21-
## exclude debug.py from codecov report
22-
*/tests/debug.py
26+
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/build.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/docs.yml

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

.github/workflows/main.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
python-version: ['3.10', '3.11', '3.12']
18+
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
19+
steps:
20+
- name: check out diffpy.pdffit2
21+
uses: actions/checkout@v3
22+
with:
23+
repository: diffpy/diffpy.pdffit2
24+
path: .
25+
fetch-depth: 0 # avoid shallow clone with no tags
26+
27+
- name: initialize miniconda
28+
# this uses a marketplace action that sets up miniconda in a way that makes
29+
# it easier to use. I tried setting it up without this and it was a pain
30+
uses: conda-incubator/setup-miniconda@v3
31+
with:
32+
miniconda-version: "latest"
33+
activate-environment: test
34+
# environment.yml file is needed by this action. Because I don't want
35+
# maintain this but rather maintain the requirements files it just has
36+
# basic things in it like conda and pip
37+
environment-file: environment.yml
38+
python-version: ${{ matrix.python-version }}
39+
auto-activate-base: false
40+
41+
- name: install diffpy.pdffit2 requirements
42+
shell: bash -l {0}
43+
run: |
44+
conda config --set always_yes yes --set changeps1 no
45+
conda config --add channels conda-forge
46+
conda activate test
47+
conda install --file requirements/build.txt
48+
conda install --file requirements/run.txt
49+
conda install --file requirements/test.txt
50+
pip install .
51+
- name: Validate diffpy.pdffit2
52+
shell: bash -l {0}
53+
run: |
54+
conda activate test
55+
coverage run src/diffpy/pdffit2/tests/run.py
56+
coverage report -m
57+
codecov
58+
59+
# Use this after migrating to pytest
60+
# - name: Validate diffpy.pdffit2
61+
# shell: bash -l {0}
62+
# run: |
63+
# conda activate test
64+
# coverage run -m pytest -vv -s
65+
# coverage report -m
66+
# 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

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ lib64
2222
tags
2323
errors.err
2424

25+
# IDE configs
26+
.idea
27+
.vscode
28+
2529
# Installer logs
2630
pip-log.txt
2731
MANIFEST

.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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
exclude: ^conda-recipe/meta\.yaml$
18+
- id: end-of-file-fixer
19+
- id: trailing-whitespace
20+
exclude: '\.(rst|txt)$'
21+
- repo: https://github.com/psf/black
22+
rev: 24.4.2
23+
hooks:
24+
- id: black
25+
- repo: https://github.com/pycqa/flake8
26+
rev: 7.0.0
27+
hooks:
28+
- id: flake8
29+
- repo: https://github.com/pycqa/isort
30+
rev: 5.13.2
31+
hooks:
32+
- id: isort
33+
args: ["--profile", "black", "--order-by-type"]
34+
exclude: ^src/diffpy/pdffit2/__init__\.py$
35+
- repo: https://github.com/kynan/nbstripout
36+
rev: 0.7.1
37+
hooks:
38+
- id: nbstripout
39+
- repo: https://github.com/pre-commit/pre-commit-hooks
40+
rev: v4.4.0
41+
hooks:
42+
- id: no-commit-to-branch
43+
name: Prevent Commit to Main Branch
44+
args: ["--branch", "main"]
45+
stages: [pre-commit]

0 commit comments

Comments
 (0)