From 0a1b080f0626d8a4fa5d63a069228a94f323b167 Mon Sep 17 00:00:00 2001 From: Landung 'Don' Setiawan Date: Mon, 21 Apr 2025 11:55:19 -0700 Subject: [PATCH 1/4] fix: Fix pre-commit errors --- .github/workflows/codeql.yml | 79 ++++++++++++++++++------------------ .pre-commit-config.yaml | 4 +- docs/notebooks.ipynb | 8 ++-- pyproject.toml | 3 +- src/ssec_project/__init__.py | 2 +- 5 files changed, 47 insertions(+), 49 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 654c22a..caf489c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,11 +13,11 @@ name: "CodeQL Advanced" on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] schedule: - - cron: '33 17 * * 2' + - cron: "33 17 * * 2" jobs: analyze: @@ -27,7 +27,8 @@ jobs: # - https://gh.io/supported-runners-and-hardware-resources # - https://gh.io/using-larger-runners (GitHub.com only) # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + runs-on: + ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} permissions: # required for all workflows security-events: write @@ -43,8 +44,8 @@ jobs: fail-fast: false matrix: include: - - language: python - build-mode: none + - language: python + build-mode: none # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' # Use `c-cpp` to analyze code written in C, C++ or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both @@ -54,40 +55,40 @@ jobs: # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - queries: security-extended - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-extended + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ca2095..6eba086 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,8 +37,8 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" + - repo: https://github.com/rbubley/mirrors-prettier + rev: "v3.5.3" hooks: - id: prettier types_or: [yaml, markdown, html, css, scss, javascript, json] diff --git a/docs/notebooks.ipynb b/docs/notebooks.ipynb index ab3d3f0..53ca5ec 100644 --- a/docs/notebooks.ipynb +++ b/docs/notebooks.ipynb @@ -55,6 +55,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from matplotlib import cycler, rcParams\n", + "from matplotlib.lines import Line2D\n", "\n", "plt.ion()" ] @@ -66,17 +67,14 @@ "outputs": [], "source": [ "# Fixing random state for reproducibility\n", - "np.random.seed(19680801)\n", + "rng = np.random.default_rng(19680801)\n", "\n", "N = 10\n", - "data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)]\n", + "data = [np.logspace(0, 1, 100) + rng.standard_normal(100) + ii for ii in range(N)]\n", "data = np.array(data).T\n", "cmap = plt.cm.coolwarm\n", "rcParams[\"axes.prop_cycle\"] = cycler(color=cmap(np.linspace(0, 1, N)))\n", "\n", - "\n", - "from matplotlib.lines import Line2D\n", - "\n", "custom_lines = [\n", " Line2D([0], [0], color=cmap(0.0), lw=4),\n", " Line2D([0], [0], color=cmap(0.5), lw=4),\n", diff --git a/pyproject.toml b/pyproject.toml index 4ba53e2..ea6dcb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ minversion = "6.0" addopts = ["-vvv", "-ra", "--showlocals", "--strict-markers", "--strict-config"] xfail_strict = false filterwarnings = ["error"] -log_cli_level = "info" +log_cli_level = "INFO" testpaths = ["tests"] [tool.mypy] @@ -85,7 +85,6 @@ disallow_untyped_defs = true disallow_incomplete_defs = true [tool.ruff] -src = ["src"] exclude = ["tests/**", "testing.py"] line-length = 100 diff --git a/src/ssec_project/__init__.py b/src/ssec_project/__init__.py index 3d8a8a6..77e8c9a 100644 --- a/src/ssec_project/__init__.py +++ b/src/ssec_project/__init__.py @@ -1,5 +1,5 @@ from __future__ import annotations -from .version import version as __version__ # type: ignore[import-not-found] +from .version import version as __version__ __all__ = ["__version__"] From a07439ace213698fa23b625969a5898c2d50895a Mon Sep 17 00:00:00 2001 From: Don Setiawan Date: Mon, 21 Apr 2025 11:58:28 -0700 Subject: [PATCH 2/4] Update __init__.py --- src/ssec_project/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssec_project/__init__.py b/src/ssec_project/__init__.py index 77e8c9a..3d8a8a6 100644 --- a/src/ssec_project/__init__.py +++ b/src/ssec_project/__init__.py @@ -1,5 +1,5 @@ from __future__ import annotations -from .version import version as __version__ +from .version import version as __version__ # type: ignore[import-not-found] __all__ = ["__version__"] From 6625c5e091692d533b5124ebea4efa9f987c2f03 Mon Sep 17 00:00:00 2001 From: Landung 'Don' Setiawan Date: Mon, 21 Apr 2025 12:02:08 -0700 Subject: [PATCH 3/4] chore(deps): Update pre-commit versions --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6eba086..dae1246 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,14 +45,14 @@ repos: args: [--prose-wrap=always] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.7.2" + rev: "v0.11.5" hooks: - id: ruff args: ["--fix", "--show-fixes"] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.13.0" + rev: "v1.15.0" hooks: - id: mypy files: src|tests @@ -61,7 +61,7 @@ repos: - pytest - repo: https://github.com/codespell-project/codespell - rev: "v2.3.0" + rev: "v2.4.1" hooks: - id: codespell @@ -79,19 +79,19 @@ repos: exclude: .pre-commit-config.yaml - repo: https://github.com/abravalheri/validate-pyproject - rev: "v0.22" + rev: "v0.24.1" hooks: - id: validate-pyproject additional_dependencies: ["validate-pyproject-schema-store[all]"] - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.29.4" + rev: "0.33.0" hooks: - id: check-dependabot - id: check-github-workflows - id: check-readthedocs - repo: https://github.com/scientific-python/cookie - rev: "2024.08.19" + rev: "2025.01.22" hooks: - id: sp-repo-review From 468e9bcd3291d2026fe666ef18b7931d9ef0a920 Mon Sep 17 00:00:00 2001 From: Landung 'Don' Setiawan Date: Mon, 21 Apr 2025 12:04:55 -0700 Subject: [PATCH 4/4] chore(deps): Update codecov actions version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b3510f..7daa076 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,6 +61,6 @@ jobs: --cov-report=term --durations=20 - name: Upload coverage report - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }}