Skip to content

Commit

Permalink
Merge branch 'main' into tkoyama010-patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 authored Dec 22, 2024
2 parents 5f9d9f1 + 535f226 commit e70cda7
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 97 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Pull Request Labeler"
on:
pull_request_target:
pull_request:
types: [opened, reopened]

jobs:
Expand All @@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
31 changes: 7 additions & 24 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
workflow_dispatch:
pull_request:
push:
tags:
- "*"
branches:
- main
- "release/*"
permissions:
id-token: write
jobs:
build-n-publish:
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install packages
run: >
sudo apt -y install
libgl1-mesa-glx
xvfb
python-tk
libglu1
libxcursor-dev
libxft2
libxinerama1
libfltk1.3-dev
libfreetype6-dev
libgl1-mesa-dev
libocct-foundation-dev
libocct-data-exchange-dev
run: |
for i in $(cat packages.txt); do sudo apt-get install $i; done
- name: Install pypa/build
run: >-
python3 -m
Expand All @@ -48,7 +34,4 @@ jobs:
--wheel
--outdir dist/
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/testing-and-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 2
persist-credentials: false

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-pr-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Automatically update PR
uses: adRise/update-pr-branch@v0.9.0
uses: adRise/update-pr-branch@v0.9.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: "main"
Expand Down
27 changes: 17 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ ci:
autoupdate_schedule: weekly
repos:
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.18.0
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
rev: 0.30.0
hooks:
- id: check-github-workflows
- id: check-dependabot
Expand All @@ -20,9 +20,9 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: ["-L", ""]
args: ["-L", "socio-economic"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
files: src
Expand All @@ -43,7 +43,7 @@ repos:
"--no-strict-optional",
]
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.3
rev: v3.4.2
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json, toml]
Expand All @@ -64,7 +64,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
rev: v0.8.3
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -73,8 +73,14 @@ repos:
rev: 2024.08.19
hooks:
- id: sp-repo-review
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
# See options: https://taplo.tamasfe.dev/configuration/formatter-options.html
args: [--option, "reorder_arrays=true", --option, "reorder_keys=true"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -90,7 +96,8 @@ repos:
args: [--branch, main]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v0.8.0
hooks:
- id: toml-sort-fix
- id: zizmor
69 changes: 45 additions & 24 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# Contributor Covenant Code of Conduct

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Our Pledge](#our-pledge)
- [Our Standards](#our-standards)
- [Enforcement Responsibilities](#enforcement-responsibilities)
- [Scope](#scope)
- [Enforcement](#enforcement)
- [Enforcement Guidelines](#enforcement-guidelines)
- [1. Correction](#1-correction)
- [2. Warning](#2-warning)
- [3. Temporary Ban](#3-temporary-ban)
- [4. Permanent Ban](#4-permanent-ban)
- [Attribution](#attribution)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
Expand All @@ -22,17 +39,17 @@ community include:
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

Expand All @@ -52,7 +69,7 @@ decisions when appropriate.

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

Expand Down Expand Up @@ -82,15 +99,15 @@ behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.
**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

Expand All @@ -109,20 +126,24 @@ Violating these terms may lead to a permanent ban.
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.
**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

[homepage]: https://www.contributor-covenant.org
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[![Documentation Status](https://readthedocs.org/projects/scikit-gmsh/badge/?version=latest)](https://scikit-gmsh.readthedocs.io/en/latest/?badge=latest)
[![GitHub Repo stars](https://img.shields.io/github/stars/pyvista/scikit-gmsh)](https://github.com/pyvista/scikit-gmsh/stargazers)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

The `scikit-gmsh` package provides a simple interface to:

Expand Down
51 changes: 51 additions & 0 deletions examples/quad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
r"""
Quad geometry example
---------------------
Quad geometry example.
"""

from __future__ import annotations

from pathlib import Path
import subprocess
from typing import Optional

import pyvista as pv
import shapely


class Delaunay2D:
"""Delaunay2D class."""

def __init__(self, shell: shapely.Polygon, holes: Optional[list[shapely.Polygon]] = None) -> None:
"""Create a Delaunay2D object."""
self.shell = shapely.Polygon(shell)
self.holes = [shapely.Polygon(hole) for hole in holes] if holes else []
self._generate_mesh()

def _generate_mesh(self) -> None:
cell_size = 0.05
with Path("quad.geo").open("w") as f:
for linearring in [self.shell.exterior, *list(self.shell.interiors), *self.holes]:
coords = linearring.coords[:-1].copy()
for i, coord in enumerate(coords):
x = coord[0]
y = coord[1]
z = coord[2]
f.write("Point(" + str(i + 1) + ") = {" + str(x) + "," + str(y) + "," + str(z) + "," + str(cell_size) + "};\n")
for i, _ in enumerate(coords[:-1]):
f.write("Line(" + str(i + 1) + ") = {" + str(i + 1) + ", " + str(i + 2) + "};\n")
f.write("Line(" + str(len(coords)) + ") = {" + str(len(coords)) + ", 1};\n")
f.write("Line Loop(1) = {")
for i in range(len(coords) - 1):
f.write(str(i + 1) + ", ")
f.write(str(len(coords)) + "};\n")
f.write("Plane Surface(1) = {1};\n")
subprocess.run(["gmsh", "quad.geo", "-2", "-o", "quad.vtk"], check=False) # noqa: S603, S607
self.mesh = pv.read("quad.vtk")


alg = Delaunay2D([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)])
alg.mesh.plot(show_edges=True, color="w", cpos="xy")
3 changes: 0 additions & 3 deletions packages.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
libfltk1.3-dev
libfreetype6-dev
libgl1-mesa-dev
libgl1-mesa-glx
libglu1
libocct-data-exchange-dev
libocct-foundation-dev
libxcursor-dev
libxft2
libxinerama1
python-tk
xvfb
Loading

0 comments on commit e70cda7

Please sign in to comment.