diff --git a/diffpy.srmise/.codecov.yml b/diffpy.srmise/.codecov.yml new file mode 100644 index 0000000..04dd651 --- /dev/null +++ b/diffpy.srmise/.codecov.yml @@ -0,0 +1,34 @@ +# codecov can find this file anywhere in the repo, so we don't need to clutter +# the root folder. +#comment: false + +codecov: + notify: + require_ci_to_pass: no + +coverage: + status: + patch: + default: + target: '70' + if_no_uploads: error + if_not_found: success + if_ci_failed: failure + project: + default: false + library: + target: auto + if_no_uploads: error + if_not_found: success + if_ci_failed: error + paths: '!*/tests/.*' + + tests: + target: 97.9% + paths: '*/tests/.*' + if_not_found: success + +flags: + tests: + paths: + - tests/ diff --git a/diffpy.srmise/.coveragerc b/diffpy.srmise/.coveragerc new file mode 100644 index 0000000..80e424e --- /dev/null +++ b/diffpy.srmise/.coveragerc @@ -0,0 +1,13 @@ +[run] +source = + diffpy.srmise +[report] +omit = + */python?.?/* + */site-packages/nose/* + # ignore _version.py and versioneer.py + .*version.* + *_version.py + +exclude_lines = + if __name__ == '__main__': diff --git a/diffpy.srmise/.flake8 b/diffpy.srmise/.flake8 new file mode 100644 index 0000000..2d2cb16 --- /dev/null +++ b/diffpy.srmise/.flake8 @@ -0,0 +1,11 @@ +[flake8] +exclude = + .git, + __pycache__, + build, + dist, + doc/source/conf.py +max-line-length = 115 +# Ignore some style 'errors' produced while formatting by 'black' +# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings +extend-ignore = E203 diff --git a/diffpy.srmise/.gitattributes b/diffpy.srmise/.gitattributes new file mode 100644 index 0000000..e7c3aea --- /dev/null +++ b/diffpy.srmise/.gitattributes @@ -0,0 +1 @@ +diffpy.srmise/_version.py export-subst diff --git a/diffpy.srmise/.github/workflows/docs.yml b/diffpy.srmise/.github/workflows/docs.yml new file mode 100644 index 0000000..a4661f5 --- /dev/null +++ b/diffpy.srmise/.github/workflows/docs.yml @@ -0,0 +1,43 @@ +name: Build Documentation + +on: + push: + branches: + - main + release: + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: build + auto-update-conda: true + + - name: install requirements + run: >- + conda install -n build -c conda-forge + --file requirements/build.txt + --file requirements/run.txt + --file requirements/docs.txt + --quiet --yes + + - name: install the package + run: python -m pip install . --no-deps + + - name: build documents + run: make -C doc html + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./doc/build/html diff --git a/diffpy.srmise/.github/workflows/main.yml b/diffpy.srmise/.github/workflows/main.yml new file mode 100644 index 0000000..e139797 --- /dev/null +++ b/diffpy.srmise/.github/workflows/main.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: + - main + - CI + pull_request: + workflow_dispatch: + +jobs: + miniconda: + name: Miniconda ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["ubuntu-latest"] + steps: + - name: check out diffpy.srmise + uses: actions/checkout@v3 + with: + repository: diffpy/diffpy.srmise + path: . + fetch-depth: 0 # avoid shallow clone with no tags + + - name: initialize miniconda + # this uses a marketplace action that sets up miniconda in a way that makes + # it easier to use. I tried setting it up without this and it was a pain + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: test + # environment.yml file is needed by this action. Because I don't want + # maintain this but rather maintain the requirements files it just has + # basic things in it like conda and pip + environment-file: ./environment.yml + python-version: 3 + auto-activate-base: false + + - name: install diffpy.srmise requirements + shell: bash -l {0} + run: | + conda config --set always_yes yes --set changeps1 no + conda config --add channels conda-forge + conda activate test + conda install --file requirements/run.txt + conda install --file requirements/test.txt + pip install . + + - name: Validate diffpy.srmise + shell: bash -l {0} + run: | + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov diff --git a/diffpy.srmise/.github/workflows/pre-commit.yml b/diffpy.srmise/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..f2ff7e4 --- /dev/null +++ b/diffpy.srmise/.github/workflows/pre-commit.yml @@ -0,0 +1,19 @@ +name: pre-commit + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + pre-commit: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + with: + extra_args: --all-files diff --git a/diffpy.srmise/.gitignore b/diffpy.srmise/.gitignore new file mode 100644 index 0000000..a25212e --- /dev/null +++ b/diffpy.srmise/.gitignore @@ -0,0 +1,99 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +venv/ +*.egg-info/ +.installed.cfg +*.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 +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# 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 + +# version information +setup.cfg +/src/diffpy/*/version.cfg + +# Rever +rever/ diff --git a/diffpy.srmise/.isort.cfg b/diffpy.srmise/.isort.cfg new file mode 100644 index 0000000..e0926f4 --- /dev/null +++ b/diffpy.srmise/.isort.cfg @@ -0,0 +1,4 @@ +[settings] +line_length = 115 +multi_line_output = 3 +include_trailing_comma = True diff --git a/diffpy.srmise/.pre-commit-config.yaml b/diffpy.srmise/.pre-commit-config.yaml new file mode 100644 index 0000000..c458806 --- /dev/null +++ b/diffpy.srmise/.pre-commit-config.yaml @@ -0,0 +1,43 @@ +default_language_version: + python: python3 +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit hooks + autofix_prs: true + autoupdate_branch: 'pre-commit-autoupdate' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: monthly + skip: [no-commit-to-branch] + submodules: false +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + exclude: '\.(rst|txt)$' + - repo: https://github.com/psf/black + rev: 24.4.2 + hooks: + - id: black + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + args: ["--profile", "black"] + - repo: https://github.com/kynan/nbstripout + rev: 0.7.1 + hooks: + - id: nbstripout + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: no-commit-to-branch + name: Prevent Commit to Main Branch + args: ["--branch", "main"] + stages: [pre-commit] diff --git a/diffpy.srmise/doc/source/_static/.placeholder b/diffpy.srmise/doc/source/_static/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/diffpy.srmise/environment.yml b/diffpy.srmise/environment.yml new file mode 100644 index 0000000..b467ca2 --- /dev/null +++ b/diffpy.srmise/environment.yml @@ -0,0 +1,6 @@ +name: diffpy.srmise +channels: + - conda-forge +dependencies: + - python=3 + - pip diff --git a/diffpy.srmise/requirements/build.txt b/diffpy.srmise/requirements/build.txt new file mode 100644 index 0000000..f4c99c0 --- /dev/null +++ b/diffpy.srmise/requirements/build.txt @@ -0,0 +1,5 @@ +python +setuptools +matplotlib +numpy +scipy \ No newline at end of file diff --git a/diffpy.srmise/requirements/docs.txt b/diffpy.srmise/requirements/docs.txt new file mode 100644 index 0000000..ab17b1c --- /dev/null +++ b/diffpy.srmise/requirements/docs.txt @@ -0,0 +1,4 @@ +sphinx +sphinx_rtd_theme +doctr +m2r