From 34e1442692ffec60d7d76beec0943f8caaab8054 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Fri, 9 Feb 2024 12:10:38 -0500 Subject: [PATCH] Squashed commit of the following: commit 5d8457c4495491490ed220564e1002284f0a9215 Author: David Meyer Date: Fri Feb 9 12:09:00 2024 -0500 Merge pull request #112 from dihm/setuptools_scm_fix Ensure setuptools_scm always uses `release-branch-semver`. commit 03c7e19c7afa35fc088212907f5fbb714007162a Author: David Meyer Date: Fri Feb 9 12:05:59 2024 -0500 Merge pull request #113 from dihm/update_workflow Update workflow pins to upgrade node.js to 20. commit 0ab9b30678e4bc5582c791e67659618b30ad6211 Author: David Meyer Date: Thu Jan 18 20:59:22 2024 -0500 Merge pull request #111 from dihm/rtd_build Modernize RTD build commit 00ffd6c498178e11a7c8fa275632543126313db9 Author: David Meyer Date: Thu Oct 12 16:17:57 2023 -0400 Merge pull request #110 from dihm/get_shot_globals_deprecation Get shot globals deprecation --- .github/workflows/release.yml | 20 ++++++++++---------- docs/source/conf.py | 22 +++------------------- pyproject.toml | 4 +++- readthedocs.yaml | 10 +++++++--- runmanager/__init__.py | 30 ++++++++++++------------------ runmanager/__version__.py | 2 +- setup.cfg | 10 ++++------ setup.py | 2 +- 8 files changed, 41 insertions(+), 59 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0949e49..802361b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,7 +64,7 @@ jobs: if: github.repository == 'labscript-suite/runmanager' && (github.event_name != 'create' || github.event.ref_type != 'branch') steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -73,7 +73,7 @@ jobs: run: git tag -d $(git tag --points-at HEAD) - name: Install Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: ${{ matrix.arch }} @@ -93,7 +93,7 @@ jobs: - name: Upload Artifact if: strategy.job-index == 0 || (env.PURE == 'false' && runner.os != 'Linux') - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: dist path: ./dist @@ -111,7 +111,7 @@ jobs: - name: Install Miniconda if: matrix.conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: auto-update-conda: true python-version: ${{ matrix.python }} @@ -140,7 +140,7 @@ jobs: - name: Upload Artifact if: matrix.conda - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: conda_packages path: ./conda_packages @@ -153,7 +153,7 @@ jobs: steps: - name: Checkout if: env.PURE == 'false' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -170,7 +170,7 @@ jobs: - name: Upload Artifact if: env.PURE == 'false' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: dist path: dist/*manylinux*.whl @@ -182,13 +182,13 @@ jobs: steps: - name: Download Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: dist path: ./dist - name: Download Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: conda_packages path: ./conda_packages @@ -226,7 +226,7 @@ jobs: password: ${{ secrets.pypi }} - name: Install Miniconda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: auto-update-conda: true diff --git a/docs/source/conf.py b/docs/source/conf.py index 94eefb4..1ac2726 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,8 +13,6 @@ import copy import os from pathlib import Path -from m2r import MdInclude -from recommonmark.transform import AutoStructify from jinja2 import FileSystemLoader, Environment try: import importlib.metadata as importlib_metadata @@ -51,7 +49,7 @@ "sphinx.ext.todo", "sphinx.ext.viewcode", "sphinx_rtd_theme", - "recommonmark", + "myst_parser", ] autodoc_typehints = 'description' @@ -108,6 +106,7 @@ def set_process_name(self,*args,**kwargs): # Prefix each autosectionlabel with the name of the document it is in and a colon autosectionlabel_prefix_document = True +myst_heading_anchors = 2 # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -246,23 +245,8 @@ def set_process_name(self,*args,**kwargs): # Customize the html_theme html_theme_options = {'navigation_depth': 3} -# Use m2r only for mdinclude and recommonmark for everything else -# https://github.com/readthedocs/recommonmark/issues/191#issuecomment-622369992 def setup(app): - config = { - # 'url_resolver': lambda url: github_doc_root + url, - 'auto_toc_tree_section': 'Contents', - 'enable_eval_rst': True, - } - app.add_config_value('recommonmark_config', config, True) - app.add_transform(AutoStructify) - - # from m2r to make `mdinclude` work - app.add_config_value('no_underscore_emphasis', False, 'env') - app.add_config_value('m2r_parse_relative_links', False, 'env') - app.add_config_value('m2r_anonymous_references', False, 'env') - app.add_config_value('m2r_disable_inline_math', False, 'env') - app.add_directive('mdinclude', MdInclude) + app.add_css_file('custom.css') # generate the components.rst file dynamically so it points to stable/latest diff --git a/pyproject.toml b/pyproject.toml index e6ca9c7..3a61336 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,5 @@ [build-system] -requires = ["setuptools", "wheel", "setuptools_scm"] +requires = ["setuptools>=64", "wheel", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] \ No newline at end of file diff --git a/readthedocs.yaml b/readthedocs.yaml index 35084d6..4f8b68e 100644 --- a/readthedocs.yaml +++ b/readthedocs.yaml @@ -4,6 +4,12 @@ # Required version: 2 +# Set build environment options +build: + os: ubuntu-22.04 + tools: + python: "3.11" + # Build documentation in the docs/ directory with Sphinx sphinx: builder: dirhtml @@ -15,13 +21,11 @@ formats: - pdf - epub -# Optionally set the version of Python and requirements required to build your docs +# Optionally set the requirements required to build your docs python: - version: 3.7 install: - method: pip path: . extra_requirements: - docs - system_packages: true \ No newline at end of file diff --git a/runmanager/__init__.py b/runmanager/__init__.py index c2bb430..bb81b81 100644 --- a/runmanager/__init__.py +++ b/runmanager/__init__.py @@ -25,6 +25,7 @@ import json import tokenize import io +import warnings import labscript_utils.h5_lock import h5py @@ -32,6 +33,7 @@ from labscript_utils.ls_zprocess import ProcessTree, zmq_push_multipart from labscript_utils.labconfig import LabConfig +import labscript_utils.shot_utils process_tree = ProcessTree.instance() from .__version__ import __version__ @@ -915,24 +917,16 @@ def compile_labscript_with_globals_files_async(labscript_file, globals_files, ou def get_shot_globals(filepath): """Returns the evaluated globals for a shot, for use by labscript or lyse. Simple dictionary access as in dict(h5py.File(filepath).attrs) would be fine - except we want to apply some hacks, so it's best to do that in one place.""" - params = {} - with h5py.File(filepath, 'r') as f: - for name, value in f['globals'].attrs.items(): - # Convert numpy bools to normal bools: - if isinstance(value, np.bool_): - value = bool(value) - # Convert null HDF references to None: - if isinstance(value, h5py.Reference) and not value: - value = None - # Convert numpy strings to Python ones. - # DEPRECATED, for backward compat with old files. - if isinstance(value, np.str_): - value = str(value) - if isinstance(value, bytes): - value = value.decode() - params[name] = value - return params + except we want to apply some hacks, so it's best to do that in one place. + + Deprecated: use identical function `labscript_utils.shot_utils.get_shot_globals` + """ + + warnings.warn( + FutureWarning("get_shot_globals has moved to labscript_utils.shot_utils. " + "Please update your code to import it from there.")) + + return labscript_utils.shot_utils.get_shot_globals(filepath) def dict_diff(dict1, dict2): diff --git a/runmanager/__version__.py b/runmanager/__version__.py index 414c4b3..8f8b282 100644 --- a/runmanager/__version__.py +++ b/runmanager/__version__.py @@ -6,7 +6,7 @@ import importlib_metadata VERSION_SCHEME = { - "version_scheme": os.getenv("SCM_VERSION_SCHEME", "guess-next-dev"), + "version_scheme": os.getenv("SCM_VERSION_SCHEME", "release-branch-semver"), "local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"), } diff --git a/setup.cfg b/setup.cfg index c25e3e5..98dc2dc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ install_requires = desktop-app>=0.1.2 importlib_metadata labscript>=3.0.0 - labscript_utils>=3.0.0 + labscript_utils>=3.3.0 pandas>=0.13 qtutils>=2.2.2 matplotlib @@ -46,8 +46,6 @@ gui_scripts = pyqt = PyQt5 docs = PyQt5 - Sphinx==4.4.0 - sphinx-rtd-theme==0.5.2 - recommonmark==0.6.0 - m2r==0.2.1 - mistune<2.0.0 + Sphinx==7.2.6 + sphinx-rtd-theme==2.0.0 + myst_parser==2.0.0 diff --git a/setup.py b/setup.py index 12b22ca..1ff17d3 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup VERSION_SCHEME = { - "version_scheme": os.getenv("SCM_VERSION_SCHEME", "guess-next-dev"), + "version_scheme": os.getenv("SCM_VERSION_SCHEME", "release-branch-semver"), "local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"), }