Skip to content

trouchet/eule

Repository files navigation

a night owl

Version downloads codecov Documentation Status Binder

Eule is a universal logic engine for generating Euler diagrams and analyzing set relationships.

It generates non-empty Euler diagrams (disjoint partitions) for ANY type of overlapping data:

  • Discrete Sets: Strings, integers, custom objects.
  • Continuous Intervals: Time ranges, numerical values (via interval-sets).
  • Geometric Shapes: 2D Polygons, 3D Boxes (via shapely and box-sets).

Motivation

Installation

# Standard install (Discrete sets)
pip install eule

# With Interval support
pip install "eule[interval]"

# With Geometry support
pip install "eule[geometry]"

# For all features
pip install "eule[interval,geometry]"

Universal Logic Engine 🚀

Eule is no longer just for Python sets. It now supports the SetLike Protocol, allowing it to compute disjoint regions for advanced mathematical objects.

1. Discrete Sets (Standard)

from eule import euler

sets = {
    'A': {1, 2, 3},
    'B': {2, 3, 4},
    'C': {3, 4, 5}
}
diagram = euler(sets)
# Returns disjoint decomposition: 
# {'A': {1}, 'B': {5}, 'C': {6}, 'A,B': {2}, ...}

2. Continuous Intervals (Time/Numbers)

Requires interval-sets

from interval_sets import IntervalSet, Interval
from eule import euler

schedules = {
    'Alice': IntervalSet([Interval(9, 12), Interval(13, 17)]),
    'Bob':   IntervalSet([Interval(11, 14)])
}

# Find exact overlap: 11:00-12:00 and 13:00-14:00
diagram = euler(schedules) 

3. Geometric Shapes (2D/3D)

Requires shapely

from shapely.geometry import Polygon
from eule import euler

territories = {
    'Wolves': Polygon([(0,0), (0,10), (10,10), (10,0)]),
    'Bears':  Polygon([(5,5), (5,15), (15,15), (15,5)])
}

# Automatically computes the exact Intersection Polygon!
diagram = euler(territories)

Examples

Check the examples/ directory for advanced real-world use cases:

How to Contribute

We welcome implementations of the SetLike protocol for new domains! See Protocol Specification.

About

A PyPI package on Euler's diagrams

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 5