Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
5958473
Add testing on MacOS (intel and m1)
Diviloper Mar 28, 2024
ff7fd7a
Fix use of env variable
Diviloper Mar 28, 2024
9450e29
Use runner.os instead of env.RUNNER_OS
Diviloper Mar 28, 2024
0b256af
Fix macOS C dependencies
Diviloper Mar 28, 2024
f5d331a
Add temporary fix for macOS runner issue
Diviloper Mar 28, 2024
a09341b
Fix use of matrix.os variable
Diviloper Mar 28, 2024
8469444
Fix use of matrix.os variable
Diviloper Mar 28, 2024
10a9a12
Add patches for MacOS
Diviloper Mar 28, 2024
1f1c159
Add filters to avoid running tests when only docs are updated
Diviloper Mar 28, 2024
3893deb
Skip python 3.8 and 3.9 for arm macos due to issue with runners.
Diviloper Mar 28, 2024
540a60a
Remove -D flag in nm check to avoid issues in macOS (outputs are iden…
Diviloper Mar 28, 2024
db05ac5
Add system-dependent LD_LIBRARY_PATH
Diviloper Mar 28, 2024
35d5b0b
Add explicit include dirs
Diviloper Mar 28, 2024
b90e924
Add log in get_defined_functions
Diviloper Mar 28, 2024
f9830ad
Update defined symbol search to take into account that symbols in mac…
Diviloper Mar 28, 2024
1b308ca
Add log again
Diviloper Mar 28, 2024
4016e35
Set DYLD_LIBRARY_PATH
Diviloper Mar 28, 2024
ee89a99
Add underscore to meos calls in macos
Diviloper Mar 28, 2024
36cac04
Fix underscore position
Diviloper Mar 28, 2024
675e07c
Add underscore to meos calls in macos
Diviloper Mar 28, 2024
42013b7
Revert last commits
Diviloper Mar 28, 2024
eca8a4e
Add prints to MEOS
Diviloper Mar 28, 2024
8e7c6e6
Add prints to MEOS
Diviloper Mar 28, 2024
ea8fa96
Add prints to MEOS
Diviloper Mar 28, 2024
583fbf6
Add prints to MEOS
Diviloper Mar 28, 2024
c67271a
Remove prints
Diviloper Mar 28, 2024
ffaca17
Add log
Diviloper Mar 28, 2024
75b4cec
Add pymeos function to test division
Diviloper Mar 28, 2024
2872b47
Fix test mini program
Diviloper Mar 28, 2024
f578e63
Fix command
Diviloper Mar 28, 2024
776e46f
Add etra test to check where's the crash
Diviloper Mar 28, 2024
c9073cf
More tests
Diviloper Mar 29, 2024
b62303a
Update logs
Diviloper Mar 29, 2024
ca78fb9
Update logs
Diviloper Mar 29, 2024
7cb9e70
Update logs
Diviloper Mar 29, 2024
e161716
Update logs
Diviloper Mar 29, 2024
6217e90
Move logs to all mac to compare results
Diviloper Mar 29, 2024
c1c7f8b
Update MEOS repo to try fix
Diviloper Mar 29, 2024
0fad20c
Change USE_FLOAT8_BYVAL macro value to try
Diviloper Mar 29, 2024
86ec09e
Remove all tests from workflow
Diviloper Mar 29, 2024
543cb94
Move python setup action down
Diviloper Mar 29, 2024
1f967a0
Test only on macos-14 to speedup debugging
Diviloper Mar 30, 2024
bd9853a
Add MEOS and PyMEOS scripts
Diviloper Mar 30, 2024
b35b3c0
Set LD path in test scripts
Diviloper Mar 30, 2024
aacbefe
Use lifting branch of MobilityDB
Diviloper Mar 31, 2024
cc728e1
Use lifting branch of MobilityDB
Diviloper Mar 31, 2024
1f5b460
Use estebanzimanyi/MobilityDB
Diviloper Mar 31, 2024
1aa2ba4
Use new changes and don't patch
Diviloper Apr 2, 2024
4a89ce8
Fix conditions
Diviloper Apr 2, 2024
43082e1
Switch branch
Diviloper Apr 2, 2024
a851e70
Fix pymeos example path
Diviloper Apr 2, 2024
ed5dd76
Try with CRC patch
Diviloper Apr 2, 2024
d9139b8
Fix patch
Diviloper Apr 2, 2024
2bc83a7
Add transformation tests
Diviloper Apr 2, 2024
91d2445
Remove patches and examples
Diviloper Apr 2, 2024
e287602
Add rounding in srid transformation tests to account for floating poi…
Diviloper Apr 2, 2024
5c877de
Change branch repo to test last changes
Diviloper Apr 7, 2024
9a53970
Use proper remote and branch for getting meos sources
Diviloper Apr 7, 2024
4206d36
Move is_ever_disjoint to TGeomPoint for comparisons with base geometr…
Diviloper Apr 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 58 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,102 @@ name: Test PyMEOS
on:
push:
branches: [ "develop", "master" ]
paths-ignore:
- "docs/**"
- ".readthedocs.yml"
- "README.md"
pull_request:
branches: [ "develop", "master" ]
paths-ignore:
- "docs/**"
- ".readthedocs.yml"
- "README.md"

jobs:
build:

runs-on: ubuntu-22.04
test:
name: Test PyMEOS - Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
os: [ ubuntu-latest, macos-13, macos-14 ]
exclude:
# Necessary due to issue with macOS runners. See
# https://github.com/actions/setup-python/issues/808
# Can be removed once this PR is merged:
# https://github.com/actions/python-versions/pull/259
- os: macos-14
python-version: "3.8"
- os: macos-14
python-version: "3.9"
include:
- ld_path: "/usr/local/lib"
- os: macos-14
ld_path: "/opt/homebrew/lib"

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- uses: awalsh128/cache-apt-pkgs-action@latest
- name: Get dependencies from apt (cache)
uses: awalsh128/cache-apt-pkgs-action@latest
if: runner.os == 'Linux'
with:
packages: build-essential cmake postgresql-server-dev-14 libproj-dev libjson-c-dev libgsl-dev libgeos-dev
version: 1.0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Update brew
if: matrix.os == 'macos-13'
# Necessary to avoid issue with macOS runners. See
# https://github.com/actions/runner-images/issues/4020
run: |
brew reinstall python@3.12 || brew link --overwrite python@3.12
brew reinstall python@3.11 || brew link --overwrite python@3.11
brew update

- name: Get dependencies from homebrew (cache)
uses: tecolicom/actions-use-homebrew-tools@v1
if: runner.os == 'macOS'
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
tools: cmake libpq proj json-c gsl geos

- name: Install MEOS
- name: Fetch MEOS sources
env:
BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
run: |
git clone --branch ${{ env.BRANCH_NAME }} --depth 1 https://github.com/MobilityDB/MobilityDB

- name: Install MEOS
run: |
mkdir MobilityDB/build
cd MobilityDB/build
cmake .. -DMEOS=on
make -j
sudo make install

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r pymeos_cffi/dev-requirements.txt
pip install -r pymeos/dev-requirements.txt

- name: Install pymeos_cffi
run: |
cd pymeos_cffi
python ./pymeos_cffi/builder/build_header.py
python ./pymeos_cffi/builder/build_pymeos_functions.py
pip install .
cd ..

- name: Test PyMEOS with pytest
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_path }}
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_path }}
cd pymeos
pytest
46 changes: 35 additions & 11 deletions pymeos/pymeos/main/tpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TPoint(Temporal[shp.Point, TG, TI, TS, TSS], TSimplifiable, ABC):
Abstract class for temporal points.
"""

_projection_cache: dict[tuple[int, int], 'LWPROJ'] = {}
_projection_cache: dict[tuple[int, int], "LWPROJ"] = {}

# ------------------------- Constructors ----------------------------------
def __init__(self, _inner) -> None:
Expand Down Expand Up @@ -502,9 +502,10 @@ def transform(self: Self, srid: int) -> Self:
MEOS Functions:
tpoint_transform
"""
if (self.srid(), srid) not in self._projection_cache:
self._projection_cache[(self.srid(), srid)] = lwproj_transform(self.srid(), srid)
result = tpoint_transform_pj(self._inner, srid, self._projection_cache[(self.srid(), srid)])
srids = (self.srid(), srid)
if srids not in self._projection_cache:
self._projection_cache[srids] = lwproj_transform(*srids)
result = tpoint_transform_pj(self._inner, srid, self._projection_cache[srids])
return Temporal._factory(result)

