2 个不稳定版本
0.1.0 | 2023年10月8日 |
---|---|
0.0.0 | 2022年4月9日 |
在 数学 中排名 455
1.5MB
39K SLoC
rene
在下文中,python
是 python3.8
或 pypy3.8
或任何更高版本(python3.9
,pypy3.9
等)的别名。
安装
安装最新的 pip
和 setuptools
软件包版本
python -m pip install --upgrade pip setuptools
用户
从 PyPI
仓库下载并安装最新稳定版本
python -m pip install --upgrade rene
开发者
从 GitHub
仓库下载最新版本
git clone https://github.com/lycantropos/rene.git
cd rene
安装
python setup.py install
使用
>>> from rene.exact import (Contour,
... Empty,
... Point,
... Polygon)
>>> square = Polygon(Contour([Point(0, 0), Point(4, 0), Point(4, 4),
... Point(0, 4)]),
... [])
>>> square == square
True
>>> square & square == square
True
>>> square | square == square
True
>>> square - square == Empty()
True
>>> square ^ square == Empty()
True
>>> len(square.border.vertices) == 4
True
>>> len(square.holes) == 0
True
>>> from rene.exact import ConstrainedDelaunayTriangulation
>>> (ConstrainedDelaunayTriangulation.from_polygon(square).triangles
... == [Contour([Point(0, 0), Point(4, 0), Point(0, 4)]),
... Contour([Point(0, 4), Point(4, 0), Point(4, 4)])])
True
>>> from rene import Location
>>> from rene.exact import Trapezoidation
>>> trapezoidation = Trapezoidation.from_polygon(square)
>>> all(vertex in trapezoidation for vertex in square.border.vertices)
True
>>> all(trapezoidation.locate(vertex) is Location.BOUNDARY
... for vertex in square.border.vertices)
True
开发
增加版本号
准备
安装 bump2version。
预发布
根据 semver 规范 选择要增加的版本号类别。
测试增加版本号
bump2version --dry-run --verbose $CATEGORY
其中 $CATEGORY
是目标版本号类别名称,可能的值有 patch
/minor
/major
。
增加版本号
bump2version --verbose $CATEGORY
这将设置版本为 major.minor.patch-alpha
。
发布
测试增加版本号
bump2version --dry-run --verbose release
增加版本号
bump2version --verbose release
这将设置版本为 major.minor.patch
。
运行测试
安装依赖项
python -m pip install -r requirements-tests.txt
纯
pytest
在 Docker
容器内
- 使用
CPython
docker-compose --file docker-compose.cpython.yml up
- 使用
PyPy
docker-compose --file docker-compose.pypy.yml up
Bash
脚本
-
使用
CPython
./run-tests.sh
或
./run-tests.sh cpython
-
使用
PyPy
./run-tests.sh pypy
PowerShell
脚本
- 使用
CPython
或.\run-tests.ps1
.\run-tests.ps1 cpython
- 使用
PyPy
.\run-tests.ps1 pypy
依赖项
~4–9.5MB
~87K SLoC