From f89dcc087540157ac5847e50795e76bc7f3a3b6e Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Sun, 22 Sep 2024 15:51:20 -0400 Subject: [PATCH 01/28] Remove -e build --- .github/workflows/codecov.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/matrix.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 66a8baa5..b2b039f2 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -40,7 +40,7 @@ jobs: conda install --file requirements/test.txt conda install --file requirements/build.txt python -m pip install -r requirements/pip.txt - python -m pip install -e . --no-deps + python -m pip install . --no-deps - name: Validate diffpy.pdffit2 run: | diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a6f0e236..89ff2948 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -36,7 +36,7 @@ jobs: conda install --file requirements/run.txt conda install --file requirements/docs.txt python -m pip install -r requirements/pip.txt - python -m pip install -e . --no-deps + python -m pip install . --no-deps - name: build documents run: make -C doc html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6b42f847..30f4e0a4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: conda install --file requirements/test.txt conda install --file requirements/build.txt python -m pip install -r requirements/pip.txt - python -m pip install -e . --no-deps + python -m pip install . --no-deps - name: Validate diffpy.pdffit2 run: python -m pytest diff --git a/.github/workflows/matrix.yml b/.github/workflows/matrix.yml index a4f39eca..3c8c0f0d 100644 --- a/.github/workflows/matrix.yml +++ b/.github/workflows/matrix.yml @@ -42,7 +42,7 @@ jobs: conda install --file requirements/test.txt conda install --file requirements/build.txt python -m pip install -r requirements/pip.txt - python -m pip install -e . --no-deps + python -m pip install . --no-deps - name: Validate diffpy.pdffit2 run: python -m pytest From 44922208411c45503ef48b4fe5e0b7b5a4cada8a Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:24:47 -0400 Subject: [PATCH 02/28] Add github workflows --- .github/workflows/check-news-item.yml | 12 +++++ .github/workflows/codecov.yml | 54 ------------------- .github/workflows/docs.yml | 48 ----------------- .github/workflows/main.yml | 43 --------------- .../matrix-and-codecov-on-merge-to-main.yml | 21 ++++++++ .github/workflows/matrix.yml | 48 ----------------- .github/workflows/publish-docs-on-release.yml | 14 +++++ .github/workflows/tests-on-pr.yml | 16 ++++++ 8 files changed, 63 insertions(+), 193 deletions(-) create mode 100644 .github/workflows/check-news-item.yml delete mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/matrix-and-codecov-on-merge-to-main.yml delete mode 100644 .github/workflows/matrix.yml create mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 .github/workflows/tests-on-pr.yml diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml new file mode 100644 index 00000000..1301ca85 --- /dev/null +++ b/.github/workflows/check-news-item.yml @@ -0,0 +1,12 @@ +name: Check for News + +on: + pull_request_target: + branches: + - main + +jobs: + build: + uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 + with: + project: diffpy.structure diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index b2b039f2..00000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Gather coverage report and upload to codecov - -on: - push: - branches: - - main - release: - types: - - prereleased - - published - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - coverage: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.pdffit2 - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.pdffit2 and requirements - run: | - conda install --file requirements/run.txt - conda install --file requirements/test.txt - conda install --file requirements/build.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: Validate diffpy.pdffit2 - run: | - coverage run -m pytest -vv -s - coverage report -m - codecov - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 89ff2948..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Build and Deploy Documentation - -on: - release: - types: - - published - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.pdffit2 - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: build - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.pdffit2 and build requirements - run: | - conda install --file requirements/build.txt - conda install --file requirements/run.txt - conda install --file requirements/docs.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: build documents - run: make -C doc html - - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./doc/build/html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 30f4e0a4..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Test - -on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.pdffit2 - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.pdffit2 and requirements - run: | - conda install --file requirements/run.txt - conda install --file requirements/test.txt - conda install --file requirements/build.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: Validate diffpy.pdffit2 - run: python -m pytest 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..c1905e0d --- /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: null + +jobs: + coverage: + uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 + with: + project: diffpy.structure + c_extension: false + headless: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/matrix.yml b/.github/workflows/matrix.yml deleted file mode 100644 index 3c8c0f0d..00000000 --- a/.github/workflows/matrix.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Matrix test - -on: - push: - branches: - - main - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - test: - name: Python ${{ matrix.python-version }}, OS ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: ['3.10', '3.11', '3.12'] - os: ["macos-latest", "ubuntu-latest", "windows-latest"] - steps: - - name: check out diffpy.pdffit2 - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test - auto-update-conda: true - environment-file: environment.yml - python-version: ${{ matrix.python-version }} - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.pdffit2 and requirements - run: | - conda install --file requirements/run.txt - conda install --file requirements/test.txt - conda install --file requirements/build.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: Validate diffpy.pdffit2 - run: python -m pytest diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml new file mode 100644 index 00000000..ea18f1f0 --- /dev/null +++ b/.github/workflows/publish-docs-on-release.yml @@ -0,0 +1,14 @@ +name: Build and Deploy Docs + +on: + release: + types: + - published + workflow_dispatch: + +jobs: + docs: + uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: diffpy.pdffit2 + c_extension: true diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml new file mode 100644 index 00000000..31ad817a --- /dev/null +++ b/.github/workflows/tests-on-pr.yml @@ -0,0 +1,16 @@ +name: Tests on PR + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + validate: + uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 + with: + project: diffpy.pdffit2 + c_extension: true + headless: false From 12d0c5aa565b2ab2835bc84151febf3bae28e968 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:26:22 -0400 Subject: [PATCH 03/28] Add .codecov, coverage, gitignore, remove gitattributes --- .codecov.yml | 3 -- .coveragerc | 17 ++------- .gitattributes | 1 + .gitignore | 94 ++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 75 insertions(+), 40 deletions(-) create mode 100644 .gitattributes diff --git a/.codecov.yml b/.codecov.yml index 505809d2..04dd6510 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -2,9 +2,6 @@ # the root folder. #comment: false -fixes: - - ".*/site-packages/::src/" - codecov: notify: require_ci_to_pass: no diff --git a/.coveragerc b/.coveragerc index 13b71cd9..34ea3e4c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,9 +1,6 @@ [run] source = - diffpy.pdffit2 -omit = - # exclude debug.py from codecov report - */tests/debug.py + diffpy.structure [report] omit = */python?.?/* @@ -11,16 +8,6 @@ omit = # ignore _version.py and versioneer.py .*version.* *_version.py -# 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() +exclude_lines = if __name__ == '__main__': diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..de811ba3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +diffpy.structure/_version.py export-subst diff --git a/.gitignore b/.gitignore index 3298c515..a25212ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,49 +1,99 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ *.py[cod] +*$py.class # C extensions *.so -# Packages -*.egg -*.egg-info -*.eggs -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 -# IDE configs -.idea -.vscode +# 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 -/libpdffit2/tests/alltests +coverage.xml +*,cover +.hypothesis/ # Translations *.mo +*.pot # Mr Developer .mr.developer.cfg .project .pydevproject +# Django stuff: +*.log + +# Sphinx documentation +docs/build/ +docs/source/generated/ + +# pytest +.pytest_cache/ + +# PyBuilder +target/ + +# Editor files +# mac +.DS_Store +*~ + +# vim +*.swp +*.swo + +# pycharm +.idea/ + +# VSCode +.vscode/ + +# Ipython Notebook +.ipynb_checkpoints + # version information setup.cfg -/diffpy/pdffit2/version.cfg +/src/diffpy/*/version.cfg + +# Rever +rever/ From 031809bb15facc74109a4c06340752b6c9c30202 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:26:29 -0400 Subject: [PATCH 04/28] Add news --- news/recut.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/recut.rst diff --git a/news/recut.rst b/news/recut.rst new file mode 100644 index 00000000..e006ae7b --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Re-cookiecutter to group's package standard + +**Security:** + +* From f8827b81868e53b1551add405d288222e5445839 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:26:39 -0400 Subject: [PATCH 05/28] Add version test --- tests/test_version.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/test_version.py diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 00000000..e3ac3668 --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,10 @@ +"""Unit tests for __version__.py +""" + +import diffpy.pdffit2 + + +def test_package_version(): + """Ensure the package version is defined and not set to the initial placeholder.""" + assert hasattr(diffpy.pdffit2, "__version__") + assert diffpy.pdffit2.__version__ != "0.0.0" From f644142ab902d77c74ec1ae335573d143d0256cd Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:26:55 -0400 Subject: [PATCH 06/28] Add pytest-cov test --- requirements/test.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements/test.txt b/requirements/test.txt index 6f9ccf84..a7277865 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,4 +2,5 @@ flake8 pytest codecov coverage +pytest-cov pytest-env From 90658de86205e25791693d325dbd4925547d09a5 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:27:25 -0400 Subject: [PATCH 07/28] Add readme, doc, project.toml --- .pre-commit-config.yaml | 45 ------------- Makefile | 106 ------------------------------ README.rst | 18 +++-- doc/make.bat | 72 ++++++++++---------- doc/source/api/diffpy.pdffit2.rst | 1 + doc/source/index.rst | 6 +- doc/source/license.rst | 53 ++++++++++++++- environment.yml | 3 +- pyproject.toml | 2 +- 9 files changed, 102 insertions(+), 204 deletions(-) delete mode 100644 .pre-commit-config.yaml delete mode 100644 Makefile diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 8aedd156..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,45 +0,0 @@ -default_language_version: - python: python3 -ci: - autofix_commit_msg: | - [pre-commit.ci] auto fixes from pre-commit hooks - autofix_prs: true - autoupdate_branch: 'pre-commit-autoupdate' - autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' - autoupdate_schedule: monthly - skip: [no-commit-to-branch] - submodules: false -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 - hooks: - - id: check-yaml - exclude: ^conda-recipe/meta\.yaml$ - - id: end-of-file-fixer - - id: trailing-whitespace - exclude: '\.(rst|txt)$' - - repo: https://github.com/psf/black - rev: 24.4.2 - hooks: - - id: black - - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 - hooks: - - id: flake8 - - repo: https://github.com/pycqa/isort - rev: 5.13.2 - hooks: - - id: isort - args: ["--profile", "black", "--order-by-type"] - exclude: ^src/diffpy/pdffit2/__init__\.py$ - - repo: https://github.com/kynan/nbstripout - rev: 0.7.1 - hooks: - - id: nbstripout - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: no-commit-to-branch - name: Prevent Commit to Main Branch - args: ["--branch", "main"] - stages: [pre-commit] diff --git a/Makefile b/Makefile deleted file mode 100644 index dffbb2ca..00000000 --- a/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -######################################################################## -# This Makefile should be used only for debugging purposes and is -# intended for strong-hearted developers. End users should use the -# setup.py script instead. -# -# Variables: -# -# DEBUG when defined, compile with debug options -# USESHARED when defined, link with shared gsl library -# PYTHON_INCLUDE path to Python include files used for compilation -# -######################################################################## - -ifndef PYTHON_INCLUDE -PYTHON_INCLUDE := $(shell python -c \ - 'from distutils import sysconfig; print(sysconfig.get_python_inc())') -endif - -######################################################################## - -INCLUDE = \ - -I$(PYTHON_INCLUDE) \ - -Ilibpdffit2 \ - -Ipdffit2module \ - -Ibuild -I. \ - $(GSL_INCLUDE) - -GSL_INCLUDE = $(shell gsl-config --cflags) - -GSL_LIBS_CONFIG = $(shell gsl-config --libs-without-cblas) -ifdef USESHARED -GSL_LIBS = $(GSL_LIBS_CONFIG) -else -GSL_LIBS = $(subst -L,,$(filter -L%, $(GSL_LIBS_CONFIG)))/libgsl.a -endif - -ifneq (,$(findstring darwin,$(OSTYPE))) -LDFLAGS = -bundle -undefined dynamic_lookup -else -LDFLAGS = -shared -endif - -COMMONFLAGS = -std=c++11 -Wall -Wno-write-strings -fPIC -OPTIMFLAGS = -O3 -funroll-loops -ffast-math $(COMMONFLAGS) -DEBUGFLAGS = -g $(COMMONFLAGS) - -ifdef DEBUG -CPPFLAGS = $(DEBUGFLAGS) $(INCLUDE) $(DEFINES) -else -CPPFLAGS = $(OPTIMFLAGS) $(INCLUDE) $(DEFINES) -endif - -PYTHON_XY := $(shell python -c 'import sys; print(sys.version[:3])') -BDIR := build/$(PYTHON_XY) - -.PHONY: all module clean test - -all: module - -module: $(BDIR)/pdffit2module.so - @test $< -ef diffpy/pdffit2/pdffit2.so || \ - ln -vf $< diffpy/pdffit2/pdffit2.so - -clean: - rm -rf -- build/$(PYTHON_XY) diffpy/pdffit2/pdffit2.so - -test: module - python -m diffpy.pdffit2.tests.run - -OBJS = \ - $(BDIR)/bindings.o \ - $(BDIR)/misc.o \ - $(BDIR)/pdffit2module.o \ - $(BDIR)/pyexceptions.o \ - $(BDIR)/Atom.o \ - $(BDIR)/LocalPeriodicTable.o \ - $(BDIR)/OutputStreams.o \ - $(BDIR)/PeriodicTable.o \ - $(BDIR)/PointsInSphere.o \ - $(BDIR)/StringUtils.o \ - $(BDIR)/fit.o \ - $(BDIR)/gaussj.o \ - $(BDIR)/metric.o \ - $(BDIR)/nrutil.o \ - $(BDIR)/output.o \ - $(BDIR)/parser.o \ - $(BDIR)/pdf.o \ - $(BDIR)/pdffit.o \ - $(BDIR)/pdflsmin.o \ - $(BDIR)/scatlen.o \ - $(BDIR)/stru.o \ - - -$(BDIR): - mkdir -p $@ - -$(BDIR)/pdffit2module.so: $(BDIR) $(OBJS) - $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(GSL_LIBS) - -$(BDIR)/%.o : libpdffit2/%.cc - $(CXX) -c $(CPPFLAGS) -o $@ $< - -$(BDIR)/%.o : pdffit2module/%.cc - $(CXX) -c $(CPPFLAGS) -o $@ $< - -# End of file diff --git a/README.rst b/README.rst index 702131a4..f6bb4499 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.pdffit2/actions/workflows/main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.pdffit2/actions/workflows/main.yml +.. |CI| image:: https://github.com/diffpy/diffpy.pdffit2/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.pdffit2/actions/workflows/matrix-and-codecov-on-merge-to-main.yml .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.pdffit2/branch/main/graph/badge.svg :target: https://codecov.io/gh/diffpy/diffpy.pdffit2 @@ -35,7 +35,7 @@ .. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue :target: https://github.com/diffpy/diffpy.pdffit2/issues -Real space structure refinement to atomic pair distribution function. +PDFfit2 - space structure refinement to atomic pair distribution function The diffpy.pdffit2 package provides functions for calculation and refinement of atomic Pair Distribution Function (PDF) from crystal @@ -58,6 +58,8 @@ To learn more about diffpy.pdffit2 library, see the examples directory included in this distribution or the API documentation at http://www.diffpy.org/doc/pdffit2. +For more information about the diffpy.pdffit2 library, please consult our `online documentation `_. + Citation -------- @@ -102,11 +104,7 @@ Then, to fully install ``diffpy.pdffit2`` 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.pdffit2_env`` environment, we will also have to install dependencies :: - - pip install -r https://raw.githubusercontent.com/diffpy/diffpy.pdffit2/main/requirements/run.txt - -and then install the package :: +To install using ``pip`` into your ``diffpy.pdffit2_env`` environment, type :: pip install diffpy.pdffit2 @@ -155,9 +153,9 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contributing, please read our `Code of Conduct `_. +Before contribuing, please read our `Code of Conduct `_. Contact ------- -For more information on diffpy.pdffit2 please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. +For more information on diffpy.pdffit2 please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. \ No newline at end of file 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/api/diffpy.pdffit2.rst b/doc/source/api/diffpy.pdffit2.rst index 759fb63c..a9b0ad5a 100644 --- a/doc/source/api/diffpy.pdffit2.rst +++ b/doc/source/api/diffpy.pdffit2.rst @@ -34,3 +34,4 @@ diffpy.pdffit2.ipy_ext module :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/index.rst b/doc/source/index.rst index 3ff032fe..7ae9b3aa 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -50,14 +50,14 @@ https://github.com/diffpy/diffpy.pdffit2/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 +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: C. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and PDFgui: computer programs for studying nanostructure in crystals (https://stacks.iop.org/0953-8984/19/335219), *J. Phys.: Condens. Matter*, 19, 335219 (2007) - + ============ Installation ============ diff --git a/doc/source/license.rst b/doc/source/license.rst index 421a9ed7..a5af2d41 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -2,4 +2,55 @@ .. index:: license -.. include:: ../../LICENSE.rst +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. + +If you use this program to do productive scientific research that leads +to publication, we ask that you acknowledge use of the program by citing +the following paper in your publication: + + C\. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen + and S. J. L. Billinge, PDFfit2 and PDFgui: computer programs for studying nanostructure + in crystals (https://stacks.iop.org/0953-8984/19/335219), *J. Phys.: Condens. Matter*, 19, 335219 (2007) + +Copyright 2006-2007, Board of Trustees of Michigan State University, +Copyright 2008-2024, Board of Trustees of Columbia University in the +city of New York. (Copyright holder indicated in each source file). + +For more information please visit the project web-page: + 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 + notice, this list of conditions and the following disclaimer. + + * 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 + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS". COPYRIGHT HOLDER +EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EITHER +EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS, ADEQUACY OR SUITABILITY +FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES OF FREEDOM FROM +INFRINGEMENT OF ANY DOMESTIC OR FOREIGN PATENT, COPYRIGHTS, TRADE +SECRETS OR OTHER PROPRIETARY RIGHTS OF ANY PARTY. IN NO EVENT SHALL +COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE OR RELATING TO THIS AGREEMENT, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/environment.yml b/environment.yml index 5fb2f044..3979d3cb 100644 --- a/environment.yml +++ b/environment.yml @@ -2,6 +2,5 @@ name: diffpy.pdffit2 channels: - conda-forge dependencies: - - python>=3.10 + - python=3 - pip - - conda diff --git a/pyproject.toml b/pyproject.toml index 0ee80217..56742459 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ 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.pdffit2.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] From 3987b18f6f00cac584c7575861ee8523337661cb Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:29:20 -0400 Subject: [PATCH 08/28] meta.yml to meta.txt --- conda-recipe/{meta.yaml => meta.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename conda-recipe/{meta.yaml => meta.txt} (100%) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.txt similarity index 100% rename from conda-recipe/meta.yaml rename to conda-recipe/meta.txt From 05b15ce20c6b8fd6438222965afa1e00ab36f1d5 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:30:06 -0400 Subject: [PATCH 09/28] Apply precomit --- .pre-commit-config.yaml | 43 +++++++++++++++++++++++++++++++ README.rst | 2 +- doc/source/api/diffpy.pdffit2.rst | 1 - src/diffpy/pdffit2/__init__.py | 2 +- 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..c4588061 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,43 @@ +default_language_version: + python: python3 +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit hooks + autofix_prs: true + autoupdate_branch: 'pre-commit-autoupdate' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: monthly + skip: [no-commit-to-branch] + submodules: false +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + exclude: '\.(rst|txt)$' + - repo: https://github.com/psf/black + rev: 24.4.2 + hooks: + - id: black + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + args: ["--profile", "black"] + - repo: https://github.com/kynan/nbstripout + rev: 0.7.1 + hooks: + - id: nbstripout + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: no-commit-to-branch + name: Prevent Commit to Main Branch + args: ["--branch", "main"] + stages: [pre-commit] diff --git a/README.rst b/README.rst index f6bb4499..03fa3a05 100644 --- a/README.rst +++ b/README.rst @@ -158,4 +158,4 @@ Before contribuing, please read our `Code of Conduct `_ or email Prof. Simon Billinge at sb2896@columbia.edu. \ No newline at end of file +For more information on diffpy.pdffit2 please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. diff --git a/doc/source/api/diffpy.pdffit2.rst b/doc/source/api/diffpy.pdffit2.rst index a9b0ad5a..759fb63c 100644 --- a/doc/source/api/diffpy.pdffit2.rst +++ b/doc/source/api/diffpy.pdffit2.rst @@ -34,4 +34,3 @@ diffpy.pdffit2.ipy_ext module :members: :undoc-members: :show-inheritance: - diff --git a/src/diffpy/pdffit2/__init__.py b/src/diffpy/pdffit2/__init__.py index fe3fbce3..6a1e2c50 100644 --- a/src/diffpy/pdffit2/__init__.py +++ b/src/diffpy/pdffit2/__init__.py @@ -19,9 +19,9 @@ # package version from diffpy.pdffit2.output import redirect_stdout -from diffpy.pdffit2.version import __version__, __date__ from diffpy.pdffit2.pdffit import PdfFit from diffpy.pdffit2.pdffit2 import is_element +from diffpy.pdffit2.version import __date__, __version__ # silence the pyflakes syntax checker assert __version__ or True From 304f0d6be46c28971626fc394b3aed4464eca2e3 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:46:03 -0400 Subject: [PATCH 10/28] Ensure ordering of import in __init__.py --- .flake8 | 1 + src/diffpy/pdffit2/__init__.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.flake8 b/.flake8 index 2d2cb168..535044c9 100644 --- a/.flake8 +++ b/.flake8 @@ -4,6 +4,7 @@ exclude = __pycache__, build, dist, + __init__.py doc/source/conf.py max-line-length = 115 # Ignore some style 'errors' produced while formatting by 'black' diff --git a/src/diffpy/pdffit2/__init__.py b/src/diffpy/pdffit2/__init__.py index 6a1e2c50..9afc9bc6 100644 --- a/src/diffpy/pdffit2/__init__.py +++ b/src/diffpy/pdffit2/__init__.py @@ -17,15 +17,19 @@ """PDFfit2 - real space structure refinement program.""" -# package version +# Import package version to be used by with C++ extensions from diffpy.pdffit2.output import redirect_stdout -from diffpy.pdffit2.pdffit import PdfFit -from diffpy.pdffit2.pdffit2 import is_element from diffpy.pdffit2.version import __date__, __version__ -# silence the pyflakes syntax checker +# Ensure the version and date variables are initialized assert __version__ or True assert __date__ or True + +# Import C++ related modules after version info is initialized +from diffpy.pdffit2.pdffit import PdfFit +from diffpy.pdffit2.pdffit2 import is_element # Import element check functionality + +# Ensure all necessary components are imported and initialized assert all((PdfFit, redirect_stdout, is_element)) # End of file From 43b31a5c63315d480122a43946a42e64973db106 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 00:46:39 -0400 Subject: [PATCH 11/28] Fix typo --- src/diffpy/pdffit2/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diffpy/pdffit2/__init__.py b/src/diffpy/pdffit2/__init__.py index 9afc9bc6..74631682 100644 --- a/src/diffpy/pdffit2/__init__.py +++ b/src/diffpy/pdffit2/__init__.py @@ -17,7 +17,7 @@ """PDFfit2 - real space structure refinement program.""" -# Import package version to be used by with C++ extensions +# Import package version to be used by C++ extensions from diffpy.pdffit2.output import redirect_stdout from diffpy.pdffit2.version import __date__, __version__ @@ -27,7 +27,7 @@ # Import C++ related modules after version info is initialized from diffpy.pdffit2.pdffit import PdfFit -from diffpy.pdffit2.pdffit2 import is_element # Import element check functionality +from diffpy.pdffit2.pdffit2 import is_element # Ensure all necessary components are imported and initialized assert all((PdfFit, redirect_stdout, is_element)) From 47fd5a7ab3bd11bb551cbe5729753419643aaf67 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 08:41:19 -0400 Subject: [PATCH 12/28] rm mention of diffpy.structure, add c extensions --- .coveragerc | 2 +- .gitattributes | 1 - .github/workflows/check-news-item.yml | 2 +- .github/workflows/matrix-and-codecov-on-merge-to-main.yml | 6 +++--- 4 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 .gitattributes diff --git a/.coveragerc b/.coveragerc index 34ea3e4c..edd0c0ba 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,6 @@ [run] source = - diffpy.structure + diffpy.pdffit2 [report] omit = */python?.?/* diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index de811ba3..00000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -diffpy.structure/_version.py export-subst diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml index 1301ca85..6a842da5 100644 --- a/.github/workflows/check-news-item.yml +++ b/.github/workflows/check-news-item.yml @@ -9,4 +9,4 @@ jobs: build: uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 with: - project: diffpy.structure + project: diffpy.pdffit2 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 c1905e0d..0270fdf4 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -8,14 +8,14 @@ on: types: - prereleased - published - workflow_dispatch: null + workflow_dispatch: jobs: coverage: uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: - project: diffpy.structure - c_extension: false + project: diffpy.pdffit2 + c_extension: true headless: false secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 226fef0922f5754b3596f6046f4cf1d0aeea954e Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 08:41:32 -0400 Subject: [PATCH 13/28] rm rogue dash --- LICENSE.rst | 2 +- doc/source/license.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.rst b/LICENSE.rst index 0a1d4f66..5862f0d6 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -8,7 +8,7 @@ If you use this program to do productive scientific research that leads to publication, we ask that you acknowledge use of the program by citing the following paper in your publication: - C\. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen + C. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and PDFgui: computer programs for studying nanostructure in crystals (https://stacks.iop.org/0953-8984/19/335219), *J. Phys.: Condens. Matter*, 19, 335219 (2007) diff --git a/doc/source/license.rst b/doc/source/license.rst index a5af2d41..38f918c6 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -12,7 +12,7 @@ If you use this program to do productive scientific research that leads to publication, we ask that you acknowledge use of the program by citing the following paper in your publication: - C\. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen + C. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and PDFgui: computer programs for studying nanostructure in crystals (https://stacks.iop.org/0953-8984/19/335219), *J. Phys.: Condens. Matter*, 19, 335219 (2007) From 3016fc5abd88b6728037264badab010785df1ca0 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 08:41:59 -0400 Subject: [PATCH 14/28] Fix contributing typo --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 03fa3a05..a4983c09 100644 --- a/README.rst +++ b/README.rst @@ -35,7 +35,7 @@ .. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue :target: https://github.com/diffpy/diffpy.pdffit2/issues -PDFfit2 - space structure refinement to atomic pair distribution function +PDFfit2 - real space structure refinement to atomic pair distribution function The diffpy.pdffit2 package provides functions for calculation and refinement of atomic Pair Distribution Function (PDF) from crystal @@ -153,7 +153,7 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contribuing, please read our `Code of Conduct `_. +Before contributing, please read our `Code of Conduct `_. Contact ------- From b9530410557c9bc164260105c4a6cd7135e58f3a Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 08:47:37 -0400 Subject: [PATCH 15/28] remove rogue slash in citation --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index a4983c09..dee96bf1 100644 --- a/README.rst +++ b/README.rst @@ -65,7 +65,7 @@ Citation If you use diffpy.pdffit2 in a scientific publication, we would like you to cite the following paper: - C\. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen + C. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and PDFgui: computer programs for studying nanostructure in crystals (https://stacks.iop.org/0953-8984/19/335219), *J. Phys.: Condens. Matter*, 19, 335219 (2007) From 1ba7042e775cbbb24ce851c37ee4525cccc82300 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:05:40 -0400 Subject: [PATCH 16/28] Remove avoid flake8 in __init__ and add clear directions with isort tags --- .flake8 | 1 - src/diffpy/pdffit2/__init__.py | 17 +++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.flake8 b/.flake8 index 535044c9..2d2cb168 100644 --- a/.flake8 +++ b/.flake8 @@ -4,7 +4,6 @@ exclude = __pycache__, build, dist, - __init__.py doc/source/conf.py max-line-length = 115 # Ignore some style 'errors' produced while formatting by 'black' diff --git a/src/diffpy/pdffit2/__init__.py b/src/diffpy/pdffit2/__init__.py index 74631682..61af1f1d 100644 --- a/src/diffpy/pdffit2/__init__.py +++ b/src/diffpy/pdffit2/__init__.py @@ -17,19 +17,24 @@ """PDFfit2 - real space structure refinement program.""" -# Import package version to be used by C++ extensions +# WARNING: Do NOT remove the isort: off/on comments in this file. +# These tags are used to prevent isort from reordering imports in this file. +# __version__ must be initialized before importing C++ extensions. + +# isort: off +# Import the package version before C++ extensions are loaded. from diffpy.pdffit2.output import redirect_stdout from diffpy.pdffit2.version import __date__, __version__ -# Ensure the version and date variables are initialized -assert __version__ or True -assert __date__ or True - -# Import C++ related modules after version info is initialized +# Import C++ related modules since the __version__ attribute is used. from diffpy.pdffit2.pdffit import PdfFit from diffpy.pdffit2.pdffit2 import is_element +# isort: on + # Ensure all necessary components are imported and initialized +assert __version__ or True +assert __date__ or True assert all((PdfFit, redirect_stdout, is_element)) # End of file From 1b091b536692b900168ad512b17388a2703ce120 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:26:40 -0400 Subject: [PATCH 17/28] Add pip source install step in readme --- README.rst | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index dee96bf1..5cb15a49 100644 --- a/README.rst +++ b/README.rst @@ -108,9 +108,23 @@ To install using ``pip`` into your ``diffpy.pdffit2_env`` environment, type :: pip install diffpy.pdffit2 -If you prefer to install from sources, after installing the dependencies, obtain the source archive from -`GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory -and run the following :: +If you prefer to install from sources, obtain the source archive from +`GitHub `_. + +Ensure that you have a C++ compiler and the necessary dependencies installed mentioned above: + +For macOS: :: + + brew install gsl + brew install gcc + +For Ubuntu: :: + + sudo apt-get update + sudo apt-get install libgsl-dev + sudo apt install g++ + +Next, ``cd`` into your ``diffpy.pdffit2`` directory and run the following command: :: pip install . From a225c8b3bdf8daf2471ceb308e1b559046938e76 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:28:46 -0400 Subject: [PATCH 18/28] Fix Ubuntu command for g++ --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5cb15a49..d22e8fe7 100644 --- a/README.rst +++ b/README.rst @@ -122,7 +122,7 @@ For Ubuntu: :: sudo apt-get update sudo apt-get install libgsl-dev - sudo apt install g++ + sudo apt-get install g++ Next, ``cd`` into your ``diffpy.pdffit2`` directory and run the following command: :: From a9aa591f14b4273db97e0cfcfaaf2d0014fc16c6 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:34:20 -0400 Subject: [PATCH 19/28] Add compiler download for pip install --- README.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index d22e8fe7..d52f8f93 100644 --- a/README.rst +++ b/README.rst @@ -104,12 +104,6 @@ Then, to fully install ``diffpy.pdffit2`` 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.pdffit2_env`` environment, type :: - - pip install diffpy.pdffit2 - -If you prefer to install from sources, obtain the source archive from -`GitHub `_. Ensure that you have a C++ compiler and the necessary dependencies installed mentioned above: @@ -124,7 +118,13 @@ For Ubuntu: :: sudo apt-get install libgsl-dev sudo apt-get install g++ -Next, ``cd`` into your ``diffpy.pdffit2`` directory and run the following command: :: +To install using ``pip`` into your ``diffpy.pdffit2_env`` environment, type :: + + pip install diffpy.pdffit2 + +If you prefer to install from sources, after installing the dependencies above, obtain the source archive from +`GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory +and run the following :: pip install . From 9fabfc425434d05f8cb5b87dc84bde84561de2e6 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:36:46 -0400 Subject: [PATCH 20/28] Use conda to download dependencies --- README.rst | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index d52f8f93..8efb289f 100644 --- a/README.rst +++ b/README.rst @@ -107,18 +107,14 @@ Another option is to use ``pip`` to download and install the latest release from Ensure that you have a C++ compiler and the necessary dependencies installed mentioned above: -For macOS: :: - - brew install gsl - brew install gcc - -For Ubuntu: :: +To install using ``pip`` into your ``diffpy.pdffit2_env`` environment, type :: - sudo apt-get update - sudo apt-get install libgsl-dev - sudo apt-get install g++ + conda install \ + --file requirements/test.txt \ + --file requirements/run.txt \ + --file requirements/build.txt -To install using ``pip`` into your ``diffpy.pdffit2_env`` environment, type :: +And then type :: pip install diffpy.pdffit2 From 693414db59e5df29bc24dee70eb45009ff58fd36 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:40:51 -0400 Subject: [PATCH 21/28] add testing for version prompt --- README.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 8efb289f..a046fb81 100644 --- a/README.rst +++ b/README.rst @@ -105,12 +105,9 @@ Then, to fully install ``diffpy.pdffit2`` in our active environment, run :: Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -Ensure that you have a C++ compiler and the necessary dependencies installed mentioned above: - -To install using ``pip`` into your ``diffpy.pdffit2_env`` environment, type :: +To install the C++ compiler and required dependencies in you ``diffpy.pdffit2_env`` environment, type :: conda install \ - --file requirements/test.txt \ --file requirements/run.txt \ --file requirements/build.txt @@ -118,12 +115,16 @@ And then type :: pip install diffpy.pdffit2 -If you prefer to install from sources, after installing the dependencies above, obtain the source archive from +If you prefer to install from sources, after installing the dependencies above in the ``diffpy.pdffit2_env`` , obtain the source archive from `GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory and run the following :: pip install . +To confirm that the installation was successful, run the following in a terminal :: + + python -c "import diffpy.pdffit2; print(diffpy.pdffit2.__version__)" + Support and Contribute ---------------------- From 3ba006eb4ce83f266b3ce066700ccfdcccded367 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:46:51 -0400 Subject: [PATCH 22/28] Fix indention for conda install --- README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index a046fb81..249e0998 100644 --- a/README.rst +++ b/README.rst @@ -107,15 +107,15 @@ Another option is to use ``pip`` to download and install the latest release from To install the C++ compiler and required dependencies in you ``diffpy.pdffit2_env`` environment, type :: - conda install \ - --file requirements/run.txt \ - --file requirements/build.txt + conda install \ + --file requirements/run.txt \ + --file requirements/build.txt And then type :: pip install diffpy.pdffit2 -If you prefer to install from sources, after installing the dependencies above in the ``diffpy.pdffit2_env`` , obtain the source archive from +If you prefer to install from sources, after the dependencies in `run.txt` and `build.txt` above in the ``diffpy.pdffit2_env`` , obtain the source archive from `GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory and run the following :: From dd71f7fbae963be7a96dc5b2b16a9d78dc57eecd Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:47:54 -0400 Subject: [PATCH 23/28] you to your --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 249e0998..a6e19af0 100644 --- a/README.rst +++ b/README.rst @@ -105,7 +105,7 @@ Then, to fully install ``diffpy.pdffit2`` in our active environment, run :: Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -To install the C++ compiler and required dependencies in you ``diffpy.pdffit2_env`` environment, type :: +To install the C++ compiler and required dependencies in your ``diffpy.pdffit2_env`` environment, type :: conda install \ --file requirements/run.txt \ From d0ea0b950a88bf188897b4cb3ae1e5a40edb3132 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:48:27 -0400 Subject: [PATCH 24/28] Add double quote for pre --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index a6e19af0..55cd1336 100644 --- a/README.rst +++ b/README.rst @@ -115,7 +115,7 @@ And then type :: pip install diffpy.pdffit2 -If you prefer to install from sources, after the dependencies in `run.txt` and `build.txt` above in the ``diffpy.pdffit2_env`` , obtain the source archive from +If you prefer to install from sources, after the dependencies in ``run.txt`` and ``build.txt`` above in the ``diffpy.pdffit2_env`` , obtain the source archive from `GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory and run the following :: From 9d5fad518cb51cbc31036016c3287e815e8a9625 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:49:12 -0400 Subject: [PATCH 25/28] Remove the next to env --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 55cd1336..f2c82ac5 100644 --- a/README.rst +++ b/README.rst @@ -115,7 +115,7 @@ And then type :: pip install diffpy.pdffit2 -If you prefer to install from sources, after the dependencies in ``run.txt`` and ``build.txt`` above in the ``diffpy.pdffit2_env`` , obtain the source archive from +If you prefer to install from sources, after the dependencies in ``run.txt`` and ``build.txt`` above in ``diffpy.pdffit2_env`` , obtain the source archive from `GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory and run the following :: From 39be2ba17d91fbc0995a320017ae80109d281d71 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:51:53 -0400 Subject: [PATCH 26/28] Improve instruction for conda install --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f2c82ac5..13c41094 100644 --- a/README.rst +++ b/README.rst @@ -115,7 +115,7 @@ And then type :: pip install diffpy.pdffit2 -If you prefer to install from sources, after the dependencies in ``run.txt`` and ``build.txt`` above in ``diffpy.pdffit2_env`` , obtain the source archive from +If you prefer to install from sources, use the above `conda install \ ..` instruction to install the dependencies in ``run.txt`` and ``build.txt`` in ``diffpy.pdffit2_env`` , obtain the source archive from `GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory and run the following :: From e0407395c29d1a29f237fb9cb8ec36b23cdd35e5 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 09:53:45 -0400 Subject: [PATCH 27/28] Add double quote for pre --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 13c41094..132c0b6f 100644 --- a/README.rst +++ b/README.rst @@ -115,7 +115,7 @@ And then type :: pip install diffpy.pdffit2 -If you prefer to install from sources, use the above `conda install \ ..` instruction to install the dependencies in ``run.txt`` and ``build.txt`` in ``diffpy.pdffit2_env`` , obtain the source archive from +If you prefer to install from sources, use the above ``conda install \ ..`` instruction to install the dependencies in ``run.txt`` and ``build.txt`` in ``diffpy.pdffit2_env`` , obtain the source archive from `GitHub `_. Once installed, ``cd`` into your ``diffpy.pdffit2`` directory and run the following :: From 8eba00877c8860346008d9d62e0b3a849f3849a4 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 24 Sep 2024 13:17:36 -0400 Subject: [PATCH 28/28] Include Billinge's recommended instruction for pip source install --- README.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 132c0b6f..fa90b318 100644 --- a/README.rst +++ b/README.rst @@ -102,8 +102,7 @@ Then, to fully install ``diffpy.pdffit2`` in our active environment, run :: conda install diffpy.pdffit2 -Another option is to use ``pip`` to download and install the latest release from -`Python Package Index `_. +The less preferred approach is the install using ``pip`` to download and install the latest release from `Python Package Index `_. In this case you currently have to build the codes on your computer from the sources and you will have to have a C++ installer available. To install the C++ compiler and required dependencies in your ``diffpy.pdffit2_env`` environment, type ::