ground


Nameground JSON
Version 9.0.0 PyPI version JSON
download
home_pagehttps://github.com/lycantropos/ground/
SummaryBasis of computational geometry.
upload_time2023-05-12 18:45:24
maintainer
docs_urlNone
authorAzat Ibrakov
requires_python>=3.7
licenseMIT License
keywords
VCS
bugtrack_url
requirements cfractions reprit shewchuk symba typing-extensions
Travis-CI No Travis.
coveralls test coverage
            ground
======

[![](https://github.com/lycantropos/ground/workflows/CI/badge.svg)](https://github.com/lycantropos/ground/actions/workflows/ci.yml "Github Actions")
[![](https://readthedocs.org/projects/ground/badge/?version=latest)](https://ground.readthedocs.io/en/latest "Documentation")
[![](https://codecov.io/gh/lycantropos/ground/branch/master/graph/badge.svg)](https://codecov.io/gh/lycantropos/ground "Codecov")
[![](https://img.shields.io/github/license/lycantropos/ground.svg)](https://github.com/lycantropos/ground/blob/master/LICENSE "License")
[![](https://badge.fury.io/py/ground.svg)](https://badge.fury.io/py/ground "PyPI")

Summary
-------

`ground` is a pure Python library that provides protocols
for planar computational geometry models & operations
to unify interaction between different libraries
and allow customization.

---

In what follows `python` is an alias for `python3.7` or `pypy3.7`
or any later version (`python3.8`, `pypy3.8` and so on).

Installation
------------

Install the latest `pip` & `setuptools` packages versions
```bash
python -m pip install --upgrade pip setuptools
```

### User

Download and install the latest stable version from `PyPI` repository
```bash
python -m pip install --upgrade ground
```

### Developer

Download the latest version from `GitHub` repository
```bash
git clone https://github.com/lycantropos/ground.git
cd ground
```

Install dependencies
```bash
python -m pip install -r requirements.txt
```

Install
```bash
python setup.py install
```

Usage
-----
```python
>>> from ground.base import get_context
>>> context = get_context()
>>> Multipoint = context.multipoint_cls
>>> Point = context.point_cls
>>> Segment = context.segment_cls
>>> origin = Point(0, 0)
>>> x_unit = Point(1, 0)
>>> y_unit = Point(0, 1)
>>> from ground.base import Kind
>>> context.angle_kind(origin, x_unit, y_unit) is Kind.RIGHT
True
>>> from ground.base import Orientation
>>> (context.angle_orientation(origin, x_unit, y_unit)
...  is Orientation.COUNTERCLOCKWISE)
True
>>> context.cross_product(origin, x_unit, origin, y_unit) == 1
True
>>> context.dot_product(origin, x_unit, origin, y_unit) == 0
True
>>> context.multipoint_centroid(Multipoint([origin])) == origin
True
>>> (context.points_convex_hull([origin, x_unit, y_unit])
...  == [origin, x_unit, y_unit])
True
>>> context.segment_contains_point(Segment(origin, x_unit), y_unit)
False
>>> context.segment_contains_point(Segment(origin, x_unit), origin)
True
>>> context.segments_intersection(Segment(origin, x_unit),
...                               Segment(origin, y_unit)) == origin
True
>>> from ground.base import Relation
>>> context.segments_relation(Segment(origin, x_unit),
...                           Segment(origin, y_unit)) is Relation.TOUCH
True

```

Development
-----------

### Bumping version

#### Preparation

Install
[bump2version](https://github.com/c4urself/bump2version#installation).

#### Pre-release

Choose which version number category to bump following [semver
specification](http://semver.org/).

Test bumping version
```bash
bump2version --dry-run --verbose $CATEGORY
```

where `$CATEGORY` is the target version number category name, possible
values are `patch`/`minor`/`major`.

Bump version
```bash
bump2version --verbose $CATEGORY
```

This will set version to `major.minor.patch-alpha`. 

#### Release

Test bumping version
```bash
bump2version --dry-run --verbose release
```

Bump version
```bash
bump2version --verbose release
```

This will set version to `major.minor.patch`.

### Running tests

Install dependencies
```bash
python -m pip install -r requirements-tests.txt
```

Plain
```bash
pytest
```

Inside `Docker` container:
- with `CPython`
  ```bash
  docker-compose --file docker-compose.cpython.yml up
  ```
- with `PyPy`
  ```bash
  docker-compose --file docker-compose.pypy.yml up
  ```

`Bash` script:
- with `CPython`
  ```bash
  ./run-tests.sh
  ```
  or
  ```bash
  ./run-tests.sh cpython
  ```

- with `PyPy`
  ```bash
  ./run-tests.sh pypy
  ```

`PowerShell` script:
- with `CPython`
  ```powershell
  .\run-tests.ps1
  ```
  or
  ```powershell
  .\run-tests.ps1 cpython
  ```
- with `PyPy`
  ```powershell
  .\run-tests.ps1 pypy
  ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lycantropos/ground/",
    "name": "ground",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Azat Ibrakov",
    "author_email": "azatibrakov@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/53/c2/ae3e409c92821677377caeab9f00a71547c9b9f2502767f0353156e4a958/ground-9.0.0.tar.gz",
    "platform": null,
    "description": "ground\n======\n\n[![](https://github.com/lycantropos/ground/workflows/CI/badge.svg)](https://github.com/lycantropos/ground/actions/workflows/ci.yml \"Github Actions\")\n[![](https://readthedocs.org/projects/ground/badge/?version=latest)](https://ground.readthedocs.io/en/latest \"Documentation\")\n[![](https://codecov.io/gh/lycantropos/ground/branch/master/graph/badge.svg)](https://codecov.io/gh/lycantropos/ground \"Codecov\")\n[![](https://img.shields.io/github/license/lycantropos/ground.svg)](https://github.com/lycantropos/ground/blob/master/LICENSE \"License\")\n[![](https://badge.fury.io/py/ground.svg)](https://badge.fury.io/py/ground \"PyPI\")\n\nSummary\n-------\n\n`ground` is a pure Python library that provides protocols\nfor planar computational geometry models & operations\nto unify interaction between different libraries\nand allow customization.\n\n---\n\nIn what follows `python` is an alias for `python3.7` or `pypy3.7`\nor any later version (`python3.8`, `pypy3.8` and so on).\n\nInstallation\n------------\n\nInstall the latest `pip` & `setuptools` packages versions\n```bash\npython -m pip install --upgrade pip setuptools\n```\n\n### User\n\nDownload and install the latest stable version from `PyPI` repository\n```bash\npython -m pip install --upgrade ground\n```\n\n### Developer\n\nDownload the latest version from `GitHub` repository\n```bash\ngit clone https://github.com/lycantropos/ground.git\ncd ground\n```\n\nInstall dependencies\n```bash\npython -m pip install -r requirements.txt\n```\n\nInstall\n```bash\npython setup.py install\n```\n\nUsage\n-----\n```python\n>>> from ground.base import get_context\n>>> context = get_context()\n>>> Multipoint = context.multipoint_cls\n>>> Point = context.point_cls\n>>> Segment = context.segment_cls\n>>> origin = Point(0, 0)\n>>> x_unit = Point(1, 0)\n>>> y_unit = Point(0, 1)\n>>> from ground.base import Kind\n>>> context.angle_kind(origin, x_unit, y_unit) is Kind.RIGHT\nTrue\n>>> from ground.base import Orientation\n>>> (context.angle_orientation(origin, x_unit, y_unit)\n...  is Orientation.COUNTERCLOCKWISE)\nTrue\n>>> context.cross_product(origin, x_unit, origin, y_unit) == 1\nTrue\n>>> context.dot_product(origin, x_unit, origin, y_unit) == 0\nTrue\n>>> context.multipoint_centroid(Multipoint([origin])) == origin\nTrue\n>>> (context.points_convex_hull([origin, x_unit, y_unit])\n...  == [origin, x_unit, y_unit])\nTrue\n>>> context.segment_contains_point(Segment(origin, x_unit), y_unit)\nFalse\n>>> context.segment_contains_point(Segment(origin, x_unit), origin)\nTrue\n>>> context.segments_intersection(Segment(origin, x_unit),\n...                               Segment(origin, y_unit)) == origin\nTrue\n>>> from ground.base import Relation\n>>> context.segments_relation(Segment(origin, x_unit),\n...                           Segment(origin, y_unit)) is Relation.TOUCH\nTrue\n\n```\n\nDevelopment\n-----------\n\n### Bumping version\n\n#### Preparation\n\nInstall\n[bump2version](https://github.com/c4urself/bump2version#installation).\n\n#### Pre-release\n\nChoose which version number category to bump following [semver\nspecification](http://semver.org/).\n\nTest bumping version\n```bash\nbump2version --dry-run --verbose $CATEGORY\n```\n\nwhere `$CATEGORY` is the target version number category name, possible\nvalues are `patch`/`minor`/`major`.\n\nBump version\n```bash\nbump2version --verbose $CATEGORY\n```\n\nThis will set version to `major.minor.patch-alpha`. \n\n#### Release\n\nTest bumping version\n```bash\nbump2version --dry-run --verbose release\n```\n\nBump version\n```bash\nbump2version --verbose release\n```\n\nThis will set version to `major.minor.patch`.\n\n### Running tests\n\nInstall dependencies\n```bash\npython -m pip install -r requirements-tests.txt\n```\n\nPlain\n```bash\npytest\n```\n\nInside `Docker` container:\n- with `CPython`\n  ```bash\n  docker-compose --file docker-compose.cpython.yml up\n  ```\n- with `PyPy`\n  ```bash\n  docker-compose --file docker-compose.pypy.yml up\n  ```\n\n`Bash` script:\n- with `CPython`\n  ```bash\n  ./run-tests.sh\n  ```\n  or\n  ```bash\n  ./run-tests.sh cpython\n  ```\n\n- with `PyPy`\n  ```bash\n  ./run-tests.sh pypy\n  ```\n\n`PowerShell` script:\n- with `CPython`\n  ```powershell\n  .\\run-tests.ps1\n  ```\n  or\n  ```powershell\n  .\\run-tests.ps1 cpython\n  ```\n- with `PyPy`\n  ```powershell\n  .\\run-tests.ps1 pypy\n  ```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Basis of computational geometry.",
    "version": "9.0.0",
    "project_urls": {
        "Download": "https://github.com/lycantropos/ground/archive/master.zip",
        "Homepage": "https://github.com/lycantropos/ground/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2a650ac92a9870ae55e368fda2dcfe8214b2cf15287a168fc305d28250b1b55",
                "md5": "fe00cbf432f0b5b267abc00889cf8bba",
                "sha256": "ecdd7c772e41d97b866e12fef2da2ede179e75f37b2b47dd4bc52efd57b586d1"
            },
            "downloads": -1,
            "filename": "ground-9.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fe00cbf432f0b5b267abc00889cf8bba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 60254,
            "upload_time": "2023-05-12T18:45:22",
            "upload_time_iso_8601": "2023-05-12T18:45:22.742946Z",
            "url": "https://files.pythonhosted.org/packages/f2/a6/50ac92a9870ae55e368fda2dcfe8214b2cf15287a168fc305d28250b1b55/ground-9.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53c2ae3e409c92821677377caeab9f00a71547c9b9f2502767f0353156e4a958",
                "md5": "3b8ea789ccead6dad5b137111d57f622",
                "sha256": "fb3faa6bb2fa36a7c35d660a4b79fa17eb3e73a0fedda38e4e1559d0151f3f4e"
            },
            "downloads": -1,
            "filename": "ground-9.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3b8ea789ccead6dad5b137111d57f622",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 34207,
            "upload_time": "2023-05-12T18:45:24",
            "upload_time_iso_8601": "2023-05-12T18:45:24.101133Z",
            "url": "https://files.pythonhosted.org/packages/53/c2/ae3e409c92821677377caeab9f00a71547c9b9f2502767f0353156e4a958/ground-9.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 18:45:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lycantropos",
    "github_project": "ground",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "cfractions",
            "specs": [
                [
                    "<",
                    "3.0"
                ],
                [
                    ">=",
                    "2.2.0"
                ]
            ]
        },
        {
            "name": "reprit",
            "specs": [
                [
                    "<",
                    "1.0"
                ],
                [
                    ">=",
                    "0.9.0"
                ]
            ]
        },
        {
            "name": "shewchuk",
            "specs": [
                [
                    ">=",
                    "6.7.0"
                ],
                [
                    "<",
                    "7.0"
                ]
            ]
        },
        {
            "name": "symba",
            "specs": [
                [
                    "<",
                    "3.0"
                ],
                [
                    ">=",
                    "2.2.1"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.5.0"
                ],
                [
                    "<",
                    "5.0"
                ]
            ]
        }
    ],
    "lcname": "ground"
}
        
Elapsed time: 0.06347s