Skip to main content

Hexometry

Python library to work with hexagon grid geometry.

Overview

Hexometry is a Python library to work with hexagon grid geometry. Some ideas of having x, y, z coordinates for hexagon grid are taken from this article by Jasper Flick.

Particulary this image gives a good idea of a choosen coordinates for hexagon grid:

hex grid coordinates example

Dependencies

This library has no dependencies apart from python stdlib, but it requires Python 3.11 or higher. There is no problem to make it work with Python 3.7 — 3.11, but the original intention was to try fancy features of modern Python.

Installation

pip install hexometry

Usage

from hexometry import Coord, Direction, Route

c1 = Coord(0, 0)
c2 = Coord(2, 3)
print(f"Coordinates {c1} and {c2} on a field are {c1-c2} hexes away each other")

route = c1 >> c2
print(f"and the route between them are: {route}. Let's traverse it:")

coord = c1
for direction in route:
    coord += direction
    print(f"moving {direction.value} to {coord}")

assert coord == c2
print("here we are")

Metadata

Release files for hexometry 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hexometry 1.1.1
File Size Uploaded
hexometry-1.1.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hexometry 1.1.1
File Interpreter ABI Platform
hexometry-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / hexometry-1.1.1.tar.gz

Download URL hexometry-1.1.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
81c187669b0a0138bab074559fe3ee358f82e50e551e87cf1e1c6234cdddce55
BLAKE2b-256 checksum
How to use checksums
945ed0242d896839c40b1a7e10f1a229eb8c7b43acb96af40d68e617e16f16ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 4, 2025.

Transparency log

Release files / hexometry-1.1.1-py3-none-any.whl

Download URL hexometry-1.1.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbd900c121b20bba6802498e70ea0d9beb56c44369afc13b800af8bc4a76237c
BLAKE2b-256 checksum
How to use checksums
37078d3afeca3d5915a00539ec970a5dc249fcd34bac63921d11a99043eaa289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 4, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1

2 release files

1.0.1

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page