Skip to content

Commit

Permalink
Merge pull request #167 from nschloe/require-newer-numpy
Browse files Browse the repository at this point in the history
Require newer numpy
  • Loading branch information
nschloe committed Oct 22, 2021
2 parents ecafff1 + b163379 commit c2f3f8d
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 57 deletions.
45 changes: 23 additions & 22 deletions .github/workflows/ci.yml
Expand Up @@ -3,22 +3,22 @@ name: ci
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main

jobs:
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: actions/checkout@v2
- run: |
pip install sphinx
sphinx-build -M html docs/ build/
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: actions/checkout@v2
- run: |
pip install sphinx
sphinx-build -M html docs/ build/
lint:
runs-on: ubuntu-latest
Expand All @@ -34,17 +34,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
# vtk not available for 3.10 yet
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with:
lfs: true
- name: Test with tox
run: |
pip install tox
tox -- --cov meshplex --cov-report xml --cov-report term
- uses: codecov/codecov-action@v1
if: ${{ matrix.python-version == '3.9' }}
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with:
lfs: true
- name: Test with tox
run: |
pip install tox
tox -- --cov meshplex --cov-report xml --cov-report term
- uses: codecov/codecov-action@v1
if: ${{ matrix.python-version == '3.9' }}
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
@@ -1,16 +1,16 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.9.1
rev: 5.9.3
hooks:
- id: isort

- repo: https://github.com/python/black
rev: 21.6b0
- repo: https://github.com/psf/black
rev: 21.9b0
hooks:
- id: black
language_version: python3

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -26,6 +26,7 @@ meshplex is used in [optimesh](https://github.com/nschloe/optimesh) and
### Quickstart

meshplex can compute the following data:

```python
import meshplex

Expand Down Expand Up @@ -64,8 +65,11 @@ print(mesh.num_delaunay_violations)
# removes some cells
mesh.remove_cells([0])
```

For triangular meshes (`MeshTri`), meshplex also has some mesh manipulation routines:

<!--pytest-codeblocks:skip-->

```python
mesh.show() # show the mesh
mesh.angles # compute angles
Expand All @@ -81,9 +85,11 @@ For a documentation of all classes and functions, see
### Plotting

#### Triangles

<img src="https://nschloe.github.io/meshplex/pacman.png" width="30%">

<!--pytest-codeblocks:skip-->

```python
import meshplex

Expand All @@ -100,9 +106,11 @@ mesh.show(
```

#### Tetrahedra

<img src="https://nschloe.github.io/meshplex/tetra.png" width="30%">

<!--pytest-codeblocks:skip-->

```python
import numpy as np
import meshplex
Expand Down Expand Up @@ -142,11 +150,14 @@ mesh.show_cell(

meshplex is [available from the Python Package
Index](https://pypi.org/project/meshplex/), so simply type

```
pip install meshplex
```

to install.

### License

This software is published under the [GPLv3
license](https://www.gnu.org/licenses/gpl-3.0.en.html).
19 changes: 7 additions & 12 deletions docs/conf.py
Expand Up @@ -10,7 +10,8 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import pathlib
from configparser import ConfigParser

# import sys
# sys.path.insert(0, os.path.abspath('.'))
Expand All @@ -25,17 +26,11 @@
copyright = "2017-2021, Nico Schlömer"
author = "Nico Schlömer"

#
# https://packaging.python.org/guides/single-sourcing-package-version/
this_dir = os.path.abspath(os.path.dirname(__file__))
about = {}
about_file = os.path.join(this_dir, "..", "src", "meshplex", "__about__.py")
with open(about_file) as f:
exec(f.read(), about)
# The short X.Y version.
# version = ".".join(about["__version__"].split(".")[:2])
# The full version, including alpha/beta/rc tags.
release = about["__version__"]

this_dir = pathlib.Path(__file__).resolve().parent
p = ConfigParser()
p.read(this_dir / ".." / "setup.cfg")
release = p["metadata"]["version"]


# -- General configuration ---------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = meshplex
version = 0.16.5
version = 0.16.6
author = Nico Schlömer
author_email = nico.schloemer@gmail.com
description = Fast tools for simplex meshes
Expand All @@ -22,6 +22,7 @@ classifiers =
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Mathematics

Expand All @@ -30,9 +31,8 @@ package_dir =
=src
packages = find:
install_requires =
importlib_metadata;python_version<"3.8"
meshio >=4, <6
numpy >= 1.9
numpy >= 1.20.0
npx >= 0.0.7
python_requires = >=3.7

Expand Down
10 changes: 0 additions & 10 deletions src/meshplex/__about__.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/meshplex/__init__.py
@@ -1,12 +1,10 @@
from .__about__ import __version__
from ._exceptions import MeshplexError
from ._mesh import Mesh
from ._mesh_tetra import MeshTetra
from ._mesh_tri import MeshTri
from ._reader import from_meshio, read

__all__ = [
"__version__",
"Mesh",
"MeshTri",
"MeshTetra",
Expand Down
2 changes: 1 addition & 1 deletion src/meshplex/_mesh.py
Expand Up @@ -116,7 +116,7 @@ def __repr__(self):

# prevent overriding points without adapting the other mesh data
@property
def points(self):
def points(self) -> np.ndarray:
return self._points

@points.setter
Expand Down
4 changes: 3 additions & 1 deletion tests/test_io.py
Expand Up @@ -7,7 +7,9 @@


def test_io_2d():
vertices, cells = meshzoo.rectangle_tri((0.0, 0.0), (1.0, 1.0), 2)
vertices, cells = meshzoo.rectangle_tri(
np.linspace(0.0, 1.0, 3), np.linspace(0.0, 1.0, 3)
)
mesh = meshplex.MeshTri(vertices, cells)
# mesh = meshplex.read('pacman.vtu')
assert mesh.num_delaunay_violations == 0
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -4,7 +4,7 @@ isolated_build = True

[testenv]
deps =
meshzoo
meshzoo >= 0.9.0
pytest
pytest-cov
pytest-codeblocks
Expand Down

0 comments on commit c2f3f8d

Please sign in to comment.