From 68cc9a3471c412d4c082313b34069dc67f7a32c1 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 23 Jul 2024 02:40:08 -0400 Subject: [PATCH 01/20] pin numpy to 1.x for now --- requirements/run.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/run.txt b/requirements/run.txt index 10e45f83..70ad6f75 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,4 +1,4 @@ -numpy +numpy=1 wxpython diffpy.pdffit2 diffpy.utils From 6ecbc61b5e70aec41e84fd55ce2a2d89cd874c9a Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 12:37:24 -0400 Subject: [PATCH 02/20] add environment.yml --- environment.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 environment.yml diff --git a/environment.yml b/environment.yml new file mode 100644 index 00000000..a3904941 --- /dev/null +++ b/environment.yml @@ -0,0 +1,6 @@ +name: diffpy.pdfgui +channels: + - conda-forge +dependencies: + - python=3 + - pip From 97dbbceb1722ae95539f44376d644dea67698c9d Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 12:55:26 -0400 Subject: [PATCH 03/20] test tests --- src/diffpy/pdfgui/gui/aboutdialog.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/diffpy/pdfgui/gui/aboutdialog.py b/src/diffpy/pdfgui/gui/aboutdialog.py index 37bd30c7..c71c45b3 100644 --- a/src/diffpy/pdfgui/gui/aboutdialog.py +++ b/src/diffpy/pdfgui/gui/aboutdialog.py @@ -4,6 +4,8 @@ # PDFgui by DANSE Diffraction group # Simon J. L. Billinge # (c) 2006 trustees of the Michigan State University. +# (c) 2024 trustees of the Columbia University in the City +# of New York # All rights reserved. # # File coded by: Dmitriy Bryndin @@ -233,7 +235,7 @@ def onColumbiaLogo(self, event): # wxGlade: DialogAbout. # end of class DialogAbout -##### testing code ########################################################### +# #### testing code ########################################################### if __name__ == "__main__": app = wx.App() From 56df35295b1e5d77fcc103f8b2c9cc50b1145393 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:05:12 -0400 Subject: [PATCH 04/20] trigger --- src/diffpy/pdfgui/gui/adddatapanel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/diffpy/pdfgui/gui/adddatapanel.py b/src/diffpy/pdfgui/gui/adddatapanel.py index 7f5f1407..15cb48ca 100644 --- a/src/diffpy/pdfgui/gui/adddatapanel.py +++ b/src/diffpy/pdfgui/gui/adddatapanel.py @@ -5,6 +5,7 @@ # PDFgui by DANSE Diffraction group # Simon J. L. Billinge # (c) 2006 trustees of the Michigan State University. +# (c) 2024 trustees of the Columbia University in the City # All rights reserved. # # File coded by: Chris Farrow From c40e5823365cf2cf67d2126476bcbef38c65c1ec Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:09:17 -0400 Subject: [PATCH 05/20] try again with requirements --- requirements/run.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/run.txt b/requirements/run.txt index 70ad6f75..4f2da5a6 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,4 +1,4 @@ -numpy=1 +numpy==1 wxpython diffpy.pdffit2 diffpy.utils From 75ca7e7ce8b7b45e857965f38cb5048ceea9e8f3 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:21:51 -0400 Subject: [PATCH 06/20] try again with requirements --- requirements/run.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/run.txt b/requirements/run.txt index 4f2da5a6..40bce3f0 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,4 +1,4 @@ -numpy==1 +numpy==1.26 wxpython diffpy.pdffit2 diffpy.utils From 88e5841d0c05a2a977b6acd2c17bec46d22cb124 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:26:25 -0400 Subject: [PATCH 07/20] now update test reqs --- requirements/test.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements/test.txt b/requirements/test.txt index 7167f602..628a048a 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,2 +1,4 @@ pytest freezegun +coverage +codecov From aa904b5017a9071a155af194862da6b5b8f48674 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:36:10 -0400 Subject: [PATCH 08/20] try and handle xwindow display issue --- .github/workflows/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 80bbfb71..d31f5460 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,10 +45,19 @@ jobs: conda install --file requirements/run.txt conda install --file requirements/test.txt pip install . + + - name: Start Xvfb + run: | + sudo apt-get update + sudo apt-get install -y xvfb + Xvfb :99 -screen 0 1024x768x16 & + export DISPLAY=:99 + - name: Validate diffpy.pdfgui shell: bash -l {0} run: | conda activate test + export DISPLAY=:99 coverage run -m pytest -vv -s coverage report -m codecov From 919f239ccbdc515bed0fbfe19e26bc7937f4ee67 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:41:54 -0400 Subject: [PATCH 09/20] try using xfvb action --- .github/workflows/main.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d31f5460..8bc6619d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,18 +46,13 @@ jobs: conda install --file requirements/test.txt pip install . - - name: Start Xvfb - run: | - sudo apt-get update - sudo apt-get install -y xvfb - Xvfb :99 -screen 0 1024x768x16 & - export DISPLAY=:99 + - name: Use Xvfb Action + uses: GabrielBB/xvfb-action@v1 - name: Validate diffpy.pdfgui shell: bash -l {0} run: | conda activate test - export DISPLAY=:99 coverage run -m pytest -vv -s coverage report -m codecov From 0a21483d0eb3229a24048940a58c7ae27b43dd0c Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:48:51 -0400 Subject: [PATCH 10/20] refactor xvfb action commands --- .github/workflows/main.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8bc6619d..45129141 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,13 +46,11 @@ jobs: conda install --file requirements/test.txt pip install . - - name: Use Xvfb Action + - name: Use Xvfb Action and run tests uses: GabrielBB/xvfb-action@v1 - - - name: Validate diffpy.pdfgui - shell: bash -l {0} - run: | - conda activate test - coverage run -m pytest -vv -s - coverage report -m - codecov + with: + run: | + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov From 74ad04bac051fd3a8841c41615ffc41c64249f44 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:51:17 -0400 Subject: [PATCH 11/20] source activate? --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 45129141..de80be8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,7 +50,7 @@ jobs: uses: GabrielBB/xvfb-action@v1 with: run: | - conda activate test + source activate test coverage run -m pytest -vv -s coverage report -m codecov From 7c1f638298481d2d51a60fb2f7d9fe7fbe2b3f1e Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 13:58:49 -0400 Subject: [PATCH 12/20] different tack, generate error and work on test? --- .github/workflows/main.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index de80be8c..e388a3a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,11 +46,10 @@ jobs: conda install --file requirements/test.txt pip install . - - name: Use Xvfb Action and run tests - uses: GabrielBB/xvfb-action@v1 - with: - run: | - source activate test - coverage run -m pytest -vv -s - coverage report -m - codecov + - name: Validate diffpy.pdfgui + shell: bash -l {0} + run: | + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov From 46e1b48cb6aa1619bff6cf9d10b24e1c77cbbe34 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 14:17:45 -0400 Subject: [PATCH 13/20] again --- .github/workflows/main.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e388a3a7..ce04ab13 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,10 +46,12 @@ jobs: conda install --file requirements/test.txt pip install . - - name: Validate diffpy.pdfgui - shell: bash -l {0} - run: | - conda activate test - coverage run -m pytest -vv -s - coverage report -m - codecov + - name: Use Xvfb Action + uses: GabrielBB/xvfb-action@v1 + with: + shell: bash -l {0} + run: | + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov From d8cce5bd48106b9eced8a60f0fa4934dd0383bb5 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 14:21:15 -0400 Subject: [PATCH 14/20] again --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce04ab13..d65f49e7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,6 +51,7 @@ jobs: with: shell: bash -l {0} run: | + conda init conda activate test coverage run -m pytest -vv -s coverage report -m From c2d91a4bb591d4e5b33109374c22f9eb81677ae3 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 14:29:51 -0400 Subject: [PATCH 15/20] chatgpt method --- .github/workflows/main.yml | 46 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d65f49e7..92728a16 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,36 +23,30 @@ jobs: path: . fetch-depth: 0 # avoid shallow clone with no tags - - name: initialize miniconda - # this uses a marketplace action that sets up miniconda in a way that makes - # it easier to use. I tried setting it up without this and it was a pain - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test - # environment.yml file is needed by this action. Because I don't want - # maintain this but rather maintain the requirements files it just has - # basic things in it like conda and pip - environment-file: ./environment.yml - python-version: 3 - auto-activate-base: false + - name: Install Mamba + run: | + wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh" -O mambaforge.sh + bash mambaforge.sh -b -p $HOME/mambaforge + echo "$HOME/mambaforge/bin" >> $GITHUB_PATH + source $HOME/mambaforge/etc/profile.d/conda.sh + conda init bash + + - name: Create conda environment + run: | + source $HOME/mambaforge/etc/profile.d/conda.sh + conda create -n test_env python=3.12 xonsh regolith -c conda-forge -y + conda activate test_env + pip install case_insensitive_dict - - name: install diffpy.pdfgui requirements - shell: bash -l {0} + - name: Install dependencies run: | - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda activate test - conda install --file requirements/run.txt - conda install --file requirements/test.txt - pip install . + source $HOME/mambaforge/etc/profile.d/conda.sh + conda activate test_env + mamba install --file requirements/run.txt + mamba install --file requirements/test.txt - name: Use Xvfb Action uses: GabrielBB/xvfb-action@v1 with: - shell: bash -l {0} run: | - conda init - conda activate test - coverage run -m pytest -vv -s - coverage report -m - codecov + bash -c "source $HOME/mambaforge/etc/profile.d/conda.sh && conda activate test_env && pytest --maxfail=5 --disable-warnings -v" From 7eb33a743c57d31144a2bff6a4e5f29b5fd8d95e Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Thu, 25 Jul 2024 14:38:47 -0400 Subject: [PATCH 16/20] supress running qc of meta.yaml in conda-forge by renaming --- conda-recipe/{run_test.py => dont_run.py} | 0 conda-recipe/{meta.yaml => meta.suppress_yaml} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename conda-recipe/{run_test.py => dont_run.py} (100%) rename conda-recipe/{meta.yaml => meta.suppress_yaml} (96%) diff --git a/conda-recipe/run_test.py b/conda-recipe/dont_run.py similarity index 100% rename from conda-recipe/run_test.py rename to conda-recipe/dont_run.py diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.suppress_yaml similarity index 96% rename from conda-recipe/meta.yaml rename to conda-recipe/meta.suppress_yaml index 2eeff68a..568d0c7d 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.suppress_yaml @@ -54,7 +54,7 @@ test: # entry points work. - # You can also put a file called run_test.py in the recipe that will be run + # You can also put a file called dont_run.py in the recipe that will be run # at test time. # requires: From 5e910ae51eadc424cd711fa945018ade756d1da7 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Fri, 26 Jul 2024 01:00:39 -0400 Subject: [PATCH 17/20] try new pyproject.toml --- pyproject.toml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e537e24a..82b28096 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,59 @@ +[build-system] +requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] +build-backend = "setuptools.build_meta" + +[project] +name = "diffpy.pdfgui" +dynamic=['version'] +authors = [ + { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, +] +maintainers = [ + { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, +] +description = "Tools" +keywords = ['diffpy', 'pdf', 'pair distribution function'] +readme = "README.rst" +requires-python = ">=3.10" +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: BSD License', + 'Operating System :: MacOS :: MacOS X', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX', + 'Operating System :: Unix', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Topic :: Scientific/Engineering :: Physics', + 'Topic :: Scientific/Engineering :: Chemistry', +] + +[project.scripts] +pdfmorph = "diffpy.pdfgui.applications.pdfgui:main" + +[project.urls] +Homepage = "https://github.com/diffpy/diffpy.pdfgui/" +Issues = "https://github.com/diffpy/diffpy.pdfgui/issues" + +[tool.pytest.ini_options] +pythonpath = ["src"] + +[tool.setuptools-git-versioning] +enabled = true +template = "{tag}" +dev_template = "{tag}" +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.pdfgui.tests*"] # exclude packages matching these glob patterns (empty by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) + [tool.black] line-length = 115 include = '\.pyi?$' From 10bbf3da01f4cc78102fabeb8920083af2aaf526 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Fri, 26 Jul 2024 01:13:09 -0400 Subject: [PATCH 18/20] again2 --- .github/workflows/main.yml | 2 +- run_tests.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 run_tests.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 92728a16..8a8329ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,4 +49,4 @@ jobs: uses: GabrielBB/xvfb-action@v1 with: run: | - bash -c "source $HOME/mambaforge/etc/profile.d/conda.sh && conda activate test_env && pytest --maxfail=5 --disable-warnings -v" + bash -c "source $HOME/mambaforge/etc/profile.d/conda.sh && conda activate test_env && python -m run_tests.py" diff --git a/run_tests.py b/run_tests.py new file mode 100644 index 00000000..a2a69494 --- /dev/null +++ b/run_tests.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +import diffpy.pdfgui.tests + +assert diffpy.pdfgui.tests.testdeps().wasSuccessful() From fb7f85ba086bc828d3007dfabc81c0280f208dac Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Fri, 26 Jul 2024 01:15:48 -0400 Subject: [PATCH 19/20] forgot to install diffpy.pdfgui! --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a8329ef..e3ade008 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,6 +44,7 @@ jobs: conda activate test_env mamba install --file requirements/run.txt mamba install --file requirements/test.txt + pip install -e . - name: Use Xvfb Action uses: GabrielBB/xvfb-action@v1 From 737c1e53888d93bb47fe4e0c427a497168090af4 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Fri, 26 Jul 2024 01:23:03 -0400 Subject: [PATCH 20/20] back to setup.py --- pyproject.toml | 56 -------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 82b28096..e537e24a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,59 +1,3 @@ -[build-system] -requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] -build-backend = "setuptools.build_meta" - -[project] -name = "diffpy.pdfgui" -dynamic=['version'] -authors = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, -] -maintainers = [ - { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, -] -description = "Tools" -keywords = ['diffpy', 'pdf', 'pair distribution function'] -readme = "README.rst" -requires-python = ">=3.10" -classifiers = [ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX', - 'Operating System :: Unix', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Topic :: Scientific/Engineering :: Physics', - 'Topic :: Scientific/Engineering :: Chemistry', -] - -[project.scripts] -pdfmorph = "diffpy.pdfgui.applications.pdfgui:main" - -[project.urls] -Homepage = "https://github.com/diffpy/diffpy.pdfgui/" -Issues = "https://github.com/diffpy/diffpy.pdfgui/issues" - -[tool.pytest.ini_options] -pythonpath = ["src"] - -[tool.setuptools-git-versioning] -enabled = true -template = "{tag}" -dev_template = "{tag}" -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.pdfgui.tests*"] # exclude packages matching these glob patterns (empty by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) - [tool.black] line-length = 115 include = '\.pyi?$'