Skip to content

Commit 873e107

Browse files
authored
Merge pull request #29 from NSLS2/add-energy-fly-exporter
xanes fly exporter
2 parents 75b5b21 + 567038a commit 873e107

12 files changed

Lines changed: 8790 additions & 114 deletions

.github/workflows/linting.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4.3.0
13+
- uses: actions/setup-python@v5.6.0
14+
- uses: pre-commit/action@v3.0.1

.github/workflows/publish-ghcr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Create and publish a Docker image
44
# Configures this workflow to run every time a change is pushed to the branch called `release`.
55
on:
66
push:
7-
branches: ['main']
7+
branches: ["main"]
88

99
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
1010
env:
@@ -49,7 +49,7 @@ jobs:
4949
push: true
5050
tags: ${{ steps.meta.outputs.tags }}
5151
labels: ${{ steps.meta.outputs.labels }}
52-
52+
5353
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
5454
- name: Generate artifact attestation
5555
uses: actions/attest-build-provenance@v3

.pre-commit-config.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
ci:
2+
autoupdate_commit_msg: "chore: update pre-commit hooks"
3+
autofix_commit_msg: "style: pre-commit fixes"
4+
5+
exclude: ^.cruft.json|.copier-answers.yml$
6+
7+
repos:
8+
- repo: https://github.com/adamchainz/blacken-docs
9+
rev: "1.19.1"
10+
hooks:
11+
- id: blacken-docs
12+
additional_dependencies: [black==24.*]
13+
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: "v5.0.0"
16+
hooks:
17+
- id: check-added-large-files
18+
- id: check-case-conflict
19+
- id: check-merge-conflict
20+
- id: check-symlinks
21+
- id: check-yaml
22+
- id: debug-statements
23+
- id: end-of-file-fixer
24+
- id: mixed-line-ending
25+
- id: name-tests-test
26+
args: ["--pytest-test-first"]
27+
- id: requirements-txt-fixer
28+
- id: trailing-whitespace
29+
30+
- repo: https://github.com/pre-commit/pygrep-hooks
31+
rev: "v1.10.0"
32+
hooks:
33+
- id: rst-backticks
34+
- id: rst-directive-colons
35+
- id: rst-inline-touching-normal
36+
37+
- repo: https://github.com/rbubley/mirrors-prettier
38+
rev: "v3.5.3"
39+
hooks:
40+
- id: prettier
41+
types_or: [yaml, markdown, html, css, scss, javascript, json]
42+
args: [--prose-wrap=always]
43+
44+
- repo: https://github.com/astral-sh/ruff-pre-commit
45+
rev: "v0.11.11"
46+
hooks:
47+
- id: ruff
48+
args: ["--fix", "--show-fixes"]
49+
- id: ruff-format
50+
51+
- repo: https://github.com/pre-commit/mirrors-mypy
52+
rev: "v1.15.0"
53+
hooks:
54+
- id: mypy
55+
files: src|tests
56+
args: []
57+
additional_dependencies:
58+
- pytest
59+
60+
- repo: https://github.com/codespell-project/codespell
61+
rev: "v2.4.1"
62+
hooks:
63+
- id: codespell
64+
additional_dependencies:
65+
- tomli; python_version<'3.11'
66+
exclude: "pixi.*"
67+
68+
- repo: https://github.com/shellcheck-py/shellcheck-py
69+
rev: "v0.10.0.1"
70+
hooks:
71+
- id: shellcheck
72+
73+
- repo: local
74+
hooks:
75+
- id: disallow-caps
76+
name: Disallow improper capitalization
77+
language: pygrep
78+
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
79+
exclude: .pre-commit-config.yaml
80+
81+
- repo: https://github.com/abravalheri/validate-pyproject
82+
rev: "v0.24.1"
83+
hooks:
84+
- id: validate-pyproject
85+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
86+
87+
- repo: https://github.com/python-jsonschema/check-jsonschema
88+
rev: "0.33.0"
89+
hooks:
90+
- id: check-dependabot
91+
- id: check-github-workflows
92+
- id: check-readthedocs

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
# SRX Workflows
22

33
Repository of workflows for the SRX beamline.
4+
5+
## Development
6+
7+
### Pre-commit
8+
9+
This project uses pre-commit to maintain code quality. To install and run
10+
pre-commit locally:
11+
12+
```bash
13+
# Install pre-commit hooks
14+
pixi run pre-commit install
15+
16+
# Run on all files
17+
pixi run pre-commit run --all-files
18+
19+
# Run on staged files only
20+
pixi run pre-commit run
21+
22+
# Run on files changed in your branch (compared to main)
23+
pixi run pre-commit run --from-ref main --to-ref HEAD
24+
```

data_validation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ def read_all_streams(uid, beamline_acronym):
2525

2626
@flow
2727
def data_validation(uid):
28-
read_all_streams(uid, beamline_acronym='srx')
29-
28+
read_all_streams(uid, beamline_acronym="srx")

end_of_run_workflow.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from prefect.blocks.system import Secret
66
from prefect.context import FlowRunContext
77

8-
from data_validation import data_validation
98
from xanes_exporter import xanes_exporter
109
from xrf_hdf5_exporter import xrf_hdf5_exporter
1110
from logscan import logscan
@@ -76,7 +75,6 @@ def log_completion():
7675
@flow
7776
@slack
7877
def end_of_run_workflow(stop_doc):
79-
8078
uid = stop_doc["run_start"]
8179

8280
# data_validation(uid, return_state=True)

logscan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def logscan_detailed(scanid):
6767
if "plan_name" in h.start:
6868
out_str += f"\t{h.start['plan_name']}"
6969
else:
70-
out_str += f"\tunknown scan"
70+
out_str += "\tunknown scan"
7171
out_str += "\n"
7272

7373
# Write to file

0 commit comments

Comments
 (0)