diff --git a/.codecov.yml b/.codecov.yml index 03afe9c3..04dd6510 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -20,7 +20,7 @@ coverage: target: auto if_no_uploads: error if_not_found: success - if_ci_failed: failure + if_ci_failed: error paths: '!*/tests/.*' tests: diff --git a/.coveragerc b/.coveragerc index fe263c87..67cad8f9 100644 --- a/.coveragerc +++ b/.coveragerc @@ -6,7 +6,7 @@ omit = */python?.?/* */site-packages/nose/* # ignore _version.py and versioneer.py - *version.* + .*version.* *_version.py exclude_lines = diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 42fce5f9..00000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -diffpy.snmf/_version.py export-subst diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml index 3513cb34..2f951515 100644 --- a/.github/workflows/check-news-item.yml +++ b/.github/workflows/check-news-item.yml @@ -6,7 +6,7 @@ on: - main jobs: - check-news-item: + build: uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 with: project: diffpy.snmf diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index e9e742d0..4f8649e8 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -11,7 +11,7 @@ on: workflow_dispatch: jobs: - CI: + coverage: uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: project: diffpy.snmf diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml index 098a344e..3a4e7dbf 100644 --- a/.github/workflows/publish-docs-on-release.yml +++ b/.github/workflows/publish-docs-on-release.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: jobs: - publish-docs-on-release: + docs: uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 with: project: diffpy.snmf diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index 988d86b7..1e147a19 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - tests-on-pr: + validate: uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 with: project: diffpy.snmf diff --git a/.gitignore b/.gitignore index 36ed155a..a25212ea 100644 --- a/.gitignore +++ b/.gitignore @@ -20,9 +20,14 @@ 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 @@ -33,6 +38,7 @@ var/ # Installer logs pip-log.txt pip-delete-this-directory.txt +MANIFEST # Unit test / coverage reports htmlcov/ @@ -49,48 +55,45 @@ coverage.xml *.mo *.pot +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + # Django stuff: *.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy # Sphinx documentation -docs/_build/ +docs/build/ +docs/source/generated/ + +# pytest +.pytest_cache/ # PyBuilder target/ -# IPython Notebook -.ipynb_checkpoints - -# pyenv -.python-version +# Editor files +# mac +.DS_Store +*~ -# celery beat schedule file -celerybeat-schedule +# vim +*.swp +*.swo -# dotenv -.env +# pycharm +.idea/ -# virtualenv -venv/ -ENV/ +# VSCode +.vscode/ -# Spyder project settings -.spyderproject +# Ipython Notebook +.ipynb_checkpoints -# Rope project settings -.ropeproject +# version information +setup.cfg +/src/diffpy/*/version.cfg -# pycharm -.idea/ -# Mac -.DS_Store # Rever rever/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4588061..3070e199 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,10 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - exclude: '\.(rst|txt)$' + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml + - id: check-added-large-files - repo: https://github.com/psf/black rev: 24.4.2 hooks: diff --git a/AUTHORS.rst b/AUTHORS.rst index 6736f65f..4546e682 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,7 +1,7 @@ Authors ======= -Billinge Group and community contibutors. +Billinge Group and community contributors. Contributors ------------ diff --git a/MANIFEST.in b/MANIFEST.in index 73710630..f1a78eec 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,14 +1,12 @@ -include AUTHORS.rst -include LICENSE -include README.rst -include requirements.txt - -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] - -recursive-include docs *.rst conf.py Makefile make.bat - -include diffpy.snmf/version.py - -# If including data files in the package, add them like: -# include path/to/data_file +graft src +graft tests +graft requirements + +include AUTHORS.rst LICENSE*.rst README.rst + +# Exclude all bytecode files and __pycache__ directories +global-exclude *.py[cod] # Exclude all .pyc, .pyo, and .pyd files. +global-exclude .DS_Store # Exclude Mac filesystem artifacts. +global-exclude __pycache__ # Exclude Python cache directories. +global-exclude .git* # Exclude git files and directories. +global-exclude .idea # Exclude PyCharm project settings. diff --git a/README.rst b/README.rst index 83998e52..c30f8cf9 100644 --- a/README.rst +++ b/README.rst @@ -15,8 +15,8 @@ .. |Black| image:: https://img.shields.io/badge/code_style-black-black :target: https://github.com/psf/black -.. |CI| image:: https://github.com/diffpy/diffpy.snmf/actions/workflows/main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.snmf/actions/workflows/main.yml +.. |CI| image:: https://github.com/diffpy/diffpy.snmf/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.snmf/actions/workflows/matrix-and-codecov-on-merge-to-main.yml .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.snmf/branch/main/graph/badge.svg :target: https://codecov.io/gh/diffpy/diffpy.snmf @@ -83,11 +83,7 @@ Then, to fully install ``diffpy.snmf`` in our active environment, run :: Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -To install using ``pip`` into your ``diffpy.snmf_env`` environment, we will also have to install dependencies :: - - pip install -r https://raw.githubusercontent.com/diffpy/diffpy.snmf/main/requirements/run.txt - -and then install the package :: +To install using ``pip`` into your ``diffpy.snmf_env`` environment, type :: pip install diffpy.snmf @@ -102,7 +98,7 @@ Support and Contribute `Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.snmf. Please join the diffpy.snmf users community by joining the Google group. The diffpy.snmf project welcomes your expertise and enthusiasm! -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. Feel free to fork the project and contribute. To install diffpy.snmf in a development mode, with its sources being directly used by Python diff --git a/doc/make.bat b/doc/make.bat index 2be83069..ac53d5bd 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -1,36 +1,36 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build -set SPHINXPROJ=PackagingScientificPython - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build +set SPHINXPROJ=PackagingScientificPython + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/doc/source/index.rst b/doc/source/index.rst index 39fa0d3a..b7755b07 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -2,7 +2,7 @@ Welcome to SNMF's Documentation! ==================================== ``SNMF``: This library implements the stretched non negative matrix factorization (sNMF) and sparse stretched NMF -(ssNMF) algorithms described in the paper "Stretched Non-negative Matrix Factorization" by Ran Gu et al. (2023), +(ssNMF) algorithms described in the paper "Stretched Non-negative Matrix Factorization" by Ran Gu et al. (2023), which is referenced under the Citation section below. This algorithm is designed to do an NMF factorization on a set of signals ignoring any uniform stretching of the signal @@ -63,7 +63,7 @@ Jame R. Neilson, Karena W. Chapman, Qiang Du, and Simon J. L. Billinge. This software implementation was developed by members of the Billinge Group at Columbia University and Brookhaven National Laboratory including Ran Gu, Adeolu Ajayi, Qiang Du, and Simon J. L. Billinge. -For a detailed list of contributors, check `here +For a detailed list of contributors, check `here `_. To get started, please go to :ref:`quick_start` diff --git a/doc/source/license.rst b/doc/source/license.rst index 2dd94692..573ccaf2 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -9,9 +9,9 @@ OPEN SOURCE LICENSE AGREEMENT ============================= BSD 3-Clause License -Copyright (c) 2023-2024, The Trustees of Columbia University in +Copyright (c) 2023-2024, The Trustees of Columbia University in the City of New York. -All Rights Reserved. +All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/doc/source/release.rst b/doc/source/release.rst index 8956c788..27cd0cc9 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -1,3 +1,5 @@ +:tocdepth: -1 + .. index:: release notes -.. include:: /../../CHANGELOG.rst +.. include:: ../../CHANGELOG.rst diff --git a/news/recut.rst b/news/recut.rst new file mode 100644 index 00000000..25a14dbb --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* re-cookiecuter repo to groupd's package standard + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 1250363b..f12b2003 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] +requires = ["setuptools>=62.0", "setuptools-git-versioning>=2.0"] build-backend = "setuptools.build_meta" [project] name = "diffpy.snmf" -dynamic=['version'] +dynamic=['version', 'dependencies'] authors = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] @@ -45,9 +45,12 @@ dirty_template = "{tag}" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["*"] # package names should match these glob patterns (["*"] by default) -exclude = ["diffpy.snmf.tests*"] # exclude packages matching these glob patterns (empty by default) +exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) +[tool.setuptools.dynamic] +dependencies = {file = ["requirements/run.txt"]} + [tool.black] line-length = 115 include = '\.pyi?$' diff --git a/requirements/build.txt b/requirements/build.txt index f72d870d..e69de29b 100644 --- a/requirements/build.txt +++ b/requirements/build.txt @@ -1,2 +0,0 @@ -python -setuptools diff --git a/requirements/test.txt b/requirements/test.txt index f33bd0e3..a7277865 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,5 +2,5 @@ flake8 pytest codecov coverage -pytest-env pytest-cov +pytest-env diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 00000000..eccc3cf3 --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,10 @@ +"""Unit tests for __version__.py +""" + +import diffpy.snmf + + +def test_package_version(): + """Ensure the package version is defined and not set to the initial placeholder.""" + assert hasattr(diffpy.snmf, "__version__") + assert diffpy.snmf.__version__ != "0.0.0"