Skip to content

Commit

Permalink
Merge branch 'main' into 247-howto-busy-taxi-fly
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Feb 26, 2024
2 parents f9f2bd5 + 3dbce1d commit f58f575
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 691 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Set update schedule for GitHub Actions
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
110 changes: 64 additions & 46 deletions .github/workflows/unit-tests-pytest.yml → .github/workflows/code.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit Tests
name: CI

on:
# Triggers the workflow on push or pull request events but only for the main branch
Expand All @@ -17,29 +17,36 @@ defaults:
jobs:

lint:
name: Code style
name: Linting & Code style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Dependencies
- name: Install package
run: |
which python
which pip
set -vxeuo pipefail
python -m pip install --upgrade pip
pip install flake8
pip install ruff flake8
- name: Run flake8
run: |
flake8
test-matrix:
name: Python ${{ matrix.python-version }}
run: flake8

# # TODO: will replace flake8
# - name: Run ruff
# uses: davidslusser/actions_python_ruff@v1.0.0
# with:
# # src: "."
# # options: "--cov=src"
# pip_install_command: "pip install -e .[dev]"
# python_version: "3.11"

tests:
name: CI py${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: lint
strategy:
Expand All @@ -49,14 +56,17 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
# - "3.12" # 2023-Q4 wait for upstreams to be ready
max-parallel: 5

steps:
- name: Set time zone
run: echo "TZ=America/Chicago" >> "$GITHUB_ENV"

- name: Checkout the project from GitHub
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Diagnostics
run: |
Expand Down Expand Up @@ -129,6 +139,7 @@ jobs:
- name: Run Bluesky queueserver
run: |
set -vxeuo pipefail
conda env list
pushd ./bluesky/
bash ./qserver.sh run &
Expand All @@ -140,37 +151,44 @@ jobs:
- name: Run tests with pytest & coverage
run: |
set -vxeuo pipefail
coverage run --concurrency=thread --parallel-mode -m pytest -vvv .
coverage combine
coverage report --precision 3
# - name: Gather coverage data from matrix run
# shell: bash -l {0}
# run: |
# micromamba list coveralls
# which coveralls
# coveralls debug
# coveralls --service=github
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
# COVERALLS_PARALLEL: true

# # https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support
# coveralls:
# name: Report unit test coverage to coveralls
# needs: test-matrix
# runs-on: ubuntu-latest
# container: python:3-slim

# steps:
# - name: Gather coverage and report to Coveralls
# run: |
# echo "Finally!"
# pip3 install --upgrade coveralls
# # debug mode: output prepared json and reported files list to stdout
# # https://coveralls-python.readthedocs.io/en/latest/troubleshooting.html
# # coveralls debug
# coveralls --service=github --finish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python -m coverage report --precision 3
- name: Force Install coveralls by pip
shell: bash -l {0}
run: |
python -m pip install --force-reinstall coveralls
- name: Upload coverage data to coveralls.io
shell: bash -l {0}
run: |
set -vxeuo pipefail
python -m coveralls debug
python -m coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true

# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support
coveralls:
name: Report unit test coverage to coveralls
needs: tests
runs-on: ubuntu-latest
container: python:3-slim

steps:
- name: Gather coverage and report to Coveralls
run: |
set -vxeuo pipefail
echo "Finally!"
pip3 install --upgrade coveralls
# debug mode: output prepared json and reported files list to stdout
# https://coveralls-python.readthedocs.io/en/latest/troubleshooting.html
coveralls debug
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

16 changes: 13 additions & 3 deletions .github/workflows/pages.yml → .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ defaults:
jobs:

pages:

runs-on: ubuntu-20.04
name: Publish documentation
runs-on: ubuntu-latest

steps:

Expand All @@ -45,13 +45,23 @@ jobs:
- name: Set time zone
run: echo "TZ=America/Chicago" >> "$GITHUB_ENV"

- id: deployment
- name: Sphinx build
id: deployment
uses: sphinx-notes/pages@v3
with:
documentation_path: ./docs/source
publish: false
requirements_path: ./docs/requirements.txt

- name: Diagnostic
run: ls -lAFgh ${{ steps.deployment.outputs.artifact }}

- name: Upload Docs ZIP file as artifact
uses: actions/upload-artifact@v4
with:
name: bluesky_training-docs
path: ${{ steps.deployment.outputs.artifact }}

- uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event.inputs.deploy }}
with:
Expand Down
7 changes: 5 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ describe future plans.
1.0.3
******
release expected by 2024-02-01
release expected by 2024-04-01

