Repository: python-graphblas/python-graphblas (language: python)

Issue:
Add config (and optional pre-commit) for running pylint
Also, add a github action to run pre-commit.

There's a lot that `pylint` doesn't like about our code, and a lot about `pylint` that I don't like (by default).  Nevertheless, it can sometimes have helpful tips to improve code quality.

We don't enforce it's usage, because doing so would be cumbersome, and running it is pretty slow. I know some people really like to deveop against `pylint`, so let's add a baseline config to make this sane.


Discussion / hints:

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6c40305c1..df5683491 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -68,7 +68,7 @@ repos:
         files: ^(graphblas|docs)/
         args: ["--ignore-words-list=coo,ba"]
   - repo: https://github.com/charliermarsh/ruff-pre-commit
-    rev: v0.0.200
+    rev: v0.0.205
     hooks:
       - id: ruff
         args: ["--force-exclude"]


Test patch:
diff --git a/.github/workflows/test_and_build.yml b/.github/workflows/test_and_build.yml
index 3b3be91c7..a54084e34 100644
--- a/.github/workflows/test_and_build.yml
+++ b/.github/workflows/test_and_build.yml
@@ -52,37 +52,30 @@ jobs:
           miniforge-version: latest
           use-mamba: true
           python-version: ${{ matrix.cfg.pyver }}
-          channels: conda-forge,defaults
+          channels: conda-forge,nodefaults
           channel-priority: strict
           activate-environment: graphblas
           auto-activate-base: false
       - name: Update env
         run: |
-          mamba install -c conda-forge pytest coverage black flake8 \
-          coveralls=3.3.1 pytest-randomly flake8-comprehensions flake8-bugbear
+          mamba install pytest coverage coveralls=3.3.1 pytest-randomly black \
+            pandas numba scipy networkx cffi donfig pyyaml awkward
       - name: Build extension module
         run: |
-          mamba install -c conda-forge pandas numba scipy networkx cffi donfig pyyaml awkward
           if [[ ${{ matrix.cfg.sourcetype }} == "wheel" ]]; then
               pip install suitesparse-graphblas
           else
-              mamba install -c conda-forge "graphblas>=7.4.0"
+              mamba install "graphblas>=7.4.0"
           fi
           if [[ ${{ matrix.cfg.sourcetype }} == "source" ]]; then
               pip install --no-binary=all suitesparse-graphblas
           elif [[ ${{ matrix.cfg.sourcetype }} == "upstream" ]]; then
-              # I can't get pip install from git to work, so git clone instead.
-              # pip install git+https://github.com/GraphBLAS/python-suitesparse-graphblas.git@main#egg=suitesparse-graphblas
-              mamba install -c conda-forge cython
-              git clone --depth=1 https://github.com/GraphBLAS/python-suitesparse-graphblas.git ssgb
-              pushd ssgb
-              python setup.py install  # deprecated?
-              # pip install .  # doesn't work
-              popd
+              mamba install cython
+              pip install --no-deps git+https://github.com/GraphBLAS/python-suitesparse-graphblas.git@main#egg=suitesparse-graphblas
           elif [[ ${{ matrix.cfg.sourcetype }} == "conda-forge" ]]; then
-              mamba install -c conda-forge python-suitesparse-graphblas
+              mamba install python-suitesparse-graphblas
           fi
-          python setup.py develop --no-deps
+          pip install --no-deps -e .
       - name: Unit tests
         run: |
           coverage run --branch -m pytest ${{ matrix.cfg.testopts }} -v
@@ -114,10 +107,6 @@ jobs:
           coverage run -a --branch -m graphblas.core.infixmethods
           git diff --exit-code
           coverage xml
-      - name: Style Checks
-        run: |
-          flake8
-          black . --check --diff
       - name: Coverage
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -128,9 +117,21 @@ jobs:
           coveralls --service=github
       - name: codecov
         uses: codecov/codecov-action@v3
+      # Randomly test notebooks 1/3 of the time
+      - name: random number
+        uses: ddradar/choose-random-action@v2.0.2
+        id: rand
+        with:
+          contents: |
+            true
+            false
+          weights: |
+            1
+            2
       - name: Notebooks Execution check
+        if: ${{ steps.rand.outputs.selected == 'true' }}
         run: |
-          mamba install -c conda-forge matplotlib nbconvert jupyter 'ipython>=7'
+          mamba install matplotlib nbconvert jupyter 'ipython>=7'
           jupyter nbconvert --to notebook --execute notebooks/*ipynb
 
   finish:
@@ -138,16 +139,12 @@ jobs:
     if: always()
     runs-on: ubuntu-latest
     steps:
-      - name: Setup conda env
-        run: |
-          source "$CONDA/etc/profile.d/conda.sh"
-          conda config --set always_yes yes --set changeps1 no
-          conda update -q conda
-          conda create -n coveralls_final -c conda-forge python=3.9 coveralls=3.3.1
+      - uses: actions/setup-python@v4
+        with:
+          python-version: "3.10"
+      - run: python -m pip install --upgrade pip
+      - run: pip install coveralls
       - name: Coveralls Finished
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        run: |
-          source "$CONDA/etc/profile.d/conda.sh"
-          conda activate coveralls_final
-          coveralls --finish
+        run: coveralls --finish