diff --git a/.bumpversion.toml b/.bumpversion.toml index ecf2c06..b31eb36 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -1,5 +1,5 @@ [tool.bumpversion] -current_version = "0.4.4" +current_version = "0.4.5" parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)(\\-(?P[a-z]+))?" serialize = [ "{major}.{minor}.{patch}-{release}", diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..202f6d6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,16 @@ +{ + "name": "pode", + "image": "python:3.14-bookworm", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": {}, + "ghcr.io/devcontainers-extra/features/poetry:2": { + "version": "2.3.1" + } + }, + "workspaceFolder": "/opt/pode", + "workspaceMount": "source=${localWorkspaceFolder},target=/opt/pode,type=bind,consistency=cached", + "runArgs": ["--runtime=runc"], + "onCreateCommand": ". /opt/pode/.devcontainer/setup_user.sh", + "postCreateCommand": "poetry config virtualenvs.create false && poetry install --with dev --no-root", + "remoteUser": "${localEnv:USER}" +} diff --git a/.devcontainer/setup_user.sh b/.devcontainer/setup_user.sh new file mode 100644 index 0000000..47b28e7 --- /dev/null +++ b/.devcontainer/setup_user.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -eux + +uid=$(stat -c '%u' "$(pwd)") +gid=$(stat -c '%g' "$(pwd)") +current_user=$(whoami) + +if [ "$gid" -ne 1000 ]; then + sudo groupadd -g "$gid" hostgroup + if [ "$uid" -ne 1000 ]; then + sudo usermod -u "$uid" -g hostgroup "$current_user" + else + sudo usermod -g hostgroup "$current_user" + fi +elif [ "$uid" -ne 1000 ]; then + sudo usermod -u "$uid" "$current_user" +fi diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 5cdebff..6bb3cb1 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -11,28 +11,19 @@ on: jobs: test: name: 'Test' - runs-on: ${{ matrix.platform.os }} + runs-on: ${{ matrix.os }} strategy: matrix: - python_version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - platform: [ - { - os: 'macos-latest', - python_architecture: 'x64' - }, - { - os: 'ubuntu-latest', - python_architecture: 'x64' - }, - { - os: 'windows-latest', - python_architecture: 'x64' - }, - { - os: 'windows-latest', + python_version: ['3.10', '3.11', '3.12', '3.13', '3.14'] + os: ['macos-latest', 'ubuntu-latest', 'windows-latest'] + python_architecture: ['x64', 'x86'] + exclude: + - os: 'macos-latest' python_architecture: 'x86' - }, - ] + - os: 'ubuntu-latest' + python_architecture: 'x86' + - os: 'macos-latest' + python_version: '3.10' steps: - name: 'Checkout' uses: actions/checkout@v3 @@ -42,13 +33,13 @@ jobs: uses: actions/setup-python@v3 with: python-version: ${{ matrix.python_version }} - architecture: ${{ matrix.platform.python_architecture }} + architecture: ${{ matrix.python_architecture }} - name: 'Install packaging tools' run: python -m pip install -U pip setuptools - name: 'Install coverage dependencies' run: python -m pip install -U coverage - name: 'Install Poetry' - run: python -m pip install poetry==1.3.1 + run: python -m pip install poetry==2.1.4 - name: 'Turn off virtual environment of Poetry' run: poetry config virtualenvs.create false - name: 'Install dependencies' diff --git a/Dockerfile b/Dockerfile index 3f291b8..3ad90e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,8 @@ ARG PYTHON_IMAGE_VERSION +ARG IMAGE_TYPE -FROM python:${PYTHON_IMAGE_VERSION} - +FROM python:${PYTHON_IMAGE_VERSION} AS base ARG POETRY_VERSION -ARG DEV_IMAGE WORKDIR /opt/pode @@ -15,11 +14,10 @@ COPY tests/ tests/ COPY pode/ pode/ COPY pyproject.toml . -RUN if [ "${DEV_IMAGE}" = "true" ]; then \ - poetry install; \ - elif [ "${DEV_IMAGE}" = "false" ]; then \ - poetry install --without dev; \ - else \ - echo "Invalid value specified for DEV_IMAGE: '${DEV_IMAGE}'"; \ - exit 1; \ - fi +FROM base AS prod +RUN poetry install + +FROM base AS dev +RUN poetry install --with dev + +FROM ${IMAGE_TYPE} diff --git a/README.md b/README.md index de2485a..2067d65 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,10 @@ pode =========== -[![](https://codecov.io/gh/LostFan123/pode/branch/master/graph/badge.svg)](https://codecov.io/gh/LostFan123/pode "Codecov") -[![](https://img.shields.io/github/license/LostFan123/pode.svg)](https://github.com/LostFan123/pode/blob/master/LICENSE "License") +[![](https://github.com/GeorgySk/pode/workflows/CI/badge.svg)](https://github.com/GeorgySk/pode/actions/workflows/ci.yml "Github Actions") +[![](https://codecov.io/gh/GeorgySk/gon/branch/master/graph/badge.svg)](https://codecov.io/gh/GeorgySk/pode "Codecov") +[![](https://readthedocs.org/projects/pode/badge/?version=latest)](https://pode.readthedocs.io/en/latest "Documentation") +[![](https://img.shields.io/github/license/GeorgySk/pode.svg)](https://github.com/GeorgySk/pode/blob/master/LICENSE "License") [![](https://badge.fury.io/py/pode.svg)](https://badge.fury.io/py/pode "PyPI") Summary diff --git a/compose.yaml b/compose.yaml index 785fddc..4c979f3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,5 +1,3 @@ -version: '3' - services: pode: build: @@ -8,7 +6,7 @@ services: - PYTHON_IMAGE_VERSION=${PYTHON_IMAGE_VERSION} - POETRY_VERSION=${POETRY_VERSION} - DEV_IMAGE=${DEV_IMAGE} - image: georgysk/pode:0.4.4 + image: georgysk/pode:0.4.5 volumes: - .:/opt/pode stdin_open: true diff --git a/pode/__init__.py b/pode/__init__.py index 85900c6..fddee48 100644 --- a/pode/__init__.py +++ b/pode/__init__.py @@ -1,5 +1,5 @@ """Polygon decomposition""" -__version__ = '0.4.4' +__version__ = '0.4.5' from .pode import (divide, Contour, diff --git a/pyproject.toml b/pyproject.toml index 5d1d4db..fa78ae3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,28 +1,32 @@ -[tool.poetry] +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[project] name = "pode" -version = "0.4.4" +version = "0.4.5" description = "Implementation of an algorithm for a polygon decomposition by Hert, S. and Lumelsky, V., 1998" -authors = ["GeorgySk "] +authors = [ + { name = "Georgy Skorobogatov", email = "skorobogatovgeorgy+github@gmail.com" }, +] readme = "README.md" - -[tool.poetry.dependencies] -python = "^3.8" -gon = "^5.0.0" -ground = "^8.1.0" -networkx = "^2.8.8" -sect = "^6.1.0" +license-files = ["LICENSE"] +requires-python = "^3.10" +dependencies = [ + "gon (>=5.0.0,<6.0.0)", + "ground (>=8.1.0,<9.0.0)", + "networkx (>=2.8.8,<3.0.0)", + "sect (>=6.1.0,<7.0.0)" +] [tool.poetry.group.dev.dependencies] bump-my-version = "^0.18.3" pytest = "^7.2.0" pytest-cov = "^4.0.0" +# fixed for easier way to reproduce across various machines hypothesis = "6.99.1" hypothesis-geometry = "^7.3.0" -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" - [tool.coverage.run] source = ["pode"]