Skip to content

Commit

Permalink
Fix and switch to ruff.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhale committed Mar 26, 2024
1 parent 42f370f commit 6d12b68
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 32 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,18 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
container: ghcr.io/fenics/dolfinx/dolfinx:v0.7.2
container: ghcr.io/fenics/dolfinx/dolfinx:nightly
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Flake8 checks
- name: ruff checks
run: |
python3 -m flake8 fenicsx_shells
cd demo && python3 -m flake8 . && cd ../
python3 -m flake8 test
- name: isort checks (non-blocking)
continue-on-error: true
run: |
python3 -m isort --check fenicsx_shells
python3 -m isort --check demo
python3 -m isort --check test
ruff check .
ruff format --check .
- name: Install FEniCSx-Shells
run: |
pip install scikit-build-core[pyproject] # TO REMOVE ONCE 0.8.0 RELEASED
python3 -m pip install --no-build-isolation --check-build-dependencies .
- name: Build documentation
Expand Down
11 changes: 5 additions & 6 deletions demo/demo_kirchhoff-love-clamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@
# We begin by importing the necessary functionality from DOLFINx, UFL and
# PETSc.

from mpi4py import MPI

import numpy as np

from basix.ufl import element, mixed_element
import dolfinx
import ufl
from dolfinx.fem import functionspace, dirichletbc
from basix.ufl import element, mixed_element
from dolfinx.fem import dirichletbc, functionspace
from dolfinx.fem.petsc import LinearProblem
from dolfinx.mesh import CellType, create_unit_square
from ufl import (FacetNormal, Identity, Measure,
grad, inner, sym, tr)

from mpi4py import MPI
from ufl import FacetNormal, Identity, Measure, grad, inner, sym, tr

# We then create a two-dimensional mesh of the mid-plane of the plate $\Omega =
# [0, 1] \times [0, 1]$.
Expand Down
11 changes: 5 additions & 6 deletions demo/demo_reissner-mindlin-clamped-tdnns.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,17 @@
# PETSc.

# +
from mpi4py import MPI

import numpy as np

from basix.ufl import element, mixed_element
import dolfinx
import ufl
from dolfinx.fem import Function, functionspace, dirichletbc
from basix.ufl import element, mixed_element
from dolfinx.fem import Function, dirichletbc, functionspace
from dolfinx.fem.petsc import LinearProblem
from dolfinx.mesh import CellType, create_unit_square
from ufl import (FacetNormal, Identity, Measure,
grad, inner, split, sym, tr)

from mpi4py import MPI
from ufl import FacetNormal, Identity, Measure, grad, inner, split, sym, tr

# -

Expand Down
10 changes: 5 additions & 5 deletions demo/demo_reissner-mindlin-clamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
# We begin by importing the necessary functionality from DOLFINx, UFL and
# PETSc.

from mpi4py import MPI

import numpy as np

from basix.ufl import element, mixed_element
import dolfinx
import ufl
from dolfinx.fem import Function, functionspace, dirichletbc
from basix.ufl import element, mixed_element
from dolfinx.fem import Function, dirichletbc, functionspace
from dolfinx.fem.petsc import LinearProblem
from dolfinx.io.utils import XDMFFile
from dolfinx.mesh import CellType, create_unit_square
from ufl import (dx, grad, inner, split, sym, tr)

from mpi4py import MPI
from ufl import dx, grad, inner, split, sym, tr

# We then create a two-dimensional mesh of the mid-plane of the plate $\Omega =
# [0, 1] \times [0, 1]$. `GhostMode.shared_facet` is required as the Form will
Expand Down
40 changes: 37 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,49 @@ build-backend = "scikit_build_core.build"

[project]
name = "fenicsx-shells"
version = "0.1.0.dev0"
version = "0.8.0.dev0"
description = "FEniCSx-Shells"
readme = "README.md"
requires-python = ">=3.8.0"
requires-python = ">=3.9.0"
license = { file = "COPYING.LESSER" }
authors = [
{ email = "[email protected]" },
{ name = "Jack S. Hale" },
]
dependencies = [
"fenics-dolfinx>=0.7.2,<0.8.0",
"fenics-dolfinx>=0.8.0.dev0,<0.9.0",
]

[tool.ruff]
line-length = 100
indent-width = 4

[tool.ruff.lint]
select = [
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"I", # isort - use standalone isort
"RUF", # Ruff-specific rules
"UP", # pyupgrade
"ICN", # flake8-import-conventions
"NPY", # numpy-specific rules
"FLY", # use f-string not static joins
]
ignore = ["UP007", "RUF012"]
allowed-confusables = ["σ"]

[tool.ruff.lint.isort]
known-first-party = ["basix", "dolfinx", "ffcx", "ufl"]
known-third-party = ["gmsh", "numba", "numpy", "pytest", "pyvista"]
section-order = [
"future",
"standard-library",
"mpi",
"third-party",
"first-party",
"local-folder",
]

[tool.ruff.lint.isort.sections]
"mpi" = ["mpi4py", "petsc4py"]

0 comments on commit 6d12b68

Please sign in to comment.