diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65dc50d..7f1b9a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,10 +9,6 @@ on: tags: - 'v[0-9]+.[0-9]+.[0-9]+*' -defaults: - run: - shell: bash - env: PACKAGE_NAME: blacs SCM_LOCAL_SCHEME: no-local-version @@ -41,26 +37,34 @@ jobs: strategy: matrix: include: - - { os: ubuntu-latest, python: 3.8, arch: x64 } - # - { os: ubuntu-latest, python: 3.7, arch: x64 } - # - { os: ubuntu-latest, python: 3.6, arch: x64 } - - # - { os: macos-latest, python: 3.8, arch: x64 } - # - { os: macos-latest, python: 3.7, arch: x64 } - # - { os: macos-latest, python: 3.6, arch: x64 } - - # - { os: windows-latest, python: 3.8, arch: x64 } - # - { os: windows-latest, python: 3.7, arch: x64 } - # - { os: windows-latest, python: 3.6, arch: x64 } - - # - { os: windows-latest, python: 3.8, arch: x86 } - # - { os: windows-latest, python: 3.7, arch: x86 } - # - { os: windows-latest, python: 3.6, arch: x86 } + - { os: ubuntu-latest, python: '3.11', arch: x64, conda: true} + # - { os: ubuntu-latest, python: '3.10', arch: x64, conda: true } + # - { os: ubuntu-latest, python: '3.9', arch: x64, conda: true } + # - { os: ubuntu-latest, python: '3.8', arch: x64, conda: true } + # - { os: ubuntu-latest, python: '3.7', arch: x64, conda: true } + + # - { os: macos-11, python: '3.11', arch: x64, conda: true } + # - { os: macos-11, python: '3.10', arch: x64, conda: true } + # - { os: macos-11, python: '3.9', arch: x64, conda: true } + # - { os: macos-11, python: '3.8', arch: x64, conda: true } + # - { os: macos-11, python: '3.7', arch: x64, conda: true } + + # - { os: windows-latest, python: '3.11', arch: x64, conda: true } + # - { os: windows-latest, python: '3.10', arch: x64, conda: true } + # - { os: windows-latest, python: '3.9', arch: x64, conda: true } + # - { os: windows-latest, python: '3.8', arch: x64, conda: true } + # - { os: windows-latest, python: '3.7', arch: x64, conda: true } + + # - { os: windows-latest, python: '3.11', arch: x86, conda: false } # conda not yet available + # - { os: windows-latest, python: '3.10', arch: x86, conda: true } + # - { os: windows-latest, python: '3.9', arch: x86, conda: true } + # - { os: windows-latest, python: '3.8', arch: x86, conda: true } + # - { os: windows-latest, python: '3.7', arch: x86, conda: true } if: github.repository == 'labscript-suite/blacs' && (github.event_name != 'create' || github.event.ref_type != 'branch') steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -69,7 +73,7 @@ jobs: run: git tag -d $(git tag --points-at HEAD) - name: Install Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} architecture: ${{ matrix.arch }} @@ -77,72 +81,66 @@ jobs: - name: Source Distribution if: strategy.job-index == 0 run: | - python -m pip install --upgrade pip setuptools wheel pep517 - python -m pep517.build -s . + python -m pip install --upgrade pip setuptools wheel build + python -m build -s . - name: Wheel Distribution # Impure Linux wheels are built in the manylinux job. if: (env.PURE == 'true' && strategy.job-index == 0) || (env.PURE == 'false' && runner.os != 'Linux') run: | - python -m pip install --upgrade pip setuptools wheel pep517 - python -m pep517.build -b . + python -m pip install --upgrade pip setuptools wheel build + python -m build -w . - name: Upload Artifact if: strategy.job-index == 0 || (env.PURE == 'false' && runner.os != 'Linux') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: dist path: ./dist - name: Set Variables for Conda Build + if: matrix.conda + shell: bash run: | - if [ $RUNNER_OS == Windows ] && [ ${{ matrix.arch }} == x64 ]; then - CONDA_INSTALLER=Miniconda3-latest-Windows-x86_64.exe - elif [ $RUNNER_OS == Windows ]; then - CONDA_INSTALLER=Miniconda3-latest-Windows-x86.exe - elif [ $RUNNER_OS == Linux ]; then - CONDA_INSTALLER=Miniconda3-latest-Linux-x86_64.sh - else - CONDA_INSTALLER=Miniconda3-latest-MacOSX-x86_64.sh - fi if [ $NOARCH == true ]; then CONDA_BUILD_ARGS="--noarch" else CONDA_BUILD_ARGS="" fi - echo "CONDA_INSTALLER=$CONDA_INSTALLER" >> $GITHUB_ENV echo "CONDA_BUILD_ARGS=$CONDA_BUILD_ARGS" >> $GITHUB_ENV + - name: Install Miniconda + if: matrix.conda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + architecture: ${{ matrix.arch }} + miniconda-version: "latest" + + - name: Workaround conda-build incompatibility with xcode 12+ + if: runner.os == 'macOS' + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 11.7 + - name: Conda package (Unix) - if: runner.os != 'Windows' + if: (matrix.conda && runner.os != 'Windows') + shell: bash -l {0} run: | - curl -LO https://repo.continuum.io/miniconda/$CONDA_INSTALLER - bash "$CONDA_INSTALLER" -b -p .miniconda - source .miniconda/etc/profile.d/conda.sh - conda activate - conda update -n base -c defaults conda - conda create -n py${{ matrix.python }} python=${{ matrix.python }} - conda activate py${{ matrix.python }} - conda install -c cbillington setuptools-conda - pip install --upgrade setuptools_scm + conda install -c labscript-suite setuptools-conda setuptools-conda build $CONDA_BUILD_ARGS . - name: Conda Package (Windows) - if: runner.os == 'Windows' - shell: cmd + if: (matrix.conda && runner.os == 'Windows') + shell: cmd /C CALL {0} run: | - curl -LO https://repo.continuum.io/miniconda/%CONDA_INSTALLER% - %CONDA_INSTALLER% /S /D=%CD%\.miniconda && ^ - .miniconda\Scripts\activate && ^ - conda update -n base -c defaults conda && ^ - conda create -n py${{ matrix.python }} python=${{ matrix.python }} && ^ - conda activate py${{ matrix.python }} && ^ - conda install -c cbillington setuptools-conda && ^ - pip install --upgrade setuptools_scm && ^ - setuptools-conda build %CONDA_BUILD_ARGS% . + conda install -c labscript-suite setuptools-conda && ^ + setuptools-conda build %CONDA_BUILD_ARGS% --croot ${{ runner.temp }}\cb . - name: Upload Artifact - uses: actions/upload-artifact@v2 + if: matrix.conda + uses: actions/upload-artifact@v3 with: name: conda_packages path: ./conda_packages @@ -151,16 +149,11 @@ jobs: manylinux: name: Build Manylinux runs-on: ubuntu-latest - strategy: - matrix: - include: - - { python: 'cp36-cp36m cp37-cp37m cp38-cp38' } - if: github.repository == 'labscript-suite/blacs' && (github.event_name != 'create' || github.event.ref_type != 'branch') steps: - name: Checkout if: env.PURE == 'false' - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -170,16 +163,17 @@ jobs: - name: Build Manylinux Wheels if: env.PURE == 'false' - uses: RalfG/python-wheels-manylinux-build@v0.2.2-manylinux2010_x86_64 + uses: RalfG/python-wheels-manylinux-build@v0.4.2 with: - python-versions: ${{ matrix.python }} + python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311' + pre-build-command: 'git config --global --add safe.directory "*"' - name: Upload Artifact if: env.PURE == 'false' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: dist - path: wheelhouse/*manylinux*.whl + path: dist/*manylinux*.whl release: name: Release @@ -188,73 +182,62 @@ jobs: steps: - name: Download Artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: dist path: ./dist - name: Download Artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: conda_packages path: ./conda_packages - - name: Publish on TestPyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.testpypi }} - repository_url: https://test.pypi.org/legacy/ - - name: Get Version Number if: github.event.ref_type == 'tag' run: | VERSION="${GITHUB_REF/refs\/tags\/v/}" echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Create GitHub Release + - name: Create GitHub Release and Upload Release Asset if: github.event.ref_type == 'tag' - id: create_release - uses: actions/create-release@latest + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.event.ref }} - release_name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }} + name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }} draft: true prerelease: ${{ contains(github.event.ref, 'rc') }} + files: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz - - name: Upload Release Asset - if: github.event.ref_type == 'tag' - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish on TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz - asset_name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz - asset_content_type: application/gzip + user: __token__ + password: ${{ secrets.testpypi }} + repository-url: https://test.pypi.org/legacy/ - name: Publish on PyPI if: github.event.ref_type == 'tag' - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.pypi }} - - name: Install Miniconda and cloud client - run: | - curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh - bash Miniconda3-latest-Linux-x86_64.sh -b -p .miniconda - source .miniconda/etc/profile.d/conda.sh - conda activate - conda install anaconda-client + - name: Install Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + + - name: Install Anaconda cloud client + shell: bash -l {0} + run: conda install anaconda-client - name: Publish to Anaconda test label if: github.event.ref_type != 'tag' + shell: bash -l {0} run: | - source .miniconda/etc/profile.d/conda.sh - conda activate anaconda \ --token ${{ secrets.ANACONDA_API_TOKEN }} \ upload \ @@ -263,10 +246,9 @@ jobs: conda_packages/*/* - name: Publish to Anaconda main label + shell: bash -l {0} if: github.event.ref_type == 'tag' run: | - source .miniconda/etc/profile.d/conda.sh - conda activate anaconda \ --token ${{ secrets.ANACONDA_API_TOKEN }} \ upload \ diff --git a/blacs/__main__.py b/blacs/__main__.py index 9098443..56aedb9 100644 --- a/blacs/__main__.py +++ b/blacs/__main__.py @@ -464,8 +464,17 @@ def restore_window(self,tab_data): # Actually this is a waste of time because if you close when maximized, reoopen and then # de-maximize, the window moves to a random position (not the position it was at before maximizing) # so bleh! - self.ui.move(tab_data['BLACS settings']["window_xpos"]-tab_data['BLACS settings']['window_frame_width']/2,tab_data['BLACS settings']["window_ypos"]-tab_data['BLACS settings']['window_frame_height']+tab_data['BLACS settings']['window_frame_width']/2) - self.ui.resize(tab_data['BLACS settings']["window_width"],tab_data['BLACS settings']["window_height"]) + self.ui.move( + tab_data['BLACS settings']["window_xpos"] + - tab_data['BLACS settings']['window_frame_width'] // 2, + tab_data['BLACS settings']["window_ypos"] + - tab_data['BLACS settings']['window_frame_height'] + + tab_data['BLACS settings']['window_frame_width'] // 2, + ) + self.ui.resize( + tab_data['BLACS settings']["window_width"], + tab_data['BLACS settings']["window_height"], + ) if 'window_maximized' in tab_data['BLACS settings'] and tab_data['BLACS settings']['window_maximized']: self.ui.showMaximized() @@ -474,7 +483,7 @@ def restore_window(self,tab_data): pane.setSizes(tab_data['BLACS settings'][pane_name]) except Exception as e: - logger.warning("Unable to load window and notebook defaults. Exception:"+str(e)) + logger.exception("Unable to load window and notebook defaults. Exception:"+str(e)) def order_tabs(self,tab_data): # Move the tabs to the correct notebook diff --git a/blacs/experiment_queue.py b/blacs/experiment_queue.py index f98875e..dce7efd 100644 --- a/blacs/experiment_queue.py +++ b/blacs/experiment_queue.py @@ -15,6 +15,7 @@ import os import threading import time +import datetime import sys import shutil from collections import defaultdict @@ -722,7 +723,7 @@ def restart_function(device_name): # A Queue for event-based notification of when the experiment has finished. experiment_finished_queue = queue.Queue() logger.debug('About to start the master pseudoclock') - run_time = time.localtime() + run_time = datetime.datetime.now() ########################################################################################################################################## # Plugin callbacks # @@ -850,7 +851,7 @@ def restart_function(device_name): data_group = hdf5_file['/'].create_group('data') # stamp with the run time of the experiment - hdf5_file.attrs['run time'] = time.strftime('%Y%m%dT%H%M%S',run_time) + hdf5_file.attrs['run time'] = run_time.strftime('%Y%m%dT%H%M%S.%f') error_condition = False response_list = {} diff --git a/blacs/tab_base_classes.py b/blacs/tab_base_classes.py index 590d427..077223d 100644 --- a/blacs/tab_base_classes.py +++ b/blacs/tab_base_classes.py @@ -330,7 +330,7 @@ def _get_remote_configuration(self): if remote_server_device.parent.name != PRIMARY_BLACS: msg = "Multi-hop remote workers not yet supported by BLACS" raise NotImplementedError(msg) - remote_host, remote_port = remote_server_device.parent_port.split(':') + remote_host, remote_port = remote_server_device.parent_port.rsplit(':', 1) remote_port = int(remote_port) return RemoteProcessClient(remote_host, remote_port) return None diff --git a/docs/source/conf.py b/docs/source/conf.py index 5708f4f..5b2094a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -94,15 +94,15 @@ intersphinx_mapping = { 'python': ('https://docs.python.org/3/', None), 'numpy': ('https://numpy.org/doc/stable/', None), - 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), + 'scipy': ('https://docs.scipy.org/doc/scipy/', None), 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None), 'qtutils': ('https://qtutils.readthedocs.io/en/stable/', None), 'pyqtgraph': ( 'https://pyqtgraph.readthedocs.io/en/latest/', None, ), # change to stable once v0.11 is published - 'matplotlib': ('https://matplotlib.org/', None), - 'h5py': ('http://docs.h5py.org/en/stable/', None), + 'matplotlib': ('https://matplotlib.org/stable/', None), + 'h5py': ('https://docs.h5py.org/en/stable/', None), 'pydaqmx': ('https://pythonhosted.org/PyDAQmx/', None), 'qt': ( '', diff --git a/setup.cfg b/setup.cfg index ea0a546..ba6b756 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,6 +19,8 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 [options] zip_safe = False @@ -43,7 +45,7 @@ gui_scripts = pyqt = PyQt5 docs = PyQt5 - Sphinx==3.5.3 + Sphinx==4.4.0 sphinx-rtd-theme==0.5.2 recommonmark==0.6.0 m2r==0.2.1