diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 25a67610ea..82b8c1dd23 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -6,7 +6,7 @@ on: jobs: call-workflow-dependabot-auto-merge: - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-dependabot-auto-merge.yml@7241532854727d993872b67fc761139b8438615b # v3.12.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-dependabot-auto-merge.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: write pull-requests: write diff --git a/.github/workflows/issue_to_jira.yml b/.github/workflows/issue_to_jira.yml index 97e6036337..02c8a79eb7 100644 --- a/.github/workflows/issue_to_jira.yml +++ b/.github/workflows/issue_to_jira.yml @@ -9,7 +9,7 @@ permissions: {} jobs: call-workflow-create-jira-issue: if: startsWith(github.repository, 'MiraGeoscience/') # run on the Mira repo only - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-jira-issue_to_jira.yml@7241532854727d993872b67fc761139b8438615b # v3.12.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-jira-issue_to_jira.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: read issues: write diff --git a/.github/workflows/pr_jira_actions.yml b/.github/workflows/pr_jira_actions.yml index e3eb46152c..40a70aff29 100644 --- a/.github/workflows/pr_jira_actions.yml +++ b/.github/workflows/pr_jira_actions.yml @@ -7,7 +7,7 @@ on: jobs: call-workflow-pr_jira_actions: if: github.event.action != 'edited' || github.event.changes.title != null - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-jira-pr_actions.yml@7241532854727d993872b67fc761139b8438615b # v3.12.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-jira-pr_actions.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: read pull-requests: write diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8210eb1093..7930cecf11 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -46,12 +46,12 @@ jobs: steps: - name: Checkout target repository source - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Setup Python env - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: '3.11' @@ -61,7 +61,7 @@ jobs: # Checkout PR branch. # TREAT THIS CODE AS MALICIOUS, DON'T RUN CODE FROM THIS BRANCH. - name: checkout pull request source - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ github.event.pull_request.head.sha }} path: pr_source @@ -83,12 +83,12 @@ jobs: steps: - name: Checkout target repository source - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Setup Python env - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: '3.11' @@ -98,13 +98,13 @@ jobs: # Checkout PR branch. # TREAT THIS CODE AS MALICIOUS, DON'T RUN CODE FROM THIS BRANCH. - name: checkout pull request source - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ github.event.pull_request.head.sha }} path: 'pr_source' persist-credentials: false - - uses: reviewdog/action-black@644053a260402bc4278a865906107bd8aef7fae8 # v3.22.4 + - uses: reviewdog/action-black@602e2f027fa4af7b40e7d1bf747c226dcebf8e10 # v3.26.0 with: workdir: 'pr_source' github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/python_deploy_dev.yml b/.github/workflows/python_deploy_dev.yml index 11beac4428..f060a16f15 100644 --- a/.github/workflows/python_deploy_dev.yml +++ b/.github/workflows/python_deploy_dev.yml @@ -14,7 +14,7 @@ concurrency: jobs: call-workflow-conda-publish: name: Publish development conda package on JFrog Artifactory - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_rattler_package.yml@b2de1e00a0be160d8cf6e14716825673070bf264 # v3.13.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_rattler_package.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: write with: @@ -29,7 +29,7 @@ jobs: JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} call-workflow-pypi-publish: name: Publish development pypi package (JFrog Artifactory) - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_pypi_package.yml@b2de1e00a0be160d8cf6e14716825673070bf264 # v3.13.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_pypi_package.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: write with: @@ -51,14 +51,14 @@ jobs: id-token: write steps: - name: Download build artifact - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: mira-simpeg-pip-package-build path: dist-download # Must be a direct step (not in a reusable workflow or composite action), see # https://docs.pypi.org/trusted-publishers/troubleshooting/#reusable-workflows-on-github - name: Publish package to TestPyPI - uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: packages-dir: dist-download/ repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index b2658c747b..eca538c687 100644 --- a/.github/workflows/python_deploy_prod.yml +++ b/.github/workflows/python_deploy_prod.yml @@ -41,7 +41,7 @@ jobs: name: Publish production Conda package on JFrog Artifactory needs: validate-release-tag if: ${{ github.event_name == 'release' || github.event.inputs.publish-conda == 'true' }} - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_conda_assets.yml@b2de1e00a0be160d8cf6e14716825673070bf264 # v3.13.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_conda_assets.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: write with: @@ -54,7 +54,7 @@ jobs: name: Publish production PyPI package (JFrog Artifactory) needs: validate-release-tag if: ${{ github.event_name == 'release' || github.event.inputs.publish-pypi == 'true' }} - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_pypi_assets.yml@b2de1e00a0be160d8cf6e14716825673070bf264 # v3.13.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_pypi_assets.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: write with: @@ -74,14 +74,14 @@ jobs: id-token: write steps: - name: Download release assets - uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-download_dist_release@b2de1e00a0be160d8cf6e14716825673070bf264 # v3.13.0 + uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-download_dist_release@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 with: release-tag: ${{ github.event.release.tag_name || github.ref_name }} github-token: ${{ secrets.GITHUB_TOKEN }} # Must be a direct step (not in a reusable workflow or composite action), see # https://docs.pypi.org/trusted-publishers/troubleshooting/#reusable-workflows-on-github - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: packages-dir: dist-download/ repository-url: https://upload.pypi.org/legacy/ diff --git a/.github/workflows/security_scan.yml b/.github/workflows/security_scan.yml index 69791c4179..2d11af0b0a 100644 --- a/.github/workflows/security_scan.yml +++ b/.github/workflows/security_scan.yml @@ -32,7 +32,7 @@ jobs: security-events: write contents: read actions: read - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-zizmor-advanced-security.yml@7241532854727d993872b67fc761139b8438615b # v3.12.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-zizmor-advanced-security.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 call-workflow-zizmor-advanced-security: name: Zizmor analysis (annotate) @@ -42,4 +42,4 @@ jobs: checks: write contents: read actions: read - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-zizmor-annotate.yml@7241532854727d993872b67fc761139b8438615b # v3.12.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-zizmor-annotate.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 diff --git a/.github/workflows/test-latest.yml b/.github/workflows/test-latest.yml index bbc116a9e9..8a1040e49c 100644 --- a/.github/workflows/test-latest.yml +++ b/.github/workflows/test-latest.yml @@ -54,7 +54,7 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Need to fetch more than the last commit so that setuptools-scm can # create the correct version string. If the number of commits since @@ -70,7 +70,7 @@ jobs: run: git fetch origin 'refs/tags/*:refs/tags/*' - name: Setup caching for conda packages - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/conda_pkgs_dir key: conda-${{ env.PYTHON }}-${{ hashFiles(env.ENVIRONMENT) }} diff --git a/.github/workflows/wip-status.yml b/.github/workflows/wip-status.yml index 7b10fb5e37..c021a1ba4e 100644 --- a/.github/workflows/wip-status.yml +++ b/.github/workflows/wip-status.yml @@ -6,7 +6,7 @@ on: jobs: call-workflow-wip-status: - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-wip-status.yml@7241532854727d993872b67fc761139b8438615b # v3.12.0 + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-wip-status.yml@edb72d7524d25db3b4eb976890eb6837a8eb39f8 # v4.0.1 permissions: contents: read statuses: write diff --git a/.github/workflows/zizmor-security-upstream.yml b/.github/workflows/zizmor-security-upstream.yml index df455e9a53..df77a30143 100644 --- a/.github/workflows/zizmor-security-upstream.yml +++ b/.github/workflows/zizmor-security-upstream.yml @@ -18,12 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 06f2f19caf..1b5f32a6e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/psf/black-pre-commit-mirror - rev: 26.3.1 + rev: 26.10.1 hooks: - id: black language_version: python3 - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.5.0 hooks: - id: flake8 language_version: python3 @@ -17,6 +17,6 @@ repos: - flake8-docstrings==1.7.0 - flake8-pyproject==1.2.3 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.16.6 + rev: v0.17.5 hooks: - id: ruff-check diff --git a/environment.yml b/environment.yml index b126c62178..fa0f0c4351 100644 --- a/environment.yml +++ b/environment.yml @@ -51,16 +51,17 @@ dependencies: # style checking - pre-commit - - black==26.3.1 - - flake8==7.0.0 + - black==26.10.1 + - flake8==7.5.0 - flake8-pyproject==1.2.3 - flake8-bugbear==23.12.2 - flake8-builtins==2.2.0 - flake8-mutable==1.2.0 - flake8-rst-docstrings==0.3.0 - flake8-docstrings==1.7.0 + - mypy=1.15.0 - zizmor # lint GitHub Actions workflows - - ruff + - ruff=0.17.5 # recommended - jupyter diff --git a/pyproject.toml b/pyproject.toml index b2cc10df22..83414e32ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ keywords = ["geophysics", "inverse problem"] dependencies = [ "discretize>=0.11", "geoana>=0.7.0", - "geoh5py>=0.13.0b1", + "geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@GA-9681", "libdlf", "matplotlib", "numpy>=1.22", @@ -66,15 +66,16 @@ all = [ "simpeg[dask,choclo,plotting,reporting,sklearn,pandas]" ] # all optional *runtime* dependencies (not related to development) style = [ - "black==26.3.1", - "flake8==7.0.0", + "black==26.10.1", + "flake8==7.5.0", "flake8-bugbear==23.12.2", "flake8-builtins==2.2.0", "flake8-mutable==1.2.0", "flake8-rst-docstrings==0.3.0", "flake8-docstrings==1.7.0", "flake8-pyproject==1.2.3", - "ruff==0.16.6", + "mypy==1.15.0", + "ruff==0.17.5", ] docs = [ "sphinx", @@ -138,7 +139,7 @@ exclude_also = [ directory = "coverage_html_report" [tool.black] -required-version = '26.3.1' +required-version = '26.10.1' target-version = ["py312", "py313", "py314"] diff --git a/recipe.yaml b/recipe.yaml index a73bb70df3..59edb82cc1 100644 --- a/recipe.yaml +++ b/recipe.yaml @@ -27,12 +27,12 @@ requirements: host: - python ${{ python_min }}.* - setuptools >=64 - - setuptools_scm >=8 + - setuptools_scm >=9.2.0,<10.0 - pip run: - python >=${{ python_min }} # Mira packages - - geoh5py >=0.13.0b1, 0.13.* + - geoh5py >=0.14.0a2.dev209 # direct dependencies - dask-core * - discretize >=0.11 diff --git a/simpeg/directives/_directives.py b/simpeg/directives/_directives.py index 38fd60bf03..c5414a5297 100644 --- a/simpeg/directives/_directives.py +++ b/simpeg/directives/_directives.py @@ -2826,14 +2826,17 @@ def parse_by_nested_levels( Replace leaf elements of `nesting` with values from `values` (in order). Assumes the number of leaf positions equals len(values). - Parameters: + Parameters + ---------- - nesting: arbitrarily nested list structure; leaves are non-list values - values: flat iterable whose values will fill the leaves in order - Returns: + Returns + ------- - A new nested structure with leaves replaced by values from `values`. - Raises: + Raises + ------ - ValueError if `values` has fewer or more elements than required by `nesting`. """ indices = np.arange(len(self.invProb.dmisfit.objfcts)) diff --git a/simpeg/maps.py b/simpeg/maps.py index e2ebdd6699..4a9af050b6 100644 --- a/simpeg/maps.py +++ b/simpeg/maps.py @@ -3389,7 +3389,7 @@ def valInactive(self, value): @property def indActive(self): - """ + """Boolean mask of active cells. Returns ------- @@ -6137,7 +6137,8 @@ def __init__( enforce_active=True, **kwargs, ): - """ + """Map values from a global mesh to a local mesh. + Parameters ---------- global_mesh : discretize.TreeMesh diff --git a/simpeg/utils/pgi_utils.py b/simpeg/utils/pgi_utils.py index ed9df76a12..5c5dd87d1a 100644 --- a/simpeg/utils/pgi_utils.py +++ b/simpeg/utils/pgi_utils.py @@ -335,7 +335,9 @@ def _initialize_parameters(self, X, random_state, xp=None): warnings.simplefilter("ignore") label = ( KMeans( - n_clusters=self.n_components, n_init=1, random_state=random_state + n_clusters=self.n_components, + n_init=1, + random_state=random_state, ) .fit(X, sample_weight=self.cell_volumes) .labels_ diff --git a/tutorials/08-tdem/plot_inv_3_tem_3d.py b/tutorials/08-tdem/plot_inv_3_tem_3d.py index 838a5a9889..5a53890cd3 100644 --- a/tutorials/08-tdem/plot_inv_3_tem_3d.py +++ b/tutorials/08-tdem/plot_inv_3_tem_3d.py @@ -30,8 +30,7 @@ from discretize import TreeMesh from discretize.utils import mkvc, refine_tree_xyz -from SimPEG import dask -from SimPEG.utils import plot2Ddata, surface2ind_topo, model_builder +from SimPEG.utils import surface2ind_topo, model_builder from SimPEG import ( data, data_misfit, @@ -158,7 +157,7 @@ # Each unique location defines a new transmitter value_sortings = [] rx_counter = 0 -for ii in range(1): +for _ in range(1): nrx = receiver_locations.shape[0] # Here we define receivers that measure the h-field in A/m dbzdt_receiver = tdem.receivers.PointMagneticFluxTimeDerivative(