From 08beb39e64fa1f6c2fdf804eeac5ae9d90aa1a94 Mon Sep 17 00:00:00 2001 From: nisar Date: Wed, 2 Jul 2025 21:36:11 -0400 Subject: [PATCH 1/5] Replace Black and Flake8 with Ruff --- .flake8 | 12 ------------ requirements.txt | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index f9b52a9..0000000 --- a/.flake8 +++ /dev/null @@ -1,12 +0,0 @@ -[flake8] -exclude = - .git, - __pycache__, - build, - dist, - versioneer.py, - csxtools/doc/conf.py - *.ipynb_checkpoints, - -max-line-length = 140 -ignore = E203, W503 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 24ce15a..a6b1da2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ numpy +ruff>=0.4.0 From db3735f8ccf4e660a62beceba3e2b91367660dea Mon Sep 17 00:00:00 2001 From: nisar Date: Wed, 2 Jul 2025 22:02:53 -0400 Subject: [PATCH 2/5] replace .github/workflows/flake8.yml with .github/workflows/ruff.yml --- .github/workflows/{flake8.yml => ruff.yml} | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) rename .github/workflows/{flake8.yml => ruff.yml} (51%) diff --git a/.github/workflows/flake8.yml b/.github/workflows/ruff.yml similarity index 51% rename from .github/workflows/flake8.yml rename to .github/workflows/ruff.yml index 528bc64..1bcdd96 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/ruff.yml @@ -1,4 +1,4 @@ -name: Check Code Style - FLAKE8 +name: Check Code Style - RUFF on: [push, pull_request] @@ -12,12 +12,8 @@ jobs: python-version: "3.10" - name: Install Dependencies run: | - # These packages are installed in the base environment but may be older - # versions. Explicitly upgrade them because they often create - # installation problems if out of date. python -m pip install --upgrade pip setuptools numpy - - pip install flake8 - - name: Run flake8 + pip install ruff + - name: Run ruff run: | - flake8 + ruff . From 95f6ed7c9f8ae46d9649a40255e15f2ea808793c Mon Sep 17 00:00:00 2001 From: nisar Date: Wed, 2 Jul 2025 22:08:36 -0400 Subject: [PATCH 3/5] Bug fix in .github/workflows/ruff.yml --- .github/workflows/ruff.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 1bcdd96..599d4cf 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -15,5 +15,4 @@ jobs: python -m pip install --upgrade pip setuptools numpy pip install ruff - name: Run ruff - run: | - ruff . + run: ruff check . From 7e9ab6bc18a2b5c54e7d008b410264022b1f1f3a Mon Sep 17 00:00:00 2001 From: nisar Date: Thu, 3 Jul 2025 21:14:27 -0400 Subject: [PATCH 4/5] Update pyproject.toml to exclude 'examples' and other diectories like 'src' from Ruff checks --- pyproject.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 145d9bf..c058f1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,3 +6,12 @@ requires = [ "versioneer[toml]>=0.28" ] build-backend = "setuptools.build_meta" +[tool.ruff] +exclude = [ + "examples", + "doc", + "build", + "dist", + "csxtools.egg-info", + "__pycache__" +] From 753d44b33a028ebcb2a4879a1f9d8b15445fce9d Mon Sep 17 00:00:00 2001 From: nisar Date: Thu, 10 Jul 2025 11:39:47 -0400 Subject: [PATCH 5/5] fixed issue with method browse_3Darray in csxtools/helpers/fastccd.py --- csxtools/helpers/fastccd.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/csxtools/helpers/fastccd.py b/csxtools/helpers/fastccd.py index 30277ca..9e0df48 100644 --- a/csxtools/helpers/fastccd.py +++ b/csxtools/helpers/fastccd.py @@ -13,7 +13,7 @@ logger = logging.getLogger(__name__) -def browse_3Darray(res, title="Frame"): # , extra_scalar_dict=None): +def browse_3Darray(res, fig, ax, im, title="Frame"): # , extra_scalar_dict=None): """Widget for notebooks. Sliding bar to browse 3D python array. Must plot using subplots method with 1 axes. res : 3D array with the first element being interated @@ -21,24 +21,15 @@ def browse_3Darray(res, title="Frame"): # , extra_scalar_dict=None): """ N = len(res) - def view_image(i=0): + def view_image(i=0, fig = fig, ax = ax, im = im): im.set_data(res[i]) - # if extra_scalar_dict is not None: - # key = extra_scalr_dict.keys()[0] - # values = extra_scalar_dict.values() - - # if extra_scalar_dict is None: - # ax.set_title(f'{title} {i} {key} {values[i]}') - # else: ax.set_title(f"{title} {i}") fig.canvas.draw_idle() interact(view_image, i=(0, N - 1)) - # FCCD specific stuff starts here - def find_possible_darks( header, dark_gain,