diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1c8db5..acd1c06 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: labscript-utils SCM_LOCAL_SCHEME: no-local-version @@ -41,26 +37,30 @@ 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.10', arch: x64 } + # - { os: ubuntu-latest, python: '3.9', arch: x64 } + - { os: ubuntu-latest, python: '3.8', arch: x64 } + # - { os: ubuntu-latest, python: '3.7', arch: x64 } + + # - { os: macos-latest, python: '3.10', arch: x64 } + # - { os: macos-latest, python: '3.9', arch: x64 } + # - { os: macos-latest, python: '3.8', arch: x64 } + # - { os: macos-latest, python: '3.7', arch: x64 } + + # - { os: windows-latest, python: '3.10', arch: x64 } + # - { os: windows-latest, python: '3.9', arch: x64 } + # - { os: windows-latest, python: '3.8', arch: x64 } + # - { os: windows-latest, python: '3.7', arch: x64 } + + # - { os: windows-latest, python: '3.10', arch: x86 } + # - { os: windows-latest, python: '3.9', arch: x86 } + # - { os: windows-latest, python: '3.8', arch: x86 } + # - { os: windows-latest, python: '3.7', arch: x86 } if: github.repository == 'labscript-suite/labscript-utils' && (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 +69,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 +77,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 + 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 "::set-env name=CONDA_INSTALLER::$CONDA_INSTALLER" - echo "::set-env name=CONDA_BUILD_ARGS::$CONDA_BUILD_ARGS" + echo "CONDA_BUILD_ARGS=$CONDA_BUILD_ARGS" >> $GITHUB_ENV + + - name: Install Miniconda + # We need https://github.com/conda-incubator/setup-miniconda/pull/189 in order + # to be able to install 32-bit miniconda on Windows. Once setup-miniconda 2.1.2 + # is released with this fix, can change to @v2. + uses: conda-incubator/setup-miniconda@1a875d105ac03256664b54c882c8c374ce617ef6 + 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' + 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 + 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 + uses: actions/upload-artifact@v3 with: name: conda_packages path: ./conda_packages @@ -151,16 +145,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/labscript-utils' && (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 +159,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' + 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,19 +178,19 @@ 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 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.testpypi }} @@ -210,7 +200,7 @@ jobs: if: github.event.ref_type == 'tag' run: | VERSION="${GITHUB_REF/refs\/tags\/v/}" - echo "::set-env name=VERSION::$VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Create GitHub Release if: github.event.ref_type == 'tag' @@ -242,19 +232,19 @@ jobs: 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 +253,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/.gitignore b/.gitignore index 70c27dc..583228d 100644 --- a/.gitignore +++ b/.gitignore @@ -158,4 +158,5 @@ conda_packages/ # Sphinx documentation docs/html/ docs/source/_build/ -docs/source/components.rst \ No newline at end of file +docs/source/components.rst +docs/source/api/_autosummary \ No newline at end of file diff --git a/docs/source/_templates/autosummary-class.rst b/docs/source/_templates/autosummary-class.rst new file mode 100644 index 0000000..4a2889e --- /dev/null +++ b/docs/source/_templates/autosummary-class.rst @@ -0,0 +1,32 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :undoc-members: + :show-inheritance: + + {% block methods %} + .. automethod:: __init__ + + {% if methods %} + .. rubric:: {{ _('Methods') }} + + .. autosummary:: + {% for item in methods %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} + + .. autosummary:: + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/docs/source/_templates/autosummary-module.rst b/docs/source/_templates/autosummary-module.rst new file mode 100644 index 0000000..2ce2afd --- /dev/null +++ b/docs/source/_templates/autosummary-module.rst @@ -0,0 +1,66 @@ +{{ fullname | escape | underline}} + +{% block submodules %} +{% if modules %} +.. rubric:: {{ _('Sub-Modules') }} +.. autosummary:: + :toctree: + :template: autosummary-module.rst + :recursive: + + {% for item in modules %} + {{ item }} + {%- endfor %} +{% endif %} +{% endblock %} + +.. automodule:: {{ fullname }} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Module Attributes') }} + + .. autosummary:: + :toctree: + {% for item in attributes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block functions %} + {% if functions %} + .. rubric:: {{ _('Functions') }} + + .. autosummary:: + :toctree: + {% for item in functions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block classes %} + {% if classes %} + .. rubric:: {{ _('Classes') }} + + .. autosummary:: + :toctree: + :template: autosummary-class.rst + {% for item in classes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block exceptions %} + {% if exceptions %} + .. rubric:: {{ _('Exceptions') }} + + .. autosummary:: + :toctree: + {% for item in exceptions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/docs/source/api/connections.rst b/docs/source/api/connections.rst deleted file mode 100644 index d4e5745..0000000 --- a/docs/source/api/connections.rst +++ /dev/null @@ -1,8 +0,0 @@ -=========================== -labscript_utils.connections -=========================== - -.. automodule:: labscript_utils.connections - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/dict_diff.rst b/docs/source/api/dict_diff.rst deleted file mode 100644 index 13b571b..0000000 --- a/docs/source/api/dict_diff.rst +++ /dev/null @@ -1,8 +0,0 @@ -========================= -labscript_utils.dict_diff -========================= - -.. automodule:: labscript_utils.dict_diff - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/double_import_denier.rst b/docs/source/api/double_import_denier.rst deleted file mode 100644 index be00f09..0000000 --- a/docs/source/api/double_import_denier.rst +++ /dev/null @@ -1,8 +0,0 @@ -==================================== -labscript_utils.double_import_denier -==================================== - -.. automodule:: labscript_utils.double_import_denier - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/filewatcher.rst b/docs/source/api/filewatcher.rst deleted file mode 100644 index b9dc72e..0000000 --- a/docs/source/api/filewatcher.rst +++ /dev/null @@ -1,8 +0,0 @@ -=========================== -labscript_utils.filewatcher -=========================== - -.. automodule:: labscript_utils.filewatcher - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/h5_lock.rst b/docs/source/api/h5_lock.rst deleted file mode 100644 index 7647103..0000000 --- a/docs/source/api/h5_lock.rst +++ /dev/null @@ -1,8 +0,0 @@ -======================= -labscript_utils.h5_lock -======================= - -.. automodule:: labscript_utils.h5_lock - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/impprof.rst b/docs/source/api/impprof.rst deleted file mode 100644 index 3948b81..0000000 --- a/docs/source/api/impprof.rst +++ /dev/null @@ -1,8 +0,0 @@ -======================= -labscript_utils.impprof -======================= - -.. automodule:: labscript_utils.impprof - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst index 9e9ff9a..59bde58 100644 --- a/docs/source/api/index.rst +++ b/docs/source/api/index.rst @@ -2,62 +2,10 @@ API Reference ************* -Labscript Tools -~~~~~~~~~~~~~~~ - -.. toctree:: - :maxdepth: 2 +.. autosummary:: + :toctree: _autosummary + :template: autosummary-module.rst + :recursive: labscript_utils - connections - dict_diff - labconfig - settings - testing_utils - properties - unitconversions - -Communications -~~~~~~~~~~~~~~ - -.. toctree:: - :maxdepth: 2 - - h5_lock - ls_zprocess - remote - shared_drive - zlock - zlog - -GUI -~~~~ - -.. toctree:: - :maxdepth: 2 - - splash - qtwidgets - -Logging and Profiling -~~~~~~~~~~~~~~~~~~~~~ - -.. toctree:: - :maxdepth: 2 - - impprof - memprof - setup_logging - tracelog - - -Module and File Tools -~~~~~~~~~~~~~~~~~~~~~ - -.. toctree:: - :maxdepth: 2 - - double_import_denier - filewatcher - modulewatcher - versions + labscript_profile diff --git a/docs/source/api/labconfig.rst b/docs/source/api/labconfig.rst deleted file mode 100644 index d95907d..0000000 --- a/docs/source/api/labconfig.rst +++ /dev/null @@ -1,8 +0,0 @@ -========================= -labscript_utils.labconfig -========================= - -.. automodule:: labscript_utils.labconfig - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/labscript_utils.rst b/docs/source/api/labscript_utils.rst deleted file mode 100644 index f73d1e1..0000000 --- a/docs/source/api/labscript_utils.rst +++ /dev/null @@ -1,7 +0,0 @@ -=============== -labscript_utils -=============== - -.. automodule:: labscript_utils - :members: - :undoc-members: \ No newline at end of file diff --git a/docs/source/api/ls_zprocess.rst b/docs/source/api/ls_zprocess.rst deleted file mode 100644 index 27ddede..0000000 --- a/docs/source/api/ls_zprocess.rst +++ /dev/null @@ -1,8 +0,0 @@ -=========================== -labscript_utils.ls_zprocess -=========================== - -.. automodule:: labscript_utils.ls_zprocess - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/memprof.rst b/docs/source/api/memprof.rst deleted file mode 100644 index f52ff07..0000000 --- a/docs/source/api/memprof.rst +++ /dev/null @@ -1,8 +0,0 @@ -======================= -labscript_utils.memprof -======================= - -.. automodule:: labscript_utils.memprof - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/modulewatcher.rst b/docs/source/api/modulewatcher.rst deleted file mode 100644 index 95055be..0000000 --- a/docs/source/api/modulewatcher.rst +++ /dev/null @@ -1,8 +0,0 @@ -============================= -labscript_utils.modulewatcher -============================= - -.. automodule:: labscript_utils.modulewatcher - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/properties.rst b/docs/source/api/properties.rst deleted file mode 100644 index 0c4d364..0000000 --- a/docs/source/api/properties.rst +++ /dev/null @@ -1,8 +0,0 @@ -========================== -labscript_utils.properties -========================== - -.. automodule:: labscript_utils.properties - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/qtwidgets.rst b/docs/source/api/qtwidgets.rst deleted file mode 100644 index 1df32fe..0000000 --- a/docs/source/api/qtwidgets.rst +++ /dev/null @@ -1,78 +0,0 @@ -========================= -labscript_utils.qtwidgets -========================= - -.. automodule:: labscript_utils.qtwidgets - :members: - :undoc-members: - -Helper Widgets -~~~~~~~~~~~~~~ - -.. automodule:: labscript_utils.qtwidgets.dragdroptab - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.elide_label - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.fingertab - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.headerview_with_widgets - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.InputPlotWindow - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.outputbox - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.toolpalette - :members: - :undoc-members: - :show-inheritance: - -Input/Output Widgets -~~~~~~~~~~~~~~~~~~~~ - -.. automodule:: labscript_utils.qtwidgets.analoginput - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.analogoutput - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.ddsoutput - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.digitaloutput - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.enumoutput - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.qtwidgets.imageoutput - :members: - :undoc-members: - :show-inheritance: \ No newline at end of file diff --git a/docs/source/api/remote.rst b/docs/source/api/remote.rst deleted file mode 100644 index 3704a84..0000000 --- a/docs/source/api/remote.rst +++ /dev/null @@ -1,8 +0,0 @@ -====================== -labscript_utils.remote -====================== - -.. automodule:: labscript_utils.remote - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/settings.rst b/docs/source/api/settings.rst deleted file mode 100644 index f42d1aa..0000000 --- a/docs/source/api/settings.rst +++ /dev/null @@ -1,8 +0,0 @@ -======================== -labscript_utils.settings -======================== - -.. automodule:: labscript_utils.settings - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/setup_logging.rst b/docs/source/api/setup_logging.rst deleted file mode 100644 index ac72f74..0000000 --- a/docs/source/api/setup_logging.rst +++ /dev/null @@ -1,8 +0,0 @@ -============================= -labscript_utils.setup_logging -============================= - -.. automodule:: labscript_utils.setup_logging - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/shared_drive.rst b/docs/source/api/shared_drive.rst deleted file mode 100644 index 612fdf2..0000000 --- a/docs/source/api/shared_drive.rst +++ /dev/null @@ -1,8 +0,0 @@ -============================ -labscript_utils.shared_drive -============================ - -.. automodule:: labscript_utils.shared_drive - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/splash.rst b/docs/source/api/splash.rst deleted file mode 100644 index 1c487ea..0000000 --- a/docs/source/api/splash.rst +++ /dev/null @@ -1,8 +0,0 @@ -====================== -labscript_utils.splash -====================== - -.. automodule:: labscript_utils.splash - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/testing_utils.rst b/docs/source/api/testing_utils.rst deleted file mode 100644 index dba7879..0000000 --- a/docs/source/api/testing_utils.rst +++ /dev/null @@ -1,8 +0,0 @@ -============================= -labscript_utils.testing_utils -============================= - -.. automodule:: labscript_utils.testing_utils - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/tracelog.rst b/docs/source/api/tracelog.rst deleted file mode 100644 index 2acedd0..0000000 --- a/docs/source/api/tracelog.rst +++ /dev/null @@ -1,8 +0,0 @@ -======================== -labscript_utils.tracelog -======================== - -.. automodule:: labscript_utils.tracelog - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/unitconversions.rst b/docs/source/api/unitconversions.rst deleted file mode 100644 index 553d98b..0000000 --- a/docs/source/api/unitconversions.rst +++ /dev/null @@ -1,64 +0,0 @@ -=============================== -labscript_utils.unitconversions -=============================== - -.. automodule:: labscript_utils.unitconversions - :members: - :undoc-members: - -Basic Unit Conversion Classes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. automodule:: labscript_utils.unitconversions.test - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.example - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.UnitConversionBase - :members: - :undoc-members: - :show-inheritance: - -Unit Conversion Classes -~~~~~~~~~~~~~~~~~~~~~~~ - -.. automodule:: labscript_utils.unitconversions.aom - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.detuning - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.linear_coil_driver - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.NovaTechDDS9m - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.optotunelens - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.quad_driver - :members: - :undoc-members: - :show-inheritance: - -.. automodule:: labscript_utils.unitconversions.quad_monitor - :members: - :undoc-members: - :show-inheritance: - diff --git a/docs/source/api/versions.rst b/docs/source/api/versions.rst deleted file mode 100644 index 996d686..0000000 --- a/docs/source/api/versions.rst +++ /dev/null @@ -1,8 +0,0 @@ -============================ -labscript_utils.versions -============================ - -.. automodule:: labscript_utils.versions - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/zlock.rst b/docs/source/api/zlock.rst deleted file mode 100644 index 0d9aac1..0000000 --- a/docs/source/api/zlock.rst +++ /dev/null @@ -1,8 +0,0 @@ -===================== -labscript_utils.zlock -===================== - -.. automodule:: labscript_utils.zlock - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/api/zlog.rst b/docs/source/api/zlog.rst deleted file mode 100644 index 160db96..0000000 --- a/docs/source/api/zlog.rst +++ /dev/null @@ -1,8 +0,0 @@ -==================== -labscript_utils.zlog -==================== - -.. automodule:: labscript_utils.zlog - :members: - :undoc-members: - :private-members: \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index e3df35c..93b69f8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -40,6 +40,7 @@ # ones. extensions = [ "sphinx.ext.autodoc", + "sphinx.ext.autosummary", "sphinx.ext.autosectionlabel", "sphinx.ext.intersphinx", "sphinx.ext.napoleon", @@ -50,6 +51,8 @@ ] autodoc_typehints = 'description' +autosummary_generate = True +numfig = True # mock missing site packages methods import site @@ -90,15 +93,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': ( '', @@ -241,3 +244,43 @@ def setup(app): img_path=img_path ) ) + + # hooks to test docstring coverage + app.connect('autodoc-process-docstring', doc_coverage) + app.connect('build-finished', doc_report) + + +members_to_watch = ['module', 'class', 'function', 'exception', 'method', 'attribute'] +doc_count = 0 +undoc_count = 0 +undoc_objects = [] +undoc_print_objects = False + + +def doc_coverage(app, what, name, obj, options, lines): + global doc_count + global undoc_count + global undoc_objects + + if (what in members_to_watch and len(lines) == 0): + # blank docstring detected + undoc_count += 1 + undoc_objects.append(name) + else: + doc_count += 1 + + +def doc_report(app, exception): + global doc_count + global undoc_count + global undoc_objects + # print out report of documentation coverage + total_docs = undoc_count + doc_count + if total_docs != 0: + print(f'\nAPI Doc coverage of {doc_count/total_docs:.1%}') + if undoc_print_objects or os.environ.get('READTHEDOCS'): + print('\nItems lacking documentation') + print('===========================') + print(*undoc_objects, sep='\n') + else: + print('No docs counted, run \'make clean\' then rebuild to get the count.') diff --git a/docs/source/index.rst b/docs/source/index.rst index 86f2cab..89647bc 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -14,6 +14,7 @@ This documentation is primarily for developers who might want to use this common :hidden: :caption: DOCUMENTATION + labconfig api/index .. toctree:: diff --git a/docs/source/labconfig.rst b/docs/source/labconfig.rst new file mode 100644 index 0000000..9ca2399 --- /dev/null +++ b/docs/source/labconfig.rst @@ -0,0 +1,25 @@ +The *labconfig.ini* file +======================== + +The `labconfig.ini` file is a global configuration file for your **labscript-suite** installation. +It contains configurable settings that govern how the individual components of the suite operate. +The name of this file must be the host computer's system name. +So if my system's name was `heisenberg`, the labconfig file name would be `heisenberg.ini`. +This file should be located in the `labscript-suite` directory in the user space, in the `labconfig` subdirectory. + +When :doc:`installing the **labscript-suite** for the first time `, running the `labscript-profile-create` command will automatically generate the `labscript-suite` user space directory in the correct place and generate a `labconfig.ini` file for use on your system. +By editing the `ini` file named after your system, you can update the configuration settings of your **labscript-suite** installation. + +The Default *labconfig.ini* +--------------------------- + +Below is a copy of the default lab configuration if you were to install the **labscript-suite** today. + +.. note:: + + When updates are made to the suite that add or change keys available in the labconfig, your local file will **NOT** be automatically updated to include them. + Instead, if keys are missing from your local profile, default behavior will be assumed. + To implement the added functionality, you will need to manually add/change the keys in your local labconfig. + +.. include:: ../../labscript_profile/default_profile/labconfig/example.ini + :code: diff --git a/labscript_profile/__init__.py b/labscript_profile/__init__.py index a679ff5..55571f7 100644 --- a/labscript_profile/__init__.py +++ b/labscript_profile/__init__.py @@ -49,7 +49,10 @@ def add_userlib_and_pythonlib(): time the interpreter starts up""" labconfig = default_labconfig_path() if labconfig is not None and labconfig.exists(): - config = ConfigParser(defaults={'labscript_suite': LABSCRIPT_SUITE_PROFILE}) + # str() below is for py36 compat, where ConfigParser can't deal with Path objs + config = ConfigParser( + defaults={'labscript_suite': str(LABSCRIPT_SUITE_PROFILE)} + ) config.read(labconfig) for option in ['userlib', 'pythonlib']: try: diff --git a/labscript_profile/default_profile/labconfig/example.ini b/labscript_profile/default_profile/labconfig/example.ini index 38ffeb2..7f219dc 100644 --- a/labscript_profile/default_profile/labconfig/example.ini +++ b/labscript_profile/default_profile/labconfig/example.ini @@ -23,6 +23,7 @@ lyse = 42519 runviewer = 42521 runmanager = 42523 zlock = 7339 +zlog = 7340 zprocess_remote = 7341 [timeouts] @@ -35,7 +36,7 @@ hdf5_viewer = %%LOCALAPPDATA%%\HDF_Group\HDFView\3.1.0\hdfview.bat hdf5_viewer_arguments = {file} [labscript] -save_hg_info = True +save_hg_info = False save_git_info = False [BLACS/plugins] diff --git a/labscript_utils/filewatcher.py b/labscript_utils/filewatcher.py index c5b9dd5..4b6f84b 100644 --- a/labscript_utils/filewatcher.py +++ b/labscript_utils/filewatcher.py @@ -24,28 +24,27 @@ def __init__(self, callback, files=None, folders=None, clean_modified_info=None, Detect modification, deletion, creation, or restoration of specific files (and all files in specific folders). - callback -- elicited whenever file events are detected, requires at least - (name, info) arguments. Event specific callback requires - (name, info, event) arguments, where event is on of: - 'modified', 'deleted' (or None), 'created', 'restored', 'original' - The 'original' event corresponds to a state change that results in - the original file info at instantiation. - - Keyword arguments: - files -- List of specific files to watch. - A single file can be specified as a string (default None). - folders -- List of specific folders to watch. - A single folder can be specified as a string (default None). - If a file is created/deleted in/from any watched folder, it is added/ - removed to/from the FileWatcher.files attribute. - clean_modified_info -- File info to detect modification/restoration with respect - to. If None (default), or for files not present in clean_modified_info, the - initial modified info will be based on the first polling of files. - hashable_types -- File extensions for which MD5 checksum will be used to - detect modification/restoration with (default None). Files of any - other type will be watched using their modified time. - Restoration cannot be detected for types not in hashable_types. - interval -- Polling interval in seconds (default 1). + Args: + callback (function): elicited whenever file events are detected, requires at least + (name, info) arguments. Event specific callback requires + (name, info, event) arguments, where event is on of: + 'modified', 'deleted' (or None), 'created', 'restored', 'original' + The 'original' event corresponds to a state change that results in + the original file info at instantiation. + files (list, optional): List of specific files to watch. + A single file can be specified as a string (default None). + folders (list, optional): List of specific folders to watch. + A single folder can be specified as a string (default None). + If a file is created/deleted in/from any watched folder, it is added/ + removed to/from the FileWatcher.files attribute. + clean_modified_info (dict, optional): File info to detect modification/restoration with respect + to. If None (default), or for files not present in clean_modified_info, the + initial modified info will be based on the first polling of files. + hashable_types (iterable, optional): File extensions for which MD5 checksum will be used to + detect modification/restoration with (default None). Files of any + other type will be watched using their modified time. + Restoration cannot be detected for types not in hashable_types. + interval (float, optional): Polling interval in seconds (default 1). """ if len(getfullargspec(callback)[0]) > 2: # For backwards compatability, allow callback to have only two args diff --git a/labscript_utils/h5_lock.py b/labscript_utils/h5_lock.py index ad84a2c..4466074 100644 --- a/labscript_utils/h5_lock.py +++ b/labscript_utils/h5_lock.py @@ -89,6 +89,9 @@ def hack_locks_onto_h5py(): # Monkeypatch h5py so all files are locked: h5py.File = File - -connect_to_zlock_server() -hack_locks_onto_h5py() +if os.environ.get('READTHEDOCS'): + # prevent starting a zlock server on RTD, which always fails + pass +else: + connect_to_zlock_server() + hack_locks_onto_h5py() diff --git a/labscript_utils/labconfig.py b/labscript_utils/labconfig.py index d9c2057..d110fe8 100644 --- a/labscript_utils/labconfig.py +++ b/labscript_utils/labconfig.py @@ -43,7 +43,8 @@ def __init__( required_params = {} if defaults is None: defaults = {} - defaults['labscript_suite'] = LABSCRIPT_SUITE_PROFILE + # str() below is for py36 compat, where ConfigParser can't deal with Path objs + defaults['labscript_suite'] = str(LABSCRIPT_SUITE_PROFILE) if isinstance(config_path, list): self.config_path = config_path[0] else: diff --git a/labscript_utils/ls_zprocess.py b/labscript_utils/ls_zprocess.py index 7173719..f3f2021 100644 --- a/labscript_utils/ls_zprocess.py +++ b/labscript_utils/ls_zprocess.py @@ -13,12 +13,12 @@ import sys import os from socket import gethostbyname -from distutils.version import LooseVersion +from packaging.version import Version import zmq import zprocess import zprocess.process_tree -from zprocess.security import SecureContext +from zprocess.security import SecureContext, SecureSocket from labscript_utils.labconfig import LabConfig from labscript_utils import dedent import zprocess.zlog @@ -248,10 +248,19 @@ def instance(cls): # Super required to call unbound class method of parent class: return super(Context, cls).instance(shared_secret=config['shared_secret']) - def socket(self, *args, **kwargs): - config = get_config() - kwargs['allow_insecure'] = config['allow_insecure'] - return SecureContext.socket(self, *args, **kwargs) + def socket(self, socket_type, socket_class=None, **kwargs): + # socket_class kwarg introduced in pyzmq 25. Pass it through if it was given, + # otherwise don't. + if socket_class is not None: + kwargs['socket_class'] = socket_class + # Only insert our security-related args to the socket if we know it's going to + # be a SecureSocket. If caller has explicitly requested a different socket type + # (e.g since pyzmq 25, ThreadAuthenticator sets up an internal socket by calling + # `Context.socket(..., socket_class=zmq.Socket)), then don't.` + if socket_class is None or issubclass(socket_class, SecureContext): + config = get_config() + kwargs['allow_insecure'] = config['allow_insecure'] + return SecureContext.socket(self, socket_type=socket_type, **kwargs) def Lock(*args, **kwargs): @@ -337,7 +346,7 @@ def connect_to_zlock_server(): global _zlock_server_supports_readwrite if hasattr(client, 'get_protocol_version'): version = client.get_protocol_version() - if LooseVersion(version) >= LooseVersion('1.1.0'): + if Version(version) >= Version('1.1.0'): _zlock_server_supports_readwrite = True # The user can call these functions to change the timeouts later if they diff --git a/labscript_utils/modulewatcher.py b/labscript_utils/modulewatcher.py index 7e33b6d..25df904 100644 --- a/labscript_utils/modulewatcher.py +++ b/labscript_utils/modulewatcher.py @@ -16,16 +16,16 @@ import os import imp import site -import distutils.sysconfig +import sysconfig # Directories in which the standard library and installed packages may be located. # Modules in these locations will be whitelisted: PKGDIRS = [ - distutils.sysconfig.get_python_lib(plat_specific=True, standard_lib=True), - distutils.sysconfig.get_python_lib(plat_specific=True, standard_lib=False), - distutils.sysconfig.get_python_lib(plat_specific=False, standard_lib=True), - distutils.sysconfig.get_python_lib(plat_specific=False, standard_lib=False), + sysconfig.get_path('platstdlib'), + sysconfig.get_path('platlib'), + sysconfig.get_path('stdlib'), + sysconfig.get_path('purelib'), site.getusersitepackages(), ] PKGDIRS += site.getsitepackages() diff --git a/labscript_utils/properties.py b/labscript_utils/properties.py index f0a8ffb..8c2402f 100644 --- a/labscript_utils/properties.py +++ b/labscript_utils/properties.py @@ -124,7 +124,7 @@ def _get_con_table_properties(h5_file, device_name): # Compare with the name in the connection table # whether it is np.bytes_ or vlenstr: - namecol_dtype = dataset['name'].dtype + namecol_dtype = dataset.dtype['name'] if namecol_dtype.type is np.bytes_: device_name = device_name.encode('utf8') elif namecol_dtype is h5py.special_dtype(vlen=str): @@ -143,7 +143,7 @@ def _get_unit_conversion_parameters(h5_file, device_name): # Compare with the name in the connection table # whether it is np.bytes_ or vlenstr: - namecol_dtype = dataset['name'].dtype + namecol_dtype = dataset.dtype['name'] if namecol_dtype.type is np.bytes_: device_name = device_name.encode('utf8') elif namecol_dtype is h5py.special_dtype(vlen=str): diff --git a/labscript_utils/qtwidgets/toolpalette.py b/labscript_utils/qtwidgets/toolpalette.py index 21e9ef1..c4619fb 100644 --- a/labscript_utils/qtwidgets/toolpalette.py +++ b/labscript_utils/qtwidgets/toolpalette.py @@ -19,6 +19,8 @@ EXPAND_ICON = ':/qtutils/fugue/toggle-small-expand' CONTRACT_ICON = ':/qtutils/fugue/toggle-small' +_ENABLE_LAYOUT_EVENT_TYPE = QEvent.User + class ToolPaletteGroup(QVBoxLayout): def __init__(self,*args,**kwargs): @@ -265,6 +267,10 @@ def __init__(self,parent,name,*args,**kwargs): self._column_count = 0 self._row_count = 0 + # Variable for controlling whether or not self._layout_widgets() is + # called in self.resizeEvent(). + self._layout_widgets_during_resizeEvent = True + def addWidget(self,widget,force_relayout=True): # Append to end of tool pallete #widget.clicked.connect(embed) @@ -385,24 +391,53 @@ def minimumSizeHint(self): height = self.minimumSize().height() return QSize(width, height) + def event(self, event): + # Handle the custom event for reenabling the call to + # self._layout_widgets() during self.resizeEvent(). + if (event.type() == _ENABLE_LAYOUT_EVENT_TYPE): + self._layout_widgets_during_resizeEvent = True + # Return True so that this event isn't sent along to other event + # handlers as well. + return True + + # Handle all other events in the usual way. + return super().event(event) + def resizeEvent(self, event): # overwrite the resize event! - # print '--------- %s'%self._name - # print self._widget_list[0].size() - # print self._widget_list[0].sizeHint() - # print self._widget_list[0].minimumSizeHint() - # print self._layout.rowMinimumHeight(0) - # print self.size() - # print self.minimumSize() - # print self.sizeHint() - # print self.minimumSizeHint() - #pass resize event on to qwidget - # call layout() - QWidget.resizeEvent(self, event) - size = event.size() - if size.width() == self.size().width() and size.height() == self.size().height(): - # print 'relaying out widgets' - self._layout_widgets() + # This method can end up undergoing infinite recursion for some window + # layouts, see + # https://github.com/labscript-suite/labscript-utils/issues/27. It seems + # that sometimes self._layout_widgets() increases the number of columns, + # which then triggers a resizeEvent, which then calls + # self._layout_widgets() which then decreases the number of columns to + # its previous value, which triggers a resizeEvent, and so on. That loop + # may occur e.g. if increasing/decreasing the number of columns + # add/removes a scrollbar, which then changes the number of widgets that + # can fit in a row. Keeping track of the recursion depth isn't trivial + # because _layout_widgets() doesn't directly call itself; it just causes + # more resizing events to be added to the event queue. To work around + # that, this method will mark that future calls to this method shouldn't + # call _layout_widgets() but will also add an event to the event queue + # to reenable calling _layout_widgets() again once all of the resize + # events caused by this call to it have been processed. + + try: + #pass resize event on to qwidget + QWidget.resizeEvent(self, event) + size = event.size() + if size.width() == self.size().width() and size.height() == self.size().height(): + if self._layout_widgets_during_resizeEvent: + # Avoid calling this again until all the resize events that + # will be put in the queue by self._layout_widgets() have + # run. + self._layout_widgets_during_resizeEvent = False + self._layout_widgets() + finally: + # Add event to end of the event queue to allow _layout_widgets() in + # future calls. This event shouldn't be handled until the resize + # events generated during _layout_widgets() have run. + QCoreApplication.instance().postEvent(self, QEvent(_ENABLE_LAYOUT_EVENT_TYPE)) # A simple test! diff --git a/labscript_utils/setup_logging.py b/labscript_utils/setup_logging.py index df97448..aee409d 100644 --- a/labscript_utils/setup_logging.py +++ b/labscript_utils/setup_logging.py @@ -11,7 +11,9 @@ # # ##################################################################### import sys, os +from io import UnsupportedOperation import logging, logging.handlers +import warnings from labscript_utils.ls_zprocess import Handler, ensure_connected_to_zlog @@ -52,21 +54,32 @@ def setup_logging(program_name, log_level=logging.DEBUG, terminal_level=logging. handler.setFormatter(formatter) handler.setLevel(log_level) logger.addHandler(handler) - if sys.stdout is not None and sys.stdout.fileno() >= 0: - stdout_handler = logging.StreamHandler(sys.stdout) - stdout_handler.setFormatter(formatter) - stdout_handler.setLevel(terminal_level) - logger.addHandler(stdout_handler) - if sys.stderr is not None and sys.stderr.fileno() >= 0: - # Send warnings and greater to stderr instead of stdout: - stdout_handler.addFilter(LessThanFilter(logging.WARNING)) - sterr_handler = logging.StreamHandler(sys.stderr) - sterr_handler.setFormatter(formatter) - sterr_handler.setLevel(logging.WARNING) - logger.addHandler(sterr_handler) + try: + # Check that sys.stdout.fileno is callable, which is needed below. It is NOT + # callable in Jupyter notebooks. + stdout_fileno = sys.stdout.fileno() + except UnsupportedOperation: + # In this case the code is likely being run from a Jupyter notebook, warn the + # user that log messages won't be printed to stdout or stderr. + warnings.warn( + "Logging to stdout and stderr is disabled. See the log files for log messages." + ) else: - # Prevent bug on windows where writing to stdout without a command - # window causes a crash: - sys.stdout = sys.stderr = open(os.devnull, 'w') + if sys.stdout is not None and stdout_fileno >= 0: + stdout_handler = logging.StreamHandler(sys.stdout) + stdout_handler.setFormatter(formatter) + stdout_handler.setLevel(terminal_level) + logger.addHandler(stdout_handler) + if sys.stderr is not None and sys.stderr.fileno() >= 0: + # Send warnings and greater to stderr instead of stdout: + stdout_handler.addFilter(LessThanFilter(logging.WARNING)) + sterr_handler = logging.StreamHandler(sys.stderr) + sterr_handler.setFormatter(formatter) + sterr_handler.setLevel(logging.WARNING) + logger.addHandler(sterr_handler) + else: + # Prevent bug on windows where writing to stdout without a command + # window causes a crash: + sys.stdout = sys.stderr = open(os.devnull, 'w') logger.setLevel(logging.DEBUG) return logger diff --git a/labscript_utils/splash.py b/labscript_utils/splash.py index 6137510..3aecf8a 100644 --- a/labscript_utils/splash.py +++ b/labscript_utils/splash.py @@ -72,7 +72,7 @@ def __init__(self, imagepath): center_point = QtWidgets.QDesktopWidget().availableGeometry().center() x0, y0 = center_point.x(), center_point.y() - self.move(x0 - self.w / 2, y0 - self.h / 2) + self.move(x0 - self.w // 2, y0 - self.h // 2) self._first_paint_complete = False def paintEvent(self, event): diff --git a/labscript_utils/unitconversions/__init__.py b/labscript_utils/unitconversions/__init__.py index da49116..a1b01d3 100644 --- a/labscript_utils/unitconversions/__init__.py +++ b/labscript_utils/unitconversions/__init__.py @@ -26,7 +26,6 @@ class _All(object): def __getitem__(self, ix): if self.__all__ is None: - self.__all__ = [] self._import_all() return self.__all__[ix] @@ -34,6 +33,8 @@ def _import_all(self): """imports all unit conversion classes in module within this subpackage into this module's globals. This is used only for backward compatibility with unit conversion classes that were not specified with a fully qualified name""" + if self.__all__ is None: + self.__all__ = [] for filename in os.listdir(os.path.split(__file__)[0]): if filename.endswith('.py') and filename != '__init__.py': module = filename[:-3] diff --git a/labscript_utils/unitconversions/generic_frequency.py b/labscript_utils/unitconversions/generic_frequency.py new file mode 100644 index 0000000..9e7c4d6 --- /dev/null +++ b/labscript_utils/unitconversions/generic_frequency.py @@ -0,0 +1,54 @@ +##################################################################### +# # +# generic_frequency.py # +# # +# Copyright 2022, Monash University and contributors # +# # +# This file is part of the labscript suite (see # +# http://labscriptsuite.org) and is licensed under the Simplified # +# BSD License. See the license.txt file in the root of the project # +# for the full license. # +# # +##################################################################### +"""Generic frequency conversion""" + +from .UnitConversionBase import * + +class FreqConversion(UnitConversion): + """ + A Generic frequency conversion class that covers standard SI prefixes from a base of Hz. + """ + + base_unit = 'Hz' # must be defined here and match default hardware unit in BLACS tab + + def __init__(self, calibration_parameters = None): + self.parameters = calibration_parameters + if hasattr(self, 'derived_units'): + self.derived_units += ['kHz', 'MHz', 'GHz'] + else: + self.derived_units = ['kHz', 'MHz', 'GHz'] + UnitConversion.__init__(self,self.parameters) + + def kHz_to_base(self,kHz): + Hz = kHz*1e3 + return Hz + + def kHz_from_base(self,Hz): + kHz = Hz*1e-3 + return kHz + + def MHz_to_base(self,MHz): + Hz = MHz*1e6 + return Hz + + def MHz_from_base(self,Hz): + MHz = Hz*1e-6 + return MHz + + def GHz_to_base(self,GHz): + Hz = GHz*1e9 + return Hz + + def GHz_from_base(self,Hz): + GHz = Hz*1e-9 + return GHz \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 235bcb7..0a59b27 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ classifiers = Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 [options] zip_safe = False @@ -29,7 +30,7 @@ install_requires = h5py>=2.9 numpy>=1.15 packaging>=20.4 - pyqtgraph>=0.11.0rc0 + pyqtgraph>=0.11.0 qtutils>=2.2.3 scipy setuptools_scm>=4.1.0 @@ -38,10 +39,11 @@ install_requires = [options.extras_require] docs = PyQt5 - Sphinx==3.0.1 - sphinx-rtd-theme==0.4.3 + Sphinx==4.4.0 + sphinx-rtd-theme==0.5.2 recommonmark==0.6.0 m2r==0.2.1 + mistune<2.0.0 [options.package_data] labscript_profile = ../labscript-suite.pth diff --git a/setup.py b/setup.py index a12d0a0..5f958c3 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,27 @@ import os from setuptools import setup from setuptools.command.develop import develop -from distutils import log +import logging +# Setupstools >=64 +try: + from setuptools.command.editable_wheel import editable_wheel +except ImportError: + editable_wheel_command = None +else: + from wheel.wheelfile import WheelFile + class editable_wheel_command(editable_wheel): + """Custom editable_wheel command which installs the .pth file to the + wheel file for editable installs.""" + def _create_wheel_file(self, bdist_wheel): + wheel_path = super()._create_wheel_file(bdist_wheel) + with WheelFile(wheel_path, 'a') as wheel: + wheel.write("labscript-suite.pth") + return wheel_path + + +# Setuptools <= 63: class develop_command(develop): """Custom develop command which installs the .pth file to site-packages for editable installs.""" @@ -11,7 +29,7 @@ def run(self): path = os.path.join(self.install_dir, 'labscript-suite.pth') super().run() if not self.uninstall: - log.info(f'Copying labscript-suite.pth to {path}') + logging.info(f'Copying labscript-suite.pth to {path}') if not self.dry_run: self.copy_file('labscript-suite.pth', path) @@ -21,4 +39,10 @@ def run(self): "local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"), } -setup(use_scm_version=VERSION_SCHEME, cmdclass={'develop': develop_command}) +setup( + use_scm_version=VERSION_SCHEME, + cmdclass={ + 'develop': develop_command, + 'editable_wheel': editable_wheel_command, + }, +) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy