From 1a1e96710e1db83986e046337847c7deb3a6c86a Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Fri, 29 Mar 2024 10:40:02 -0600 Subject: [PATCH] give mac-os artifacts a name and include tarball (#36) * give mac-os artifacts a name and include tarball * test mac build * update pre-commit; move dependabot to monthly updates * disable env and permissions * build mac only on release --- .github/dependabot.yml | 4 +- .github/workflows/testing-and-deployment.yml | 6 ++- .pre-commit-config.yaml | 8 ++-- mapdl_archive/__init__.py | 1 + mapdl_archive/archive.py | 1 + mapdl_archive/cython/vtk_support.c | 2 +- mapdl_archive/elements.py | 1 + mapdl_archive/examples/__init__.py | 1 + mapdl_archive/examples/examples.py | 1 + mapdl_archive/mesh.py | 43 ++++++++++---------- setup.py | 1 + tests/test_archive.py | 1 + 12 files changed, 40 insertions(+), 30 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5273f1d..4d430fa 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,7 @@ updates: directory: "/requirements" # Location of package manifests insecure-external-code-execution: allow schedule: - interval: "daily" + interval: "monthly" labels: - "Maintenance" - "Dependencies" @@ -12,4 +12,4 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "monthly" diff --git a/.github/workflows/testing-and-deployment.yml b/.github/workflows/testing-and-deployment.yml index 43ad7d6..5fcbc06 100644 --- a/.github/workflows/testing-and-deployment.yml +++ b/.github/workflows/testing-and-deployment.yml @@ -104,6 +104,7 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: mapdl-archive-wheel-${{ matrix.os }} release: name: Release @@ -119,10 +120,11 @@ jobs: - uses: actions/download-artifact@v4 - name: Display structure of downloaded files run: ls -R - - name: Move wheels to dist + - name: Flatten directory structure run: | mkdir -p dist/ - find . -name "*.whl" -exec mv {} dist/ \; + find . -name '*.whl' -exec mv {} dist/ \; + find . -name '*.tar.gz' -exec mv {} dist/ \; - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - name: Create GitHub Release diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d1f1000..163767b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.9 + rev: v0.3.4 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -49,7 +49,7 @@ repos: exclude: "tests/" - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v17.0.6 + rev: v18.1.2 hooks: - id: clang-format files: | @@ -58,7 +58,7 @@ repos: )$ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.9.0 hooks: - id: mypy exclude: ^(doc/|tests) @@ -77,6 +77,6 @@ repos: exclude: '.*\.(cdb|rst|dat)$' - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.3 + rev: 0.28.0 hooks: - id: check-github-workflows diff --git a/mapdl_archive/__init__.py b/mapdl_archive/__init__.py index e669344..dc80500 100644 --- a/mapdl_archive/__init__.py +++ b/mapdl_archive/__init__.py @@ -1,4 +1,5 @@ """MAPDL archive reader.""" + from mapdl_archive import examples # noqa: F401 from mapdl_archive._version import __version__ # noqa: F401 from mapdl_archive.archive import ( # noqa: F401 diff --git a/mapdl_archive/archive.py b/mapdl_archive/archive.py index 5b62f66..6fbeb25 100644 --- a/mapdl_archive/archive.py +++ b/mapdl_archive/archive.py @@ -1,4 +1,5 @@ """Module to read MAPDL ASCII block formatted CDB files.""" + import io import logging import os diff --git a/mapdl_archive/cython/vtk_support.c b/mapdl_archive/cython/vtk_support.c index 4038591..9650b7d 100644 --- a/mapdl_archive/cython/vtk_support.c +++ b/mapdl_archive/cython/vtk_support.c @@ -562,7 +562,7 @@ int ans_to_vtk(const int nelem, const int *elem, const int *elem_off, add_line(build_offset, &elem[off], false); // should never reach here } // end of switch - } // end of loop + } // end of loop /* printf("Done\n"); */ diff --git a/mapdl_archive/elements.py b/mapdl_archive/elements.py index c784130..9646418 100644 --- a/mapdl_archive/elements.py +++ b/mapdl_archive/elements.py @@ -223,6 +223,7 @@ PLANE293 USER300 """ + from typing import List import numpy as np diff --git a/mapdl_archive/examples/__init__.py b/mapdl_archive/examples/__init__.py index 4264c23..ae34e0f 100644 --- a/mapdl_archive/examples/__init__.py +++ b/mapdl_archive/examples/__init__.py @@ -1,4 +1,5 @@ """Examples module.""" + from .examples import ( # noqa: F401 academic_rotor_archive_file, hexarchivefile, diff --git a/mapdl_archive/examples/examples.py b/mapdl_archive/examples/examples.py index 425c5e3..f332415 100644 --- a/mapdl_archive/examples/examples.py +++ b/mapdl_archive/examples/examples.py @@ -1,4 +1,5 @@ """Mapdl-archive example files.""" + import os # get location of this folder and the example files diff --git a/mapdl_archive/mesh.py b/mapdl_archive/mesh.py index eba3762..fd9d07e 100644 --- a/mapdl_archive/mesh.py +++ b/mapdl_archive/mesh.py @@ -1,4 +1,5 @@ """Contains the Mesh class used by Archive.""" + from pathlib import Path from typing import Dict, List, Optional, Tuple, Union, cast import warnings @@ -105,32 +106,32 @@ def __init__( keyopt: Dict[int, List[List[int]]] = {}, ): """Initialize the mesh.""" - self._etype: Optional[ - npt.NDArray[np.int32] - ] = None # internal element type reference + self._etype: Optional[npt.NDArray[np.int32]] = ( + None # internal element type reference + ) self._grid: Optional[UnstructuredGrid] = None self._surf_cache: Optional[PolyData] = None # cached external surface self._enum: Optional[npt.NDArray[np.int32]] = None # cached element numbering - self._etype_cache: Optional[ - npt.NDArray[np.int32] - ] = None # cached ansys ETYPE num - self._rcon: Optional[ - npt.NDArray[np.int32] - ] = None # ansys element real constant - self._mtype: Optional[ - npt.NDArray[np.int32] - ] = None # cached ansys material type - self._node_angles: Optional[ - npt.NDArray[np.float64] - ] = None # cached node angles - self._node_coord: Optional[ - npt.NDArray[np.float64] - ] = None # cached node coordinates + self._etype_cache: Optional[npt.NDArray[np.int32]] = ( + None # cached ansys ETYPE num + ) + self._rcon: Optional[npt.NDArray[np.int32]] = ( + None # ansys element real constant + ) + self._mtype: Optional[npt.NDArray[np.int32]] = ( + None # cached ansys material type + ) + self._node_angles: Optional[npt.NDArray[np.float64]] = ( + None # cached node angles + ) + self._node_coord: Optional[npt.NDArray[np.float64]] = ( + None # cached node coordinates + ) self._cached_elements: Optional[List[npt.NDArray[np.int32]]] = None self._secnum: Optional[npt.NDArray[np.int32]] = None # cached section number - self._esys: Optional[ - npt.NDArray[np.int32] - ] = None # cached element coordinate system + self._esys: Optional[npt.NDArray[np.int32]] = ( + None # cached element coordinate system + ) self._etype_id: Optional[npt.NDArray[np.int32]] = None # cached element type id # Always set on init diff --git a/setup.py b/setup.py index 819af84..946db57 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ """Installation file for mapdl_archive.""" + from io import open as io_open import os diff --git a/tests/test_archive.py b/tests/test_archive.py index 354626d..9261c85 100644 --- a/tests/test_archive.py +++ b/tests/test_archive.py @@ -1,4 +1,5 @@ """Test ``mapdl_archive/archive.py``.""" + import os import pathlib import sys