diff --git a/.codecov.yml b/.codecov.yml index 86671410..4af5eb24 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,2 +1,14 @@ -fixes: - - ".*/site-packages/::src/" +coverage: + status: + project: # more options at https://docs.codecov.com/docs/commit-status + default: + target: auto # use the coverage from the base commit, fail if coverage is lower + threshold: 0% # allow the coverage to drop by + +comment: + layout: " diff, flags, files" + behavior: default + require_changes: false + require_base: false # [true :: must have a base report to post] + require_head: false # [true :: must have a head report to post] + hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage] diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt index 3b490070..63971de7 100644 --- a/.codespell/ignore_words.txt +++ b/.codespell/ignore_words.txt @@ -10,15 +10,6 @@ socio-economic ;; Frobenius norm used in np.linalg.norm fro -;; abbreviation for "structure" -struc - -;; method name within JournalPanel class -onText - -;; a method name within JournalPanel class -delt - ;; structure file format discus diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index d0a0d16d..00000000 --- a/.coveragerc +++ /dev/null @@ -1,22 +0,0 @@ -# Configuration of the coverage.py tool for reporting test coverage. - -[report] -# RE patterns for lines to be excluded from consideration. -exclude_lines = - ## Have to re-enable the standard pragma - pragma: no cover - ## Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - ^[ ]*assert False - - ## Don't complain if non-runnable code isn't run: - ^[ ]*@unittest.skip\b - ^[ ]{4}unittest.main() - if __name__ == .__main__.: - - -[run] -omit = - ## exclude debug.py from codecov report - */tests/debug.py diff --git a/.gitarchive.cfg b/.gitarchive.cfg deleted file mode 100644 index 95e1448c..00000000 --- a/.gitarchive.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -commit = $Format:%H$ -date = $Format:%ci$ -timestamp = $Format:%ct$ -refnames = $Format:%D$ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 2c3906b0..00000000 --- a/.gitattributes +++ /dev/null @@ -1,7 +0,0 @@ -/.gitattributes export-ignore -/.gitignore export-ignore -/.travis.yml export-ignore -/conda-recipe/ export-ignore -/devutils export-ignore -/doc export-ignore -.gitarchive.cfg export-subst diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml new file mode 100644 index 00000000..f751e848 --- /dev/null +++ b/.github/workflows/build-wheel-release-upload.yml @@ -0,0 +1,18 @@ +name: Release (GitHub/PyPI) and Deploy Docs + +on: + workflow_dispatch: + push: + tags: + - "*" # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml + +jobs: + release: + uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0 + with: + project: diffpy.srreal + c_extension: true + github_admin_username: sbillinge + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + PAT_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml new file mode 100644 index 00000000..26108723 --- /dev/null +++ b/.github/workflows/check-news-item.yml @@ -0,0 +1,12 @@ +name: Check for News + +on: + pull_request_target: + branches: + - main + +jobs: + check-news-item: + uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 + with: + project: diffpy.srreal diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml new file mode 100644 index 00000000..ea2983bd --- /dev/null +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: + +jobs: + matrix-coverage: + uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 + with: + project: diffpy.srreal + c_extension: true + headless: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml new file mode 100644 index 00000000..8daf1623 --- /dev/null +++ b/.github/workflows/publish-docs-on-release.yml @@ -0,0 +1,12 @@ +name: Deploy Documentation on Release + +on: + workflow_dispatch: + +jobs: + docs: + uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: diffpy.srreal + c_extension: true + headless: false diff --git a/.gitignore b/.gitignore index 120238d6..d418364a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,52 +1,92 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ *.py[cod] +*$py.class # C extensions *.so -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -temp -develop-eggs +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +venv/ +*.egg-info/ .installed.cfg -lib -lib64 -tags +*.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 -.tox +.coverage.* +.cache nosetests.xml +coverage.xml +*,cover +.hypothesis/ # Translations *.mo +*.pot # Mr Developer .mr.developer.cfg .project .pydevproject -.settings - -# SCons build files -.gdb_history -.sconf_temp/ -.sconsign.dblite -config.log -/sconscript.local -/sconsvars.py - -# version information -setup.cfg -/src/diffpy/*/version.cfg + +# 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 diff --git a/AUTHORS.rst b/AUTHORS.rst new file mode 100644 index 00000000..ad15dbc7 --- /dev/null +++ b/AUTHORS.rst @@ -0,0 +1,12 @@ +Authors +======= + +Pavol Juhas, +Chris Farrow, +Simon J.L. Billinge + +Contributors +------------ + +For a list of contributors, visit +https://github.com/diffpy/diffpy.srreal/graphs/contributors diff --git a/AUTHORS.txt b/AUTHORS.txt deleted file mode 100644 index 00374f30..00000000 --- a/AUTHORS.txt +++ /dev/null @@ -1,9 +0,0 @@ -Authors: - -Pavol Juhas -Chris Farrow -Simon J.L. Billinge - -Contributors: - -https://github.com/diffpy/diffpy.srreal/graphs/contributors diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 8c521cc6..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,41 +0,0 @@ -# Release notes - -## Version 1.3.0 – 2019-03-13 - -Main differences from version 1.2. - -### Added - -- Support for Python 3.7, 3.6, 3.5 in addition to 2.7. -- Validation of compiler options from `python-config`. -- Make scons scripts compatible with Python 3 and Python 2. -- `ConstantPeakWidth` attributes `uisowidth`, `bisowidth` to ease - PDF simulation with uniform isotropic atom displacements. - -### Changed - -- Require libdiffpy 1.4 or later. -- Build Anaconda package with Anaconda C++ compiler. -- Allow language standard c++11. -- Pickle format for `PDFCalculator`, `DebyePDFCalculator`, - `OverlapCalculator`, `PeakWidthModel`, `PeakProfile`, `PDFEnvelope`, - `PDFBaseline`, and `ScatteringFactorTable` objects. - -### Deprecated - -- Variable `__gitsha__` in the `version` module renamed to `__git_commit__`. -- `libdiffpy_version_info` attribute `git_sha` renamed to `git_commit`. - -### Removed - -- Unused method `BVParam.__hash__`. -- Disable pickling of `BasePairQuantity` as it is in effect abstract. -- Pickling of Python-added attributes to exported C++ classes. -- Function `get_libdiffpy_version_info` from the `version` module. - -### Fixed - -- Return value conversion of `CrystalStructureAdapter` methods - `expandLatticeAtom` and `getEquivalentAtoms` methods. - Make them return a `list` of `Atom` objects. -- Name suffix resolution of `boost_python` shared library. diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 00000000..6f96d258 --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,47 @@ +============= +Release Notes +============= + +.. current developments + + +Version 1.3.0 2019-03-13 +========================= + +Main differences from version 1.2. + +**Added:** + +* Support for Python 3.7, 3.6, 3.5 in addition to 2.7. +* Validation of compiler options from `python-config`. +* Make scons scripts compatible with Python 3 and Python 2. +* `ConstantPeakWidth` attributes `uisowidth`, `bisowidth` to ease + PDF simulation with uniform isotropic atom displacements. + +**Changed:** + +* Require libdiffpy 1.4 or later. +* Build Anaconda package with Anaconda C++ compiler. +* Allow language standard c++11. +* Pickle format for `PDFCalculator`, `DebyePDFCalculator`, + `OverlapCalculator`, `PeakWidthModel`, `PeakProfile`, `PDFEnvelope`, + `PDFBaseline`, and `ScatteringFactorTable` objects. + +**Deprecated:** + +* Variable `__gitsha__` in the `version` module renamed to `__git_commit__`. +* `libdiffpy_version_info` attribute `git_sha` renamed to `git_commit`. + +**Removed** + +* Unused method `BVParam.__hash__`. +* Disable pickling of `BasePairQuantity` as it is in effect abstract. +* Pickling of Python-added attributes to exported C++ classes. +* Function `get_libdiffpy_version_info` from the `version` module. + +**Fixed** + +* Return value conversion of `CrystalStructureAdapter` methods + `expandLatticeAtom` and `getEquivalentAtoms` methods. + Make them return a `list` of `Atom` objects. +* Name suffix resolution of `boost_python` shared library. diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst new file mode 100644 index 00000000..ff9c3561 --- /dev/null +++ b/CODE_OF_CONDUCT.rst @@ -0,0 +1,133 @@ +===================================== + Contributor Covenant Code of Conduct +===================================== + +Our Pledge +---------- + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +Our Standards +------------- + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +Enforcement Responsibilities +---------------------------- + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +Scope +----- + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +Enforcement +----------- + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +sb2896@columbia.edu. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +Enforcement Guidelines +---------------------- + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +1. Correction +**************** + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +2. Warning +************* + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +3. Temporary Ban +****************** + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +4. Permanent Ban +****************** + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +Attribution +----------- + +This Code of Conduct is adapted from the `Contributor Covenant `_. + +Community Impact Guidelines were inspired by `Mozilla's code of conduct enforcement ladder `_. + +For answers to common questions about this code of conduct, see the `FAQ `_. `Translations are available `_ diff --git a/LICENSE.rst b/LICENSE.rst new file mode 100644 index 00000000..c983d73f --- /dev/null +++ b/LICENSE.rst @@ -0,0 +1,142 @@ +OPEN SOURCE LICENSE AGREEMENT +============================= + +Copyright (c) 2009-2011, University of Tennessee + +Copyright (c) 1989, 1991 Free Software Foundation, Inc. + +Copyright (c) 2006, The Regents of the University of California through Lawrence Berkeley National Laboratory + +Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") + +Copyright (c) 2006-2007, Board of Trustees of Michigan State University + +Copyright (c) 2008-2012, The Trustees of Columbia University in the City of New York + +Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory + +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +All rights reserved. + +The "DiffPy-CMI" is distributed subject to the following license conditions: + +.. code-block:: text + + SOFTWARE LICENSE AGREEMENT + + Software: DiffPy-CMI + + + (1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either + source code, or binary form and accompanying documentation). + + Part of the software was derived from the DANSE, ObjCryst++ (with permission), + PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of + which the original Copyrights are contained in each individual file. + + Each licensee is addressed as "you" or "Licensee." + + + (2) The copyright holders shown above and their third-party Licensors hereby + grant licensee a royalty-free nonexclusive license, subject to the limitations + stated herein and U.S. Government license rights. + + + (3) You may modify and make a copy or copies of the software for use within + your organization, if you meet the following conditions: + + (a) Copies in source code must include the copyright notice and this + software license agreement. + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy. + + + (4) You may modify a copy or copies of the Software or any portion of it, thus + forming a work based on the Software, and distribute copies of such work + outside your organization, if you meet all of the following conditions: + + (a) Copies in source code must include the copyright notice and this + Software License Agreement; + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy; + + (c) Modified copies and works based on the Software must carry prominent + notices stating that you changed specified portions of the Software. + + (d) Neither the name of Brookhaven Science Associates or Brookhaven + National Laboratory nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + written permission. + + + (5) Portions of the Software resulted from work developed under a U.S. + Government contract and are subject to the following license: + The Government is granted for itself and others acting on its behalf a + paid-up, nonexclusive, irrevocable worldwide license in this computer software + to reproduce, prepare derivative works, and perform publicly and display + publicly. + + + (6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT + WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY + LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND + THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL + LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF + THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE + PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION + UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. + + + (7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR + THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF + ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, + CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING + BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, + WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING + NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS + BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. + + +Brookhaven National Laboratory Notice +===================================== + +Acknowledgment of sponsorship +----------------------------- + +This software was produced by the Brookhaven National Laboratory, under +Contract DE-AC02-98CH10886 with the Department of Energy. + + +Government disclaimer of liability +---------------------------------- + +Neither the United States nor the United States Department of Energy, nor +any of their employees, makes any warranty, express or implied, or assumes +any legal liability or responsibility for the accuracy, completeness, or +usefulness of any data, apparatus, product, or process disclosed, or +represents that its use would not infringe privately owned rights. + + +Brookhaven disclaimer of liability +---------------------------------- + +Brookhaven National Laboratory makes no representations or warranties, +express or implied, nor assumes any liability for the use of this software. + + +Maintenance of notice +--------------------- + +In the interest of clarity regarding the origin and status of this +software, Brookhaven National Laboratory requests that any recipient of it +maintain this notice affixed to any distribution by the recipient that +contains a copy or derivative of this software. + + +END OF LICENSE diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index f6d92af7..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,137 +0,0 @@ -OPEN SOURCE LICENSE AGREEMENT -============================= - -Copyright (c) 2009-2011, University of Tennessee -Copyright (c) 1989, 1991 Free Software Foundation, Inc. -Copyright (c) 2006, The Regents of the University of California through - Lawrence Berkeley National Laboratory -Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") -Copyright (c) 2006-2007, Board of Trustees of Michigan State University -Copyright (c) 2008-2012, The Trustees of Columbia University in the City - of New York - -Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National - Laboratory - - -The "DiffPy-CMI" is distributed subject to the following license conditions: - - -SOFTWARE LICENSE AGREEMENT - - Software: DiffPy-CMI - - -(1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either -source code, or binary form and accompanying documentation). - -Part of the software was derived from the DANSE, ObjCryst++ (with permission), -PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of -which the original Copyrights are contained in each individual file. - -Each licensee is addressed as "you" or "Licensee." - - -(2) The copyright holders shown above and their third-party Licensors hereby -grant licensee a royalty-free nonexclusive license, subject to the limitations -stated herein and U.S. Government license rights. - - -(3) You may modify and make a copy or copies of the software for use within -your organization, if you meet the following conditions: - - (a) Copies in source code must include the copyright notice and this - software license agreement. - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy. - - -(4) You may modify a copy or copies of the Software or any portion of it, thus -forming a work based on the Software, and distribute copies of such work -outside your organization, if you meet all of the following conditions: - - (a) Copies in source code must include the copyright notice and this - Software License Agreement; - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy; - - (c) Modified copies and works based on the Software must carry prominent - notices stating that you changed specified portions of the Software. - - (d) Neither the name of Brookhaven Science Associates or Brookhaven - National Laboratory nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - written permission. - - -(5) Portions of the Software resulted from work developed under a U.S. -Government contract and are subject to the following license: -The Government is granted for itself and others acting on its behalf a -paid-up, nonexclusive, irrevocable worldwide license in this computer software -to reproduce, prepare derivative works, and perform publicly and display -publicly. - - -(6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT -WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY -LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND -THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL -LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF -THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE -PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION -UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. - - -(7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR -THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF -ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, -CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING -BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, -WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING -NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS -BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. - - -Brookhaven National Laboratory Notice -===================================== - -Acknowledgment of sponsorship ------------------------------ - -This software was produced by the Brookhaven National Laboratory, under -Contract DE-AC02-98CH10886 with the Department of Energy. - - -Government disclaimer of liability ----------------------------------- - -Neither the United States nor the United States Department of Energy, nor -any of their employees, makes any warranty, express or implied, or assumes -any legal liability or responsibility for the accuracy, completeness, or -usefulness of any data, apparatus, product, or process disclosed, or -represents that its use would not infringe privately owned rights. - - -Brookhaven disclaimer of liability ----------------------------------- - -Brookhaven National Laboratory makes no representations or warranties, -express or implied, nor assumes any liability for the use of this software. - - -Maintenance of notice ---------------------- - -In the interest of clarity regarding the origin and status of this -software, Brookhaven National Laboratory requests that any recipient of it -maintain this notice affixed to any distribution by the recipient that -contains a copy or derivative of this software. - - -END OF LICENSE diff --git a/LICENSE_DANSE.txt b/LICENSE_DANSE.rst similarity index 78% rename from LICENSE_DANSE.txt rename to LICENSE_DANSE.rst index f5f9f3ea..1c0ab5db 100644 --- a/LICENSE_DANSE.txt +++ b/LICENSE_DANSE.rst @@ -1,24 +1,32 @@ +LICENSE +======= + This program is part of the DiffPy and DANSE open-source projects and is available subject to the conditions and terms laid out below. -Copyright (c) 2008-2012, The Trustees of Columbia University in -the City of New York. All rights reserved. +Copyright (c) 2008-2012, The Trustees of Columbia University in the City of New York. +All rights reserved. + +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +All rights reserved. For more information please visit the project web-page at + http://www.diffpy.org + or email Prof. Simon Billinge at sb2896@columbia.edu. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of the copyright holder nor the names of its +- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/MANIFEST.in b/MANIFEST.in index f27ccfbe..f1a78eec 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,17 +1,12 @@ -recursive-include src * -include SConstruct -include AUTHORS.txt LICENSE*.txt README.rst -recursive-exclude src *.pyc *.so -global-exclude .gitattributes .gitignore .gitarchive.cfg -global-exclude .DS_Store +graft src +graft tests +graft requirements -# Avoid user content in setup.cfg to make distribution reproducible. -exclude setup.cfg +include AUTHORS.rst LICENSE*.rst README.rst -# Exclude git-tracked files spuriously added by setuptools_scm -exclude .coveragerc -exclude .travis* -prune conda-recipe -prune devutils -prune doc -prune examples +# 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 f6388b27..a6d2ff81 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,41 @@ -.. image:: https://travis-ci.org/diffpy/diffpy.srreal.svg?branch=master - :target: https://travis-ci.org/diffpy/diffpy.srreal +|Icon| |title|_ +=============== -.. image:: https://codecov.io/gh/diffpy/diffpy.srreal/branch/master/graph/badge.svg - :target: https://codecov.io/gh/diffpy/diffpy.srreal +.. |title| replace:: diffpy.srreal +.. _title: https://diffpy.github.io/diffpy.srreal -diffpy.srreal -======================================================================== +.. |Icon| image:: https://avatars.githubusercontent.com/diffpy + :target: https://diffpy.github.io/diffpy.srreal + :height: 100px -Calculators for PDF, bond valence sum and other pair quantities +|PyPi| |Forge| |PythonVersion| |PR| + +|CI| |Codecov| |Black| |Tracking| + +.. |Black| image:: https://img.shields.io/badge/code_style-black-black + :target: https://github.com/psf/black + +.. |CI| image:: https://github.com/diffpy/diffpy.srreal/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.srreal/actions/workflows/matrix-and-codecov-on-merge-to-main.yml + +.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.srreal/branch/main/graph/badge.svg + :target: https://codecov.io/gh/diffpy/diffpy.srreal + +.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.srreal + :target: https://anaconda.org/conda-forge/diffpy.srreal + +.. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff + +.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.srreal + :target: https://pypi.org/project/diffpy.srreal/ + +.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.srreal + :target: https://pypi.org/project/diffpy.srreal/ + +.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue + :target: https://github.com/diffpy/diffpy.srreal/issues + +Calculators for PDF, bond valence sum, and other quantities based on atom pair interaction. The diffpy.srreal package provides calculators for atomic pair distribution function (PDF), bond valence sums (BVS), atom overlaps for a hard-sphere @@ -39,126 +67,86 @@ calculate PDF with a user-defined profile function. A new calculator class can be also defined for any quantity that is obtained by iteration over atom pairs, by defining only the function that processes atom-pair contributions. -For more information about the diffpy.srreal library, see users manual at -http://diffpy.github.io/diffpy.srreal. - - -REQUIREMENTS ------------------------------------------------------------------------- - -The diffpy.srreal package requires Python 3.7, 3.6, 3.5 or 2.7, -C++ compiler and the following software: - -* ``setuptools`` - tools for installing Python packages -* ``NumPy`` - library for scientific computing with Python -* ``python-dev`` - header files for interfacing Python with C -* ``libboost-all-dev`` - Boost C++ libraries and development files -* ``libdiffpy`` - C++ library for PDF, bond valence sum and other pair - quantity calculators https://github.com/diffpy/libdiffpy -* ``diffpy.structure`` - simple storage and manipulation of atomic structures - https://github.com/diffpy/diffpy.structure -* ``scons`` - software construction tool (optional) - -Optional software: - -* ``periodictable`` - periodic table of elements in Python - http://www.reflectometry.org/danse/elements.html -* ``pyobjcryst`` - Python bindings to ObjCryst++, the Object Oriented - Crystallographic library for C++, https://github.com/diffpy/pyobjcryst. +For more information about the diffpy.srreal library, please consult our `online documentation `_. -We recommend to use `Anaconda Python `_ -as it allows to install all software dependencies together with -diffpy.srreal. For other Python distributions it is necessary to -install the required software separately. As an example, on Ubuntu -Linux some of the required software can be installed using :: +Citation +-------- - sudo apt-get install \ - python-setuptools python-numpy scons \ - build-essential python-dev libboost-all-dev +If you use diffpy.srreal in a scientific publication, we would like you to cite this package as -To install the remaining packages see the installation instructions -at their respective web pages. + diffpy.srreal Package, https://github.com/diffpy/diffpy.srreal +Installation +------------ -INSTALLATION ------------------------------------------------------------------------- +The preferred method is to use `Miniconda Python +`_ +and install from the "conda-forge" channel of Conda packages. -The preferred method is to use Anaconda Python and install from the -"diffpy" channel of Anaconda packages :: +To add "conda-forge" to the conda channels, run the following in a terminal. :: - conda config --add channels diffpy - conda install diffpy.srreal + conda config --add channels conda-forge -diffpy.srreal is also included in the "diffpy-cmi" collection -of packages for structure analysis :: +We want to install our packages in a suitable conda environment. +The following creates and activates a new environment named ``diffpy.srreal_env`` :: - conda install diffpy-cmi + conda create -n diffpy.srreal_env diffpy.srreal + conda activate diffpy.srreal_env -If you prefer to install from sources, make sure all required software -packages are in place and then run :: +To confirm that the installation was successful, type :: - python setup.py install + python -c "import diffpy.srreal; print(diffpy.srreal.__version__)" -You may need to use ``sudo`` with system Python so the process is -allowed to copy files to the system directories. If administrator (root) -access is not available, see the output from -``python setup.py install --help`` for options to install to -a user-writable location. The installation integrity can be -verified by executing the included tests with :: +The output should print the latest version displayed on the badges above. - python -m diffpy.srreal.tests.run +If the above does not work, you can use ``pip`` to download and install the latest release from +`Python Package Index `_. +To install using ``pip`` into your ``diffpy.srreal_env`` environment, type :: -An alternative way of installing diffpy.srreal is to use the SCons tool, -which can speed up the process by compiling C++ files in several -parallel jobs (-j4) :: + pip install diffpy.srreal - sudo scons -j4 install +If you prefer to install from sources, after installing the dependencies, obtain the source archive from +`GitHub `_. Once installed, ``cd`` into your ``diffpy.srreal`` directory +and run the following :: -See ``scons -h`` for description of build targets and options. + pip install . +Getting Started +--------------- -DEVELOPMENT ------------------------------------------------------------------------- +You may consult our `online documentation `_ for tutorials and API references. -diffpy.srreal is an open-source software developed as a part of the -DiffPy-CMI complex modeling initiative at the Brookhaven National -Laboratory. The diffpy.srreal sources are hosted at -https://github.com/diffpy/diffpy.srreal. +Support and Contribute +---------------------- -Feel free to fork the project and contribute. To install diffpy.srreal -in a development mode, where the sources are directly used by Python -rather than copied to a system directory, use :: +`Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.srreal. Please join the diffpy.srreal users community by joining the Google group. The diffpy.srreal project welcomes your expertise and enthusiasm! - python setup.py develop --user +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 `_. -To rebuild the C++ extension module and then optionally test the code -integrity, use :: +Feel free to fork the project and contribute. To install diffpy.srreal +in a development mode, with its sources being directly used by Python +rather than copied to a package directory, use the following in the root +directory :: - scons -j4 build=debug develop [test] + pip install -e . -When developing with Anaconda Python it is essential to specify -header path, library path and runtime library path for the active -Anaconda environment. This can be achieved by setting the ``CPATH``, -``LIBRARY_PATH`` and ``LDFLAGS`` environment variables as follows:: +To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit +hooks. - # resolve the prefix directory P of the active Anaconda environment - P="$(conda info --json | grep default_prefix | cut -d\" -f4)" - export CPATH=$P/include - export LIBRARY_PATH=$P/lib - export LDFLAGS=-Wl,-rpath,$P/lib - # compile and re-install diffpy.srreal - scons -j4 build=debug develop +1. Install pre-commit in your working environment by running ``conda install pre-commit``. -Note the Anaconda package for the required libdiffpy library is built -with a C++ compiler provided by Anaconda. This may cause incompatibility -with system C++. In such case use Anaconda C++ to build diffpy.srreal. +2. Initialize pre-commit (one time only) ``pre-commit install``. +Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. +If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should +pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before +trying to commit again. -CONTACTS ------------------------------------------------------------------------- +Improvements and fixes are always appreciated. -For more information on diffpy.srreal please visit the project web-page +Before contributing, please read our `Code of Conduct `_. -http://www.diffpy.org +Contact +------- -or email Prof. Simon Billinge at sb2896@columbia.edu. +For more information on diffpy.srreal please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh deleted file mode 100644 index 16f60848..00000000 --- a/conda-recipe/build.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -MYNCPU=$(( (CPU_COUNT > 4) ? 4 : CPU_COUNT )) - -# Apply sconscript.local customizations. -cp ${RECIPE_DIR}/sconscript.local ./ - -# Install srreal with scons to utilize multiple CPUs. -scons -j $MYNCPU install prefix=$PREFIX diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml deleted file mode 100644 index 4c9fb940..00000000 --- a/conda-recipe/conda_build_config.yaml +++ /dev/null @@ -1,17 +0,0 @@ -python: - - 3.7 - - 3.6 - - 3.5 - - 2.7 - -numpy: - - 1.11 - -libdiffpy: - - 1.4.* - -boost: - - 1.67 - -pin_run_as_build: - boost: x.x diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml deleted file mode 100644 index b3d23d70..00000000 --- a/conda-recipe/meta.yaml +++ /dev/null @@ -1,83 +0,0 @@ -{% set setupdata = load_setup_py_data() %} - -package: - name: diffpy.srreal - version: {{ setupdata['version'] }} - -source: - # git_url: https://github.com/diffpy/diffpy.srreal - git_url: .. - -build: - preserve_egg_dir: True # [py2k] - - # If this is a new build for the same version, increment the build - # number. If you do not include this key, it defaults to 0. - # number: 0 - -requirements: - build: - - {{ compiler('cxx') }} - host: - - python {{ python }} - - setuptools - - scons - - numpy {{ numpy }} - - libdiffpy {{ libdiffpy }} - - boost {{ boost }} - - run: - # NOTE libdiffpy is added implicitly from libdiffpy run_exports - - python - - setuptools - - {{ pin_compatible('numpy', min_pin='x.x', max_pin='x') }} - - boost - - diffpy.structure - - pyobjcryst 2.1.* - - periodictable - -test: - # Python imports - imports: - - diffpy - - diffpy.srreal - - diffpy.srreal.tests - - commands: - # Test if any module can be imported as the first one. - - python -s -c "import diffpy.srreal.atomradiitable" - - python -s -c "import diffpy.srreal.attributes" - - python -s -c "import diffpy.srreal.bondcalculator" - - python -s -c "import diffpy.srreal.bvparameterstable" - - python -s -c "import diffpy.srreal.bvscalculator" - - python -s -c "import diffpy.srreal.eventticker" - - python -s -c "import diffpy.srreal.overlapcalculator" - - python -s -c "import diffpy.srreal.pairquantity" - - python -s -c "import diffpy.srreal.pdfbaseline" - - python -s -c "import diffpy.srreal.pdfcalculator" - - python -s -c "import diffpy.srreal.pdfenvelope" - - python -s -c "import diffpy.srreal.peakprofile" - - python -s -c "import diffpy.srreal.peakwidthmodel" - - python -s -c "import diffpy.srreal.scatteringfactortable" - - python -s -c "import diffpy.srreal.srreal_ext" - - python -s -c "import diffpy.srreal.structureadapter" - - python -s -c "import diffpy.srreal.structureconverters" - - python -s -c "import diffpy.srreal.version" - - - # You can also put a file called run_test.py in the recipe that will be run - # at test time. - - # requires: - # Put any additional test requirements here. For example - # - nose - -about: - home: https://github.com/diffpy/diffpy.srreal - summary: Calculators for PDF, bond valence sum and other - pair-interaction quantities. - license: Modified BSD License - license_file: LICENSE.txt - -# See http://docs.continuum.io/conda/build.html -# for more information about meta.yaml. diff --git a/conda-recipe/run_test.py b/conda-recipe/run_test.py deleted file mode 100644 index 0edfe0c3..00000000 --- a/conda-recipe/run_test.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python - -import diffpy.srreal.tests - -assert diffpy.srreal.tests.test().wasSuccessful() diff --git a/conda-recipe/sconscript.local b/conda-recipe/sconscript.local deleted file mode 100644 index f8740395..00000000 --- a/conda-recipe/sconscript.local +++ /dev/null @@ -1,18 +0,0 @@ -# Customize scons build environment. - -Import('env') - -import os - -# Apply environment settings for Anaconda compilers -env.Replace(CXX=os.environ['CXX']) -env.MergeFlags(os.environ['CFLAGS']) -env.MergeFlags(os.environ['CPPFLAGS']) -env.MergeFlags(os.environ['CXXFLAGS']) -env.MergeFlags(os.environ['LDFLAGS']) - -# Silence copious warnings from the boost headers. -P = os.environ['PREFIX'] -env.Prepend(CCFLAGS=['-isystem{}/include'.format(P)]) - -# vim: ft=python diff --git a/devutils/makesdist b/devutils/makesdist deleted file mode 100755 index 10bba1ff..00000000 --- a/devutils/makesdist +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python - -"""Create source distribution tar.gz archive, where each file belongs to a root -user and modification time is set to the git commit time.""" - -import glob -import gzip -import os -import subprocess -import sys -import tarfile - -from setup import FALLBACK_VERSION, versiondata - -BASEDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -sys.path.insert(0, BASEDIR) - -timestamp = versiondata.getint("DEFAULT", "timestamp") - -vfb = versiondata.get("DEFAULT", "version").split(".post")[0] + ".post0" -emsg = "Invalid FALLBACK_VERSION. Expected %r got %r." -assert vfb == FALLBACK_VERSION, emsg % (vfb, FALLBACK_VERSION) - - -def inform(s): - sys.stdout.write(s) - sys.stdout.flush() - return - - -inform('Run "setup.py sdist --formats=tar" ') -cmd_sdist = [sys.executable, "-Wignore:Cannot detect name suffix"] + "setup.py sdist --formats=tar".split() -ec = subprocess.call(cmd_sdist, cwd=BASEDIR, stdout=open(os.devnull, "w")) -if ec: - sys.exit(ec) -inform("[done]\n") - -tarname = max(glob.glob(BASEDIR + "/dist/*.tar"), key=os.path.getmtime) - -tfin = tarfile.open(tarname) -fpout = gzip.GzipFile(tarname + ".gz", "w", mtime=0) -tfout = tarfile.open(fileobj=fpout, mode="w") - - -def fixtarinfo(tinfo): - tinfo.uid = tinfo.gid = 0 - tinfo.uname = tinfo.gname = "root" - tinfo.mtime = timestamp - tinfo.mode &= ~0o022 - return tinfo - - -inform("Filter %s --> %s.gz " % (2 * (os.path.basename(tarname),))) -for ti in tfin: - tfout.addfile(fixtarinfo(ti), tfin.extractfile(ti)) - -tfin.close() -os.remove(tarname) -inform("[done]\n") diff --git a/doc/manual/Makefile b/doc/Makefile similarity index 83% rename from doc/manual/Makefile rename to doc/Makefile index a21894cf..0c241efa 100644 --- a/doc/manual/Makefile +++ b/doc/Makefile @@ -6,6 +6,12 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build +BASENAME = $(subst .,,$(subst $() $(),,diffpy.srreal)) + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 @@ -14,7 +20,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sou # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext publish +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @@ -29,17 +35,20 @@ help: @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: - -rm -rf $(BUILDDIR)/* + rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @@ -77,17 +86,17 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/SrReal.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/$(BASENAME).qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/SrReal.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(BASENAME).qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/SrReal" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/SrReal" + @echo "# mkdir -p $$HOME/.local/share/devhelp/$(BASENAME)" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/$(BASENAME)" @echo "# devhelp" epub: @@ -108,6 +117,12 @@ latexpdf: $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 00000000..ac53d5bd --- /dev/null +++ b/doc/make.bat @@ -0,0 +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 diff --git a/doc/manual/source/api/diffpy.srreal.rst b/doc/manual/source/api/diffpy.srreal.rst deleted file mode 100644 index 24629776..00000000 --- a/doc/manual/source/api/diffpy.srreal.rst +++ /dev/null @@ -1,163 +0,0 @@ -:tocdepth: 2 - -.. default-role:: py:obj - -diffpy.srreal package -===================== - -.. automodule:: diffpy.srreal - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -diffpy.srreal.atomradiitable module ------------------------------------ - -.. automodule:: diffpy.srreal.atomradiitable - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.attributes module -------------------------------- - -.. automodule:: diffpy.srreal.attributes - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.bondcalculator module ------------------------------------ - -.. automodule:: diffpy.srreal.bondcalculator - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.bvparameterstable module --------------------------------------- - -.. automodule:: diffpy.srreal.bvparameterstable - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.bvscalculator module ----------------------------------- - -.. automodule:: diffpy.srreal.bvscalculator - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.eventticker module --------------------------------- - -.. automodule:: diffpy.srreal.eventticker - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.overlapcalculator module --------------------------------------- - -.. automodule:: diffpy.srreal.overlapcalculator - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.pairquantity module ---------------------------------- - -.. automodule:: diffpy.srreal.pairquantity - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.parallel module ------------------------------ - -.. automodule:: diffpy.srreal.parallel - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.pdfbaseline module --------------------------------- - -.. automodule:: diffpy.srreal.pdfbaseline - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.pdfcalculator module ----------------------------------- - -.. automodule:: diffpy.srreal.pdfcalculator - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.pdfenvelope module --------------------------------- - -.. automodule:: diffpy.srreal.pdfenvelope - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.peakprofile module --------------------------------- - -.. automodule:: diffpy.srreal.peakprofile - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.peakwidthmodel module ------------------------------------ - -.. automodule:: diffpy.srreal.peakwidthmodel - :members: - :undoc-members: - :show-inheritance: - -diffpy.srreal.scatteringfactortable module ------------------------------------------- - -.. automodule:: diffpy.srreal.scatteringfactortable - :members: ScatteringFactorTable, SFTXray, - SFTElectron, SFTNeutron, SFTElectronNumber - :undoc-members: - :show-inheritance: - -diffpy.srreal.sfaverage module ------------------------------- - -.. automodule:: diffpy.srreal.sfaverage - :members: - :undoc-members: - :no-show-inheritance: - -diffpy.srreal.structureadapter module -------------------------------------- - -.. automodule:: diffpy.srreal.structureadapter - :members: - :undoc-members: - :show-inheritance: - -.. skip internal module diffpy.srreal.structureconverters - -diffpy.srreal.version module ----------------------------- - -.. automodule:: diffpy.srreal.version - :members: - :undoc-members: - :show-inheritance: - -.. skip internal module diffpy.srreal.wraputils diff --git a/doc/manual/source/license.rst b/doc/manual/source/license.rst deleted file mode 100644 index 7d78e94f..00000000 --- a/doc/manual/source/license.rst +++ /dev/null @@ -1,142 +0,0 @@ -.. index:: license - -License -####### - -OPEN SOURCE LICENSE AGREEMENT -============================= - -| Copyright (c) 2009-2011, University of Tennessee -| Copyright (c) 1989, 1991 Free Software Foundation, Inc. -| Copyright (c) 2006, The Regents of the University of California through - Lawrence Berkeley National Laboratory -| Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") -| Copyright (c) 2006-2007, Board of Trustees of Michigan State University -| Copyright (c) 2008-2012, The Trustees of Columbia University in - the City of New York -| Copyright (c) 2014-2019, Brookhaven Science Associates, - Brookhaven National Laboratory - - -The "DiffPy-CMI" is distributed subject to the following license conditions: - - -SOFTWARE LICENSE AGREEMENT -========================== - -Software: **DiffPy-CMI** - - -(1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either -source code, or binary form and accompanying documentation). - -Part of the software was derived from the DANSE, ObjCryst++ (with permission), -PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of -which the original Copyrights are contained in each individual file. - -Each licensee is addressed as "you" or "Licensee." - - -(2) The copyright holders shown above and their third-party Licensors hereby -grant licensee a royalty-free nonexclusive license, subject to the limitations -stated herein and U.S. Government license rights. - - -(3) You may modify and make a copy or copies of the software for use within -your organization, if you meet the following conditions: - - (a) Copies in source code must include the copyright notice and this - software license agreement. - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy. - - -(4) You may modify a copy or copies of the Software or any portion of it, thus -forming a work based on the Software, and distribute copies of such work -outside your organization, if you meet all of the following conditions: - - (a) Copies in source code must include the copyright notice and this - Software License Agreement; - - (b) Copies in binary form must include the copyright notice and this - Software License Agreement in the documentation and/or other materials - provided with the copy; - - (c) Modified copies and works based on the Software must carry prominent - notices stating that you changed specified portions of the Software. - - (d) Neither the name of Brookhaven Science Associates or Brookhaven - National Laboratory nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - written permission. - - -(5) Portions of the Software resulted from work developed under a U.S. -Government contract and are subject to the following license: -The Government is granted for itself and others acting on its behalf a -paid-up, nonexclusive, irrevocable worldwide license in this computer software -to reproduce, prepare derivative works, and perform publicly and display -publicly. - - -(6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT -WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY -LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND -THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING -BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL -LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF -THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE -PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION -UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. - - -(7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR -THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF -ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, -CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING -BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, -WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING -NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS -BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. - - -Brookhaven National Laboratory Notice -===================================== - -Acknowledgment of sponsorship ------------------------------ - -This software was produced by the Brookhaven National Laboratory, under -Contract DE-AC02-98CH10886 with the Department of Energy. - - -Government disclaimer of liability ----------------------------------- - -Neither the United States nor the United States Department of Energy, nor -any of their employees, makes any warranty, express or implied, or assumes -any legal liability or responsibility for the accuracy, completeness, or -usefulness of any data, apparatus, product, or process disclosed, or -represents that its use would not infringe privately owned rights. - - -Brookhaven disclaimer of liability ----------------------------------- - -Brookhaven National Laboratory makes no representations or warranties, -express or implied, nor assumes any liability for the use of this software. - - -Maintenance of notice ---------------------- - -In the interest of clarity regarding the origin and status of this -software, Brookhaven National Laboratory requests that any recipient of it -maintain this notice affixed to any distribution by the recipient that -contains a copy or derivative of this software. - - -.. rubric:: END OF LICENSE diff --git a/doc/manual/source/release.rst b/doc/manual/source/release.rst deleted file mode 100644 index 7ec4f81d..00000000 --- a/doc/manual/source/release.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. index:: release notes - -.. mdinclude:: ../../../CHANGELOG.md diff --git a/doc/source/_static/.placeholder b/doc/source/_static/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/doc/source/api/diffpy.srreal.example_package.rst b/doc/source/api/diffpy.srreal.example_package.rst new file mode 100644 index 00000000..439a6b4f --- /dev/null +++ b/doc/source/api/diffpy.srreal.example_package.rst @@ -0,0 +1,31 @@ +.. _example_package documentation: + +|title| +======= + +.. |title| replace:: diffpy.srreal.example_package package + +.. automodule:: diffpy.srreal.example_package + :members: + :undoc-members: + :show-inheritance: + +|foo| +----- + +.. |foo| replace:: diffpy.srreal.example_package.foo module + +.. automodule:: diffpy.srreal.example_package.foo + :members: + :undoc-members: + :show-inheritance: + +|bar| +----- + +.. |bar| replace:: diffpy.srreal.example_package.bar module + +.. automodule:: diffpy.srreal.example_package.foo + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.srreal.rst b/doc/source/api/diffpy.srreal.rst new file mode 100644 index 00000000..0f1bb4b7 --- /dev/null +++ b/doc/source/api/diffpy.srreal.rst @@ -0,0 +1,30 @@ +:tocdepth: -1 + +|title| +======= + +.. |title| replace:: diffpy.srreal package + +.. automodule:: diffpy.srreal + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + diffpy.srreal.example_package + +Submodules +---------- + +|module| +-------- + +.. |module| replace:: diffpy.srreal.example_submodule module + +.. automodule:: diffpy.srreal.example_submodule + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/manual/source/conf.py b/doc/source/conf.py similarity index 81% rename from doc/manual/source/conf.py rename to doc/source/conf.py index 326acdd8..f885a7b1 100644 --- a/doc/manual/source/conf.py +++ b/doc/source/conf.py @@ -2,9 +2,10 @@ # -*- coding: utf-8 -*- # # diffpy.srreal documentation build configuration file, created by -# sphinx-quickstart on Tue Oct 22 12:02:48 2013. +# sphinx-quickstart on Thu Jan 30 15:49:41 2014. # -# This file is execfile()d with the current directory set to its containing dir. +# This file is execfile()d with the current directory set to its +# containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. @@ -12,33 +13,36 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import os import sys import time - -from setup import versiondata +from importlib.metadata import version +from pathlib import Path # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# sys.path.insert(0, os.path.abspath('.')) -sys.path.insert(0, os.path.abspath("../../..")) +# documentation root, use Path().resolve() to make it absolute, like shown here. +# sys.path.insert(0, str(Path(".").resolve())) +sys.path.insert(0, str(Path("../..").resolve())) +sys.path.insert(0, str(Path("../../src").resolve())) # abbreviations ab_authors = "Pavol Juhás, Christopher L. Farrow, Simon J.L. Billinge group" -# -- General configuration ----------------------------------------------------- +# -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. extensions = [ "sphinx.ext.autodoc", - "sphinx.ext.coverage", "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", "sphinx.ext.intersphinx", + "sphinx_rtd_theme", "m2r", ] @@ -58,13 +62,13 @@ # General information about the project. project = "diffpy.srreal" -copyright = "%Y, Brookhaven National Laboratory" +copyright = "%Y, The Trustees of Columbia University in the City of New York" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -fullversion = versiondata.get("DEFAULT", "version") +fullversion = version(project) # The short X.Y version. version = "".join(fullversion.split(".post")[:1]) # The full version, including alpha/beta/rc tags. @@ -77,8 +81,7 @@ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' -today_seconds = versiondata.getint("DEFAULT", "timestamp") -today = time.strftime("%B %d, %Y", time.localtime(today_seconds)) +today = time.strftime("%B %d, %Y", time.localtime()) year = today.split()[-1] # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' @@ -87,9 +90,10 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = [] +exclude_patterns = ["build"] -# The reST default role (used for this markup: `text`) to use for all documents. +# The reST default role (used for this markup: `text`) to use for all +# documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. @@ -112,17 +116,18 @@ # Display all warnings for missing links. nitpicky = True -# -- Options for HTML output --------------------------------------------------- +# -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = "sphinx_py3doc_enhanced_theme" +# +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. +# html_theme_options = { - "collapsiblesidebar": "true", "navigation_with_keys": "true", } @@ -150,6 +155,11 @@ # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' @@ -192,10 +202,11 @@ # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = "srrealdoc" +basename = "diffpy.srreal".replace(" ", "").replace(".", "") +htmlhelp_basename = basename + "doc" -# -- Options for LaTeX output -------------------------------------------------- +# -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). @@ -207,9 +218,16 @@ } # Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). latex_documents = [ - ("index", "diffpy.srreal.tex", "diffpy.srreal Documentation", ab_authors, "manual"), + ( + "index", + "diffpy.srreal.tex", + "diffpy.srreal Documentation", + ab_authors, + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of @@ -233,17 +251,25 @@ # latex_domain_indices = True -# -- Options for manual page output -------------------------------------------- +# -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [("index", "diffpy.srreal", "diffpy.srreal Documentation", ab_authors, 1)] +man_pages = [ + ( + "index", + "diffpy.srreal", + "diffpy.srreal Documentation", + ab_authors, + 1, + ) +] # If true, show URL addresses after external links. # man_show_urls = False -# -- Options for Texinfo output ------------------------------------------------ +# -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, @@ -269,9 +295,12 @@ # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - "numpy": ("https://docs.scipy.org/doc/numpy", None), - "python": ("https://docs.python.org/3.7", None), + "numpy": ("https://numpy.org/doc/stable/", None), + "python": ("https://docs.python.org/3", None), } diff --git a/doc/source/examples.rst b/doc/source/examples.rst new file mode 100644 index 00000000..ef8715f5 --- /dev/null +++ b/doc/source/examples.rst @@ -0,0 +1,4 @@ +.. _examples: + +Examples +######## diff --git a/examples/compareC60PDFs.py b/doc/source/examples/compareC60PDFs.py similarity index 100% rename from examples/compareC60PDFs.py rename to doc/source/examples/compareC60PDFs.py diff --git a/examples/compareC60PDFs_objcryst.py b/doc/source/examples/compareC60PDFs_objcryst.py similarity index 100% rename from examples/compareC60PDFs_objcryst.py rename to doc/source/examples/compareC60PDFs_objcryst.py diff --git a/examples/datafiles/C60bucky.stru b/doc/source/examples/datafiles/C60bucky.stru similarity index 100% rename from examples/datafiles/C60bucky.stru rename to doc/source/examples/datafiles/C60bucky.stru diff --git a/examples/datafiles/menthol.cif b/doc/source/examples/datafiles/menthol.cif similarity index 100% rename from examples/datafiles/menthol.cif rename to doc/source/examples/datafiles/menthol.cif diff --git a/examples/datafiles/sphalerite.cif b/doc/source/examples/datafiles/sphalerite.cif similarity index 100% rename from examples/datafiles/sphalerite.cif rename to doc/source/examples/datafiles/sphalerite.cif diff --git a/examples/distanceprinter.py b/doc/source/examples/distanceprinter.py similarity index 100% rename from examples/distanceprinter.py rename to doc/source/examples/distanceprinter.py diff --git a/examples/lennardjones/Makefile b/doc/source/examples/lennardjones/Makefile similarity index 100% rename from examples/lennardjones/Makefile rename to doc/source/examples/lennardjones/Makefile diff --git a/examples/lennardjones/README.txt b/doc/source/examples/lennardjones/README.txt similarity index 100% rename from examples/lennardjones/README.txt rename to doc/source/examples/lennardjones/README.txt diff --git a/examples/lennardjones/lj50.xyz b/doc/source/examples/lennardjones/lj50.xyz similarity index 100% rename from examples/lennardjones/lj50.xyz rename to doc/source/examples/lennardjones/lj50.xyz diff --git a/examples/lennardjones/ljcalculator.cpp b/doc/source/examples/lennardjones/ljcalculator.cpp similarity index 100% rename from examples/lennardjones/ljcalculator.cpp rename to doc/source/examples/lennardjones/ljcalculator.cpp diff --git a/examples/lennardjones/ljcalculator.py b/doc/source/examples/lennardjones/ljcalculator.py similarity index 100% rename from examples/lennardjones/ljcalculator.py rename to doc/source/examples/lennardjones/ljcalculator.py diff --git a/examples/parallelPDF.py b/doc/source/examples/parallelPDF.py similarity index 100% rename from examples/parallelPDF.py rename to doc/source/examples/parallelPDF.py diff --git a/doc/manual/source/index.rst b/doc/source/index.rst similarity index 80% rename from doc/manual/source/index.rst rename to doc/source/index.rst index 4dab5ec8..2c063dfc 100644 --- a/doc/manual/source/index.rst +++ b/doc/source/index.rst @@ -1,8 +1,10 @@ -#################################################### -diffpy.srreal documentation -#################################################### +####### +|title| +####### -diffpy.srreal - calculators for PDF, bond valence sum and other pair quantities. +.. |title| replace:: diffpy.srreal documentation + +diffpy.srreal - Calculators for PDF, bond valence sum, and other quantities based on atom pair interaction. | Software version |release|. | Last updated |today|. @@ -37,9 +39,9 @@ calculate PDF with a user-defined profile function. A new calculator class can be also defined for any quantity that is obtained by iteration over atom pairs, by defining only the function that processes atom-pair contributions. -======================================== +======= Authors -======================================== +======= diffpy.srreal is developed by members of the Billinge Group at Columbia University and at Brookhaven National Laboratory including @@ -48,28 +50,36 @@ Pavol Juhás, Christopher L. Farrow, Simon J.L. Billinge. For a detailed list of contributors see https://github.com/diffpy/diffpy.srreal/graphs/contributors. -====================================== +Reference +========= + +If you use this program for a scientific research that leads +to publication, we ask that you acknowledge use of the program +by citing the following paper in your publication: + + diffpy.srreal Package, https://github.com/diffpy/diffpy.srreal + +============ Installation -====================================== +============ -See the `README `_ +See the `README `_ file included with the distribution. -====================================== +================= Table of contents -====================================== - +================= .. toctree:: :titlesonly: license release + examples Package API -====================================== +======= Indices -====================================== +======= * :ref:`genindex` -* :ref:`modindex` * :ref:`search` diff --git a/doc/source/license.rst b/doc/source/license.rst new file mode 100644 index 00000000..dfdea740 --- /dev/null +++ b/doc/source/license.rst @@ -0,0 +1,149 @@ +:tocdepth: -1 + +.. index:: license + +License +####### + +OPEN SOURCE LICENSE AGREEMENT +============================= + +Copyright (c) 2009-2011, University of Tennessee + +Copyright (c) 1989, 1991 Free Software Foundation, Inc. + +Copyright (c) 2006, The Regents of the University of California through Lawrence Berkeley National Laboratory + +Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") + +Copyright (c) 2006-2007, Board of Trustees of Michigan State University + +Copyright (c) 2008-2012, The Trustees of Columbia University in the City of New York + +Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory + +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +All rights reserved. + +The "DiffPy-CMI" is distributed subject to the following license conditions: + +.. code-block:: text + + SOFTWARE LICENSE AGREEMENT + + Software: DiffPy-CMI + + + (1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either + source code, or binary form and accompanying documentation). + + Part of the software was derived from the DANSE, ObjCryst++ (with permission), + PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of + which the original Copyrights are contained in each individual file. + + Each licensee is addressed as "you" or "Licensee." + + + (2) The copyright holders shown above and their third-party Licensors hereby + grant licensee a royalty-free nonexclusive license, subject to the limitations + stated herein and U.S. Government license rights. + + + (3) You may modify and make a copy or copies of the software for use within + your organization, if you meet the following conditions: + + (a) Copies in source code must include the copyright notice and this + software license agreement. + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy. + + + (4) You may modify a copy or copies of the Software or any portion of it, thus + forming a work based on the Software, and distribute copies of such work + outside your organization, if you meet all of the following conditions: + + (a) Copies in source code must include the copyright notice and this + Software License Agreement; + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy; + + (c) Modified copies and works based on the Software must carry prominent + notices stating that you changed specified portions of the Software. + + (d) Neither the name of Brookhaven Science Associates or Brookhaven + National Laboratory nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + written permission. + + + (5) Portions of the Software resulted from work developed under a U.S. + Government contract and are subject to the following license: + The Government is granted for itself and others acting on its behalf a + paid-up, nonexclusive, irrevocable worldwide license in this computer software + to reproduce, prepare derivative works, and perform publicly and display + publicly. + + + (6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT + WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY + LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND + THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL + LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF + THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE + PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION + UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. + + + (7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR + THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF + ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, + CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING + BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, + WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING + NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS + BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. + + +Brookhaven National Laboratory Notice +===================================== + +Acknowledgment of sponsorship +----------------------------- + +This software was produced by the Brookhaven National Laboratory, under +Contract DE-AC02-98CH10886 with the Department of Energy. + + +Government disclaimer of liability +---------------------------------- + +Neither the United States nor the United States Department of Energy, nor +any of their employees, makes any warranty, express or implied, or assumes +any legal liability or responsibility for the accuracy, completeness, or +usefulness of any data, apparatus, product, or process disclosed, or +represents that its use would not infringe privately owned rights. + + +Brookhaven disclaimer of liability +---------------------------------- + +Brookhaven National Laboratory makes no representations or warranties, +express or implied, nor assumes any liability for the use of this software. + + +Maintenance of notice +--------------------- + +In the interest of clarity regarding the origin and status of this +software, Brookhaven National Laboratory requests that any recipient of it +maintain this notice affixed to any distribution by the recipient that +contains a copy or derivative of this software. + + +END OF LICENSE diff --git a/doc/source/release.rst b/doc/source/release.rst new file mode 100644 index 00000000..27cd0cc9 --- /dev/null +++ b/doc/source/release.rst @@ -0,0 +1,5 @@ +:tocdepth: -1 + +.. index:: release notes + +.. include:: ../../CHANGELOG.rst diff --git a/environment.yml b/environment.yml index a3904941..680bfd94 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: diffpy.pdfgui +name: diffpy.srreal channels: - conda-forge dependencies: diff --git a/news/TEMPLATE.rst b/news/TEMPLATE.rst new file mode 100644 index 00000000..790d30b1 --- /dev/null +++ b/news/TEMPLATE.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 79c72f03..26eafc62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,8 +11,8 @@ authors = [ maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] -description = "calculators for PDF, bond valence sum, and other quantities based on atom pair interaction" -keywords = ['PDF BVS atom overlap calculator real-space'] +description = "Calculators for PDF, bond valence sum, and other quantities based on atom pair interaction." +keywords = ['PDF', 'BVS', 'atom', 'overlap', 'calculator', 'real-space'] readme = "README.rst" requires-python = ">=3.11, <3.14" classifiers = [ diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index e8b7ec78..67de5256 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -1,26 +1,22 @@ #!/usr/bin/env python ############################################################################## # -# diffpy by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2008 The Trustees of Columbia University -# in the City of New York. All rights reserved. +# (c) 2025 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.srreal/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## -"""diffpy - tools for structure analysis by diffraction. - -Blank namespace package. -""" +"""Blank namespace package for module diffpy.""" from pkgutil import extend_path __path__ = extend_path(__path__, __name__) - # End of file diff --git a/src/diffpy/srreal/__init__.py b/src/diffpy/srreal/__init__.py index 7c62d5f3..2beff97f 100644 --- a/src/diffpy/srreal/__init__.py +++ b/src/diffpy/srreal/__init__.py @@ -1,21 +1,21 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.srreal by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2008 The Trustees of Columbia University -# in the City of New York. All rights reserved. +# (c) 2025 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.srreal/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## """Tools for real space structure analysis.""" # package version -from diffpy.srreal._version_data import __version__ +from diffpy.srreal.version import __version__ # silence the pyflakes syntax checker assert __version__ or True diff --git a/src/diffpy/srreal/_version_data.py b/src/diffpy/srreal/_version_data.py deleted file mode 100644 index b3828e8d..00000000 --- a/src/diffpy/srreal/_version_data.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.srreal by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2008 The Trustees of Columbia University -# in the City of New York. All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. -# -############################################################################## -"""Extraction of version data for diffpy.srreal package. - -Does not import any extension module unlike the `version` module. -""" - -__all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] - -import os.path - -from pkg_resources import resource_filename - -# obtain version information from the version.cfg file -cp = dict(version="", date="", commit="", timestamp="0") -fcfg = resource_filename(__name__, "version.cfg") -if not os.path.isfile(fcfg): # pragma: no cover - from warnings import warn - - warn('Package metadata not found, execute "./setup.py egg_info".') - fcfg = os.devnull -with open(fcfg) as fp: - kwords = [[w.strip() for w in line.split(" = ", 1)] for line in fp if line[:1].isalpha() and " = " in line] -assert all(w[0] in cp for w in kwords), "received unrecognized keyword" -cp.update(kwords) - -__version__ = cp["version"] -__date__ = cp["date"] -__git_commit__ = cp["commit"] -__timestamp__ = int(cp["timestamp"]) - -# TODO remove deprecated __gitsha__ in version 1.4. -__gitsha__ = __git_commit__ - -del cp, fcfg, fp, kwords - -# End of file diff --git a/devutils/tunePeakPrecision.py b/src/diffpy/srreal/devutils/tunePeakPrecision.py similarity index 100% rename from devutils/tunePeakPrecision.py rename to src/diffpy/srreal/devutils/tunePeakPrecision.py diff --git a/src/diffpy/srreal/version.py b/src/diffpy/srreal/version.py index 67596f6b..54d1c6b3 100644 --- a/src/diffpy/srreal/version.py +++ b/src/diffpy/srreal/version.py @@ -1,61 +1,25 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.srreal by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2008 The Trustees of Columbia University -# in the City of New York. All rights reserved. +# (c) 2025 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.srreal/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## -"""Definitions of version-related constants and of libdiffpy_version_info. - -Notes ------ -Variable `__gitsha__` is deprecated as of version 1.3. -Use `__git_commit__` instead. - -Variable `libdiffpy_version_info.git_sha` is deprecated as of version 1.4.0. -Use `libdiffpy_version_info.git_commit` instead. -""" - -__all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__", "libdiffpy_version_info"] - - -from diffpy.srreal._version_data import __date__, __git_commit__, __timestamp__, __version__ - -# TODO remove deprecated __gitsha__ in version 1.4. -__gitsha__ = __git_commit__ - -# version information on the active libdiffpy shared library ----------------- +"""Definition of __version__.""" -from collections import namedtuple +# We do not use the other three variables, but can be added back if needed. +# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] -from diffpy.srreal.srreal_ext import _get_libdiffpy_version_info_dict +# obtain version information +from importlib.metadata import version -libdiffpy_version_info = namedtuple( - "libdiffpy_version_info", - "major minor micro patch version_number version date git_commit " + - # TODO remove git_sha in version 1.4. - "git_sha", -) -vd = _get_libdiffpy_version_info_dict() -libdiffpy_version_info = libdiffpy_version_info( - version=vd["version_str"], - version_number=vd["version"], - major=vd["major"], - minor=vd["minor"], - micro=vd["micro"], - patch=vd["patch"], - date=vd["date"], - git_commit=vd["git_commit"], - # TODO remove git_sha in version 1.4. - git_sha=vd["git_commit"], -) -del vd +__version__ = version("diffpy.srreal") # End of file