# ------------------------- Restrictions ----------------------------------
Expand Down Expand Up @@ -774,7 +775,7 @@ def is_ever_contained_in(self, container: Union[shpb.BaseGeometry, STBox]) -> bo
raise TypeError(f"Operation not supported with type {container.__class__}")
return result == 1

def is_ever_disjoint(self, other: Union[shpb.BaseGeometry, TPoint, STBox]) -> bool:
def is_ever_disjoint(self, other: TPoint) -> bool:
"""
Returns whether the temporal point is ever disjoint from `other`.

Expand All @@ -789,12 +790,7 @@ def is_ever_disjoint(self, other: Union[shpb.BaseGeometry, TPoint, STBox]) -> bo
"""
from ..boxes import STBox

if isinstance(other, shpb.BaseGeometry):
gs = geo_to_gserialized(other, isinstance(self, TGeogPoint))
result = edisjoint_tpoint_geo(self._inner, gs)
elif isinstance(other, STBox):
result = edisjoint_tpoint_geo(self._inner, stbox_to_geo(other._inner))
elif isinstance(other, TPoint):
if isinstance(other, TPoint):
result = edisjoint_tpoint_tpoint(self._inner, other._inner)
else:
raise TypeError(f"Operation not supported with type {other.__class__}")
Expand Down Expand Up @@ -1651,6 +1647,34 @@ def never_not_equal(self, value: Union[shpb.BaseGeometry, TGeomPoint]) -> bool:
"""
return not self.ever_not_equal(value)

def is_ever_disjoint(
self, other: Union[shpb.BaseGeometry, TGeomPoint, STBox]
) -> bool:
"""
Returns whether the temporal point is ever disjoint from `other`.

Args:
other: An object to check for disjointness with.

Returns:
A :class:`bool` indicating whether the temporal point is ever disjoint from `other`.

MEOS Functions:
edisjoint_tpoint_geo, edisjoint_tpoint_tpoint
"""
from ..boxes import STBox

if isinstance(other, shpb.BaseGeometry):
gs = geo_to_gserialized(other, isinstance(self, TGeogPoint))
result = edisjoint_tpoint_geo(self._inner, gs)
elif isinstance(other, STBox):
result = edisjoint_tpoint_geo(self._inner, stbox_to_geo(other._inner))
elif isinstance(other, TGeomPoint):
result = edisjoint_tpoint_tpoint(self._inner, other._inner)
else:
raise TypeError(f"Operation not supported with type {other.__class__}")
return result == 1

# ------------------------- Temporal Comparisons --------------------------
def temporal_equal(self, other: Union[shp.Point, TGeomPoint]) -> TBool:
"""
Expand Down
Loading