1.0.2
******

release expected by 2023-12-31
release expected by 2024-03-01

New Features
------------
Expand All @@ -38,9 +38,12 @@ New Features

* ophyd-registry

* Build ``registry`` of all ophyd objects.

Maintenance
------------

* Drop the (unused now) *stdlogpj* package for configuring Python's *logging*.
* Environment for bluesky_2024_1.


Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017-2021, UChicago Argonne, LLC
Copyright (c) 2017-2024, UChicago Argonne, LLC

All Rights Reserved

Expand Down
5 changes: 3 additions & 2 deletions bluesky/environments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ The repository is: https://github.com/BCDA-APS/bluesky_training/

version | file
--- | ---
2023-3 (latest) | [`environment_2023_3.yml`](./environment_2023_3.yml)
2023-2 | [`environment_2023_2.yml`](./environment_2023_2.yml)
2024-1 (latest) | [`environment_2024_1.yml`](.//environment_2024_1.yml)
2023-3 | [`environment_2023_3.yml`](./environment_2023_3.yml)
2023-2 | [`environment_2023_2.yml`](./archive/environment_2023_2.yml)
2023-1 | [`environment_2023_1.yml`](./archive/environment_2023_1.yml)
2022_3 | [`environment_2022_3.yml`](./archive/environment_2022_3.yml)
2022_2 | [`environment_2022_2.yml`](./archive/environment_2022_2.yml)
Expand Down
2 changes: 1 addition & 1 deletion bluesky/environments/environment_2024_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies:
- qt =5

# --- general support packages
- apischema
- bitshuffle
- epics-base >=7.0.5
- h5py
Expand Down Expand Up @@ -91,7 +92,6 @@ dependencies:
- pymca
- pyRestTable
- spec2nexus
- stdlogpj
- xrayutilities

# --- packaging and publishing
Expand Down
5 changes: 5 additions & 0 deletions bluesky/instrument/framework/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
bp bps bpp
summarize_plan
np
registry
""".split()

import logging
Expand All @@ -31,6 +32,7 @@
from bluesky.utils import ts_msg_hook
from IPython import get_ipython
from ophyd.signal import EpicsSignalBase
from ophydregistry import Registry
import databroker
import ophyd
import warnings
Expand Down Expand Up @@ -117,6 +119,9 @@ def get_md_path():
connection_timeout=iconfig.get("PV_CONNECTION_TIMEOUT", TIMEOUT),
)

# Create a registry of ophyd devices
registry = Registry(auto_register=True)

_pv = iconfig.get("RUN_ENGINE_SCAN_ID_PV")
if _pv is None:
logger.info("Using RunEngine metadata for scan_id")
Expand Down
2 changes: 1 addition & 1 deletion bluesky/qserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ esac
# -----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: jemian@anl.gov
# :copyright: (c) 2017-2022, UChicago Argonne, LLC
# :copyright: (c) 2017-2024, UChicago Argonne, LLC
#
# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License.
#
Expand Down
5 changes: 2 additions & 3 deletions docs/source/howto/bluesky_cheat_sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,8 @@ If you are translating PyEpics code to Bluesky plans, consult this

In the working directory, the log files are written to a `./.logs` subdirectory.
There are two kinds of file, one that records user commands and the python
result, the other records items sent to the
[customized](https://github.com/prjemian/stdlogpj#example-directing-logs-to-a-specific-directory)
Python [logging](https://docs.python.org/3/library/logging.html) package.
result, the other records items sent to the Python
[logging](https://docs.python.org/3/library/logging.html) package.

In the IPython session, use the `!` to run a linux command:

Expand Down
5 changes: 2 additions & 3 deletions docs/source/instrument/describe_instrument.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,8 @@
"For diagnostic and general support, log files are created to record activity. In the working directory, the log files are written to a `./.logs` subdirectory.\n",
"\n",
"There are two kinds of file, one that records user commands and the python\n",
"result, the other records items sent to the\n",
"[customized](https://github.com/prjemian/stdlogpj#example-directing-logs-to-a-specific-directory)\n",
"Python [logging](https://docs.python.org/3/library/logging.html) package.\n",
"result, the other records items sent to the Python\n",
"[logging](https://docs.python.org/3/library/logging.html) package.\n",
"\n",
"In the IPython session, use the `!` to run a linux command:"
]
Expand Down
Loading

0 comments on commit f58f575

Please sign in to comment.