Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 0 additions & 20 deletions .github/workflows/black.yml

This file was deleted.

157 changes: 157 additions & 0 deletions .github/workflows/release_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: Release and Publish PyMEOS

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"

jobs:
checks:
name: Make checks
runs-on: ubuntu-latest

outputs:
is_alpha: ${{ steps.check_alpha.outputs.is_alpha }}
is_beta: ${{ steps.check_beta.outputs.is_beta }}
is_rc: ${{ steps.check_rc.outputs.is_rc }}
is_prerelease: ${{ steps.check_prerelease.outputs.is_prerelease }}

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

- name: Check if publishing an alpha version
id: check_alpha
run: |
VERSION=${GITHUB_REF#refs/tags/}

if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-alpha ]]; then
echo "Releasing an alpha version."
echo "is_alpha=true" >> "$GITHUB_OUTPUT"
else
echo "is_alpha=false" >> "$GITHUB_OUTPUT"
fi

- name: Check if publishing a beta version
id: check_beta
run: |
VERSION=${GITHUB_REF#refs/tags/}

if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-beta ]]; then
echo "Releasing a beta version."
echo "is_beta=true" >> "$GITHUB_OUTPUT"
else
echo "is_beta=false" >> "$GITHUB_OUTPUT"
fi

- name: Check if publishing a release candidate version
id: check_rc
run: |
VERSION=${GITHUB_REF#refs/tags/}

if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then
echo "Releasing an rc version."
echo "is_rc=true" >> "$GITHUB_OUTPUT"
else
echo "is_rc=false" >> "$GITHUB_OUTPUT"
fi

- name: Check if publishing a prerelease version
id: check_prerelease
run: |
is_alpha=${{ steps.check_alpha.outputs.is_alpha }}
is_beta=${{ steps.check_beta.outputs.is_beta }}
is_rc=${{ steps.check_rc.outputs.is_rc }}

if [ "$is_alpha" == "true" ] || [ "$is_beta" == "true" ] || [ "$is_rc" == "true" ]; then
echo "Releasing an prerelease version."
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi

- name: Check package version matches tag
run: |
tag_version=${GITHUB_REF#refs/tags/v}
python_version=$(grep -oP '__version__ = "\K[^"]+' pymeos/__init__.py)

if [[ "$tag_version" != "$python_version" ]]; then
echo "Tag Version ($tag_version) doesn't match Code Version ($python_version)"
echo "::error title=Version mismatch::Tag Version ($tag_version) doesn't match Code Version ($python_version)"
exit 1
fi


build:
name: Build PyMEOS
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.10
cache: "pip"

- name: Setup pip
run: |
python -m pip install --upgrade pip
python -m pip install build

- name: Build package
run: python -m build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: |
./dist/pymeos-*.tar.gz
./dist/pymeos-*.whl

release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [ checks, build ]

permissions:
contents: write

steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
merge-multiple: true

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: ./dist/*
prerelease: ${{ needs.checks.outputs.is_prerelease }}
generate_release_notes: true

publish:
name: Upload to PyPI
needs: [ build ]
runs-on: ubuntu-latest

if: github.repository == 'MobilityDB/PyMEOS'
environment:
name: pypi
url: https://pypi.org/p/pymeos
permissions:
id-token: write

steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

26 changes: 26 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint code with Ruff

on:
push:
branches: [ "master", "stable-[0-9]+.[0-9]+" ]
pull_request:
branches: [ "master", "stable-[0-9]+.[0-9]+" ]

jobs:
lint:
name: Lint code with Ruff
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Ruff
uses: astral-sh/ruff-action@v3
with:
args: "--version"

- name: Check rules
run: "ruff check"

- name: Check format
run: "ruff format --check --diff"
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
os: [ ubuntu-latest, macos-13, macos-14 ]
include:
- ld_path: "/usr/local/lib"
- ld_prefix: "/usr/local"
- os: macos-14
ld_path: "/opt/homebrew/lib"
ld_prefix: "/opt/homebrew"

steps:
- name: Checkout
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
run: |
mkdir MobilityDB/build
cd MobilityDB/build
cmake .. -DMEOS=on
cmake .. -DMEOS=on -DCMAKE_INSTALL_PREFIX=${{ matrix.ld_prefix }}
make -j
sudo make install

Expand Down Expand Up @@ -97,6 +97,6 @@ jobs:

- name: Test PyMEOS with pytest
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_path }}
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_path }}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
pytest
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![pypi](https://img.shields.io/pypi/v/pymeos.svg)](https://pypi.python.org/pypi/pymeos/)
[![docs status](https://readthedocs.org/projects/pymeos/badge/?version=latest)](https://pymeos.readthedocs.io/en/latest/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[MEOS (Mobility Engine, Open Source)](https://www.libmeos.org/) is a C library which enables the manipulation of
temporal and spatio-temporal data based on [MobilityDB](https://mobilitydb.com/)'s data types and functions.
Expand Down
3 changes: 2 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
python-dateutil
shapely
geopandas
pytest
pytest
ruff
4 changes: 1 addition & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,4 @@ def download_file(url, dest_path):

prefix = "https://raw.githubusercontent.com/MobilityDB/PyMEOS-Examples/main/"
download_file(f"{prefix}PyMEOS_Examples/AIS.ipynb", "src/examples/AIS.ipynb")
download_file(
f"{prefix}PyMEOS_Examples/BerlinMOD.ipynb", "src/examples/BerlinMOD.ipynb"
)
download_file(f"{prefix}PyMEOS_Examples/BerlinMOD.ipynb", "src/examples/BerlinMOD.ipynb")
33 changes: 17 additions & 16 deletions pymeos/__init__.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
from .aggregators import *
from .boxes import *
from .main import *
from .meos_init import *
from .temporal import *
from .collections import *
from pymeos_cffi import (
MeosException,
MeosInternalError,
MeosArgumentError,
MeosIoError,
MeosInternalTypeError,
MeosValueOutOfRangeError,
MeosDivisionByZeroError,
MeosMemoryAllocError,
MeosAggregationError,
MeosArgumentError,
MeosDirectoryError,
MeosDivisionByZeroError,
MeosException,
MeosFileError,
MeosGeoJsonInputError,
MeosGeoJsonOutputError,
MeosInternalError,
MeosInternalTypeError,
MeosInvalidArgError,
MeosInvalidArgTypeError,
MeosInvalidArgValueError,
MeosIoError,
MeosMemoryAllocError,
MeosMfJsonInputError,
MeosMfJsonOutputError,
MeosTextInputError,
MeosTextOutputError,
MeosValueOutOfRangeError,
MeosWkbInputError,
MeosWkbOutputError,
MeosGeoJsonInputError,
MeosGeoJsonOutputError,
)

from .aggregators import *
from .boxes import *
from .collections import *
from .main import *
from .meos_init import *
from .temporal import *

__version__ = "1.3.0-alpha-1"
__all__ = [
# initialization
Expand Down
2 changes: 1 addition & 1 deletion pymeos/aggregators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .bool_aggregators import *
from .general_aggregators import *
from .number_aggregators import *
from .text_aggregators import *
from .point_aggregators import *
from .text_aggregators import *
from .time_aggregators import *

__all__ = [
Expand Down
Loading
Loading