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/.github/workflows/flake8.yml b/.github/workflows/flake8.yml deleted file mode 100644 index 528bc64..0000000 --- a/.github/workflows/flake8.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Check Code Style - FLAKE8 - -on: [push, pull_request] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - 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 - run: | - flake8 diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..599d4cf --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,18 @@ +name: Check Code Style - RUFF + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install Dependencies + run: | + python -m pip install --upgrade pip setuptools numpy + pip install ruff + - name: Run ruff + run: ruff check . 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, 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__" +] 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