diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml deleted file mode 100644 index 7f9449df7..000000000 --- a/.github/workflows/smoke_test.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: smoke test - -on: - # Runs on pushes targeting the default branch - push: - branches-ignore: - - master - # branches: ['develop'] - pull_request: - branches: ['main'] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - - -# Default to bash -defaults: - run: - shell: bash - - -jobs: - build: - strategy: - fail-fast: false - matrix: - os: - - name: 'ubuntu-22.04' - - name: 'macos-latest' -# windows build is broken; don't test for now -# - name: 'windows-latest' -# cmd_extra: '-win' - env: ['py310', 'py311', 'py312', 'py313'] - runs-on: ${{ matrix.os.name }} - steps: - # checkout repo - - uses: actions/checkout@v2 - - # set up pixi - - uses: prefix-dev/setup-pixi@v0.8.1 - with: - environments: ${{ matrix.env }} - pixi-version: v0.39.5 - manifest-path: pixi/pixi.toml - - # run install to see if it works - - name: Build - run: pixi run --manifest-path pixi/pixi.toml -e ${{ matrix.env }} install${{ matrix.os.cmd_extra }} - - - name: test - run: pixi run --manifest-path pixi/pixi.toml -e ${{ matrix.env }} test diff --git a/.github/workflows/win-gitstrap-selftest.yml b/.github/workflows/win-gitstrap-selftest.yml new file mode 100644 index 000000000..55119f826 --- /dev/null +++ b/.github/workflows/win-gitstrap-selftest.yml @@ -0,0 +1,52 @@ +name: GSAS-II self-tests on Windows via gitstrap + +on: + workflow_dispatch: # Allows running this workflow manually + # Runs on pushes targeting the default branch + push: + branches-ignore: + - master + # branches: ['main'] +# pull_request: +# branches: ['main'] + + +jobs: + test-GSAS-II: + strategy: + fail-fast: false + matrix: + python-version: ["3.12", "3.13"] +# python-version: ["3.11", "3.12", "3.13"] +# python-version: ["3.13"] + runs-on: 'windows-latest' + steps: + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + - name: Conda install + shell: bash -el {0} + run: | + # tailor the numpy version to match the GSAS-II binaries + if [ "${{ matrix.python-version }}" == "3.13" ]; then + npver="2.2 python-gil" + elif [ "${{ matrix.python-version }}" == "3.12" ]; then + npver=2.2 + elif [ "${{ matrix.python-version }}" == "3.11" ]; then + npver=1.26 + fi + conda install python=${{ matrix.python-version }} numpy=${npver} scipy requests pytest git gitpython pycifrw -c conda-forge --override-channels --quiet + #conda info + #conda list + - name: GSAS-II install + shell: bash -el {0} + run: | + curl -L -O https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/raw/main/install/gitstrap.py + python gitstrap.py --nocheck --noshortcut --branch=main + + - name: GSAS-II all tests + shell: bash -el {0} + run: | + cd GSAS-II + python -m pytest diff --git a/.github/workflows/win_test.yml b/.github/workflows/win_test.yml index f7020980f..f15cc3d1b 100644 --- a/.github/workflows/win_test.yml +++ b/.github/workflows/win_test.yml @@ -1,42 +1,97 @@ -name: run self-tests on Windows +name: debug self-tests on Windows w/3.11 on: + workflow_dispatch: # Allows running this workflow manually # Runs on pushes targeting the default branch push: branches-ignore: - master - # branches: ['develop'] + # branches: ['main'] # pull_request: # branches: ['main'] - workflow_dispatch: # Allows running this workflow manually - - -# Default to bash -defaults: - run: - shell: bash jobs: - build: + test-GSAS-II: strategy: fail-fast: false matrix: -# env: ['py313'] - env: ['py310', 'py311', 'py312', 'py313'] +# python-version: ["3.11", "3.12", "3.13"] + python-version: ["3.11"] +# python-version: ["3.12"] runs-on: 'windows-latest' steps: - - name: Get conda - #uses: conda-incubator/setup-miniconda@v3.0.3 - uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # v3.0.3 using hash for security + - uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: build - miniforge-version: latest - python-version: ${{ matrix.env }} - - # configure conda - - name: config python - if [ ${{ matrix.env }} == 'py313' ]; then - npver=2.2 - fi - run: conda install numpy={$npver} scipy requests pytest + auto-update-conda: true + python-version: ${{ matrix.python-version }} + - name: Conda install + shell: bash -el {0} + run: | + # tailor the numpy version to match the GSAS-II binaries + if [ "${{ matrix.python-version }}" == "3.13" ]; then + npver="2.2 python-gil" + elif [ "${{ matrix.python-version }}" == "3.12" ]; then + npver=2.2 + elif [ "${{ matrix.python-version }}" == "3.11" ]; then + npver=1.26 + fi + #conda list + #conda info + conda install python=${{ matrix.python-version }} numpy=${npver} scipy requests pytest git gitpython pycifrw -c conda-forge --override-channels --quiet + #conda install --quiet numpy=${npver} requests pytest briantoby::gsas2pkg -c conda-forge + conda info + conda list + - name: GSAS-II install + shell: bash -el {0} + run: | + #mkdir G2 + #cd G2 + curl -L -O https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/raw/main/install/gitstrap.py + python gitstrap.py --nocheck --noshortcut --branch=main + + - name: find files + shell: bash -el {0} + run: | + ls -l GSAS-II/GSASII-bin/win_64_p3.11_n1.26 + #ls -l GSAS-II/GSASII-bin/win_64_p3.12_n2.2 + ls -l GSAS-II/tests + + - name: GSAS-II single test + if: always() + shell: bash -el {0} + run: | + cd GSAS-II + python tests/test_elm.py + python tests/test_spg.py + + # - name: GSAS-II all tests + # if: always() + # shell: bash -el {0} + # run: | + # cd GSAS-II + # ls + # python -m pytest + + - name: try pyspg + if: always() + shell: bash -el {0} + run: | + cd GSAS-II/GSASII-bin/win_64_p3.11_n1.26 + #cd GSAS-II/GSASII-bin/win_64_p3.12_n2.2 + python -VV + #python -v -c "import sys; print(sys.path)" + python -c "import pyspg" + + - name: try ldd + if: always() + shell: bash -el {0} + run: | + #conda create -n ntldd python=3.12 numpy=2.2 m2w64-ntldd-git + conda create -n ntldd python=3.11 numpy=1.26 m2w64-ntldd-git + conda activate ntldd + #cd GSAS-II/GSASII-bin/win_64_p3.11_n1.26 + cd GSAS-II/GSASII-bin/win_64_p3.12_n2.2 + ls + ntldd *.pyd + python -c "import pyspg" diff --git a/GSASII/GSASIIscriptable.py b/GSASII/GSASIIscriptable.py index e5b063b05..e3dbe77aa 100644 --- a/GSASII/GSASIIscriptable.py +++ b/GSASII/GSASIIscriptable.py @@ -77,6 +77,12 @@ def SetPrintLevel(level): if mode in level.lower(): printLevel = mode return +def SetDebugMode(mode): + '''Set the debug configuration mode on (mode=True) or off (mode=False). + This will provide some additional output that may help with + tracking down problems in the code. + ''' + GSASIIpath.SetConfigValue({'debug':bool(mode)}) def installScriptingShortcut(): '''Creates a file named G2script in the current Python site-packages directory. @@ -429,7 +435,7 @@ def import_generic(filename, readerlist, fmthint=None, bank=None, elif flag: primaryReaders.append(reader) if not secondaryReaders and not primaryReaders: - raise G2ImportException("Could not read file: ", filename) + raise G2ImportException(f"Could not read file: {filename}") with open(filename, 'r'): rd_list = [] @@ -486,7 +492,7 @@ def import_generic(filename, readerlist, fmthint=None, bank=None, G2fil.G2Print("{} block # {} read by Reader {}" .format(filename,bank,rd.formatName)) return rd_list - raise G2ImportException("No reader could read file: " + filename) + raise G2ImportException(f"No reader could read file: {filename}") def load_iprms(instfile, reader, bank=None): @@ -533,8 +539,7 @@ def load_iprms(instfile, reader, bank=None): elif ibanks == 1: reader.instbank = 1 else: - raise G2ImportException("Instrument parameter file has {} banks, select one with instbank param." - .format(ibanks)) + raise G2ImportException(f"Instrument parameter file has {ibanks} banks, select one with instbank param.") reader.powderentry[2] = 1 reader.instfile = instfile reader.instmsg = '{} bank {}'.format(instfile,reader.instbank) diff --git a/GSASII/inputs/BinariesCache.txt b/GSASII/inputs/BinariesCache.txt index 5e7f86b78..cded0eb8c 100644 --- a/GSASII/inputs/BinariesCache.txt +++ b/GSASII/inputs/BinariesCache.txt @@ -1,6 +1,14 @@ linux_64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_64_p3.11_n1.26.tgz +linux_64_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_64_p3.12_n2.2.tgz +linux_64_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_64_p3.13_n2.2.tgz linux_arm32_p3.11_n1.24 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_arm32_p3.11_n1.24.tgz linux_arm64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_arm64_p3.11_n1.26.tgz mac_64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_64_p3.11_n1.26.tgz +mac_64_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_64_p3.12_n2.2.tgz +mac_64_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_64_p3.13_n2.2.tgz mac_arm_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.11_n1.26.tgz +mac_arm_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.12_n2.2.tgz +mac_arm_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.13_n2.2.tgz win_64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/win_64_p3.11_n1.26.tgz +win_64_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/win_64_p3.12_n2.2.tgz +win_64_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/win_64_p3.13_n2.2.tgz