-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate PyMEOS CFFI code from PyMEOS repository
- Loading branch information
0 parents
commit e0bb8eb
Showing
23 changed files
with
24,657 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
- OS: [e.g. macOS] | ||
- Architecture: [e.g. x64] | ||
- Environment: [e.g. conda] | ||
- Version [e.g. 1.1.1] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
name: Build PyMEOS CFFI | ||
|
||
on: | ||
create: | ||
tags: | ||
- "pymeos-cffi-[0-9]+.[0-9]+.[0-9]+*" | ||
|
||
jobs: | ||
build_sdist: | ||
name: Build PyMEOS CFFI source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
cache: "pip" | ||
|
||
- name: Setup pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install build | ||
- name: Build sdist | ||
working-directory: pymeos_cffi | ||
run: | | ||
python -m build -s | ||
ls -l dist | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: pymeos_cffi-sdist | ||
path: ./pymeos_cffi/dist/pymeos_cffi-*.tar.gz | ||
|
||
build_wheels: | ||
name: Build PyMEOS CFFI for ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, macos-13, macos-14 ] | ||
include: | ||
- ld_prefix: "/usr/local" | ||
- os: macos-14 | ||
ld_prefix: "/opt/homebrew" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- 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 [email protected] || brew link --overwrite [email protected] | ||
brew reinstall [email protected] || brew link --overwrite [email protected] | ||
brew update | ||
- name: Get dependencies from homebrew (cache) | ||
uses: tecolicom/actions-use-homebrew-tools@v1 | ||
if: runner.os == 'macOS' | ||
with: | ||
tools: cmake libpq proj json-c gsl geos | ||
|
||
- name: Get PROJ version | ||
id: proj_version | ||
if: runner.os == 'macOS' | ||
run: | | ||
proj_version=$(brew list --versions proj) | ||
proj_version=${proj_version#* } | ||
echo "proj_version=$proj_version" >> $GITHUB_OUTPUT | ||
- name: Install MEOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
git clone --depth 1 https://github.com/MobilityDB/MobilityDB | ||
mkdir MobilityDB/build | ||
cd MobilityDB/build | ||
cmake .. -DMEOS=on | ||
make -j | ||
sudo make install | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
cache: "pip" | ||
|
||
- name: Install cibuildwheel | ||
run: python -m pip install cibuildwheel==2.17.0 | ||
|
||
- name: Set PROJ_DATA (macOS) | ||
if: runner.os == 'macOS' | ||
run: | | ||
PROJ_DATA=${{ matrix.ld_prefix }}/Cellar/proj/${{ steps.proj_version.outputs.proj_version }}/share/proj | ||
echo "PROJ_DATA=$PROJ_DATA" >> $GITHUB_ENV | ||
- name: Set PROJ_DATA and JSON-C path (Linux) | ||
if: runner.os == 'Linux' | ||
run: | | ||
PROJ_DATA=/usr/proj81/share/proj | ||
echo "PROJ_DATA=$PROJ_DATA" >> $GITHUB_ENV | ||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64" >> $GITHUB_ENV | ||
- name: Build wheels | ||
working-directory: pymeos_cffi | ||
run: | | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib | ||
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib | ||
export PACKAGE_DATA=1 | ||
python -m cibuildwheel --output-dir wheelhouse | ||
env: | ||
# Disable PyPy builds | ||
# Disable builds on musllinux | ||
# Disable builds in linux architectures other than x86_64 | ||
CIBW_SKIP: "pp* *musllinux*" | ||
CIBW_ARCHS_LINUX: "x86_64" | ||
CIBW_ENVIRONMENT_PASS_LINUX: PACKAGE_DATA LD_LIBRARY_PATH PROJ_DATA | ||
CIBW_BEFORE_ALL_LINUX: > | ||
yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm && | ||
yum -y update && | ||
yum -y install gcc gcc-c++ make cmake postgresql13-devel proj81-devel geos39-devel gsl-devel && | ||
git clone --branch json-c-0.17 --depth 1 https://github.com/json-c/json-c && | ||
mkdir json-c-build && | ||
cd json-c-build && | ||
cmake ../json-c && | ||
make && | ||
make install && | ||
git clone --depth 1 https://github.com/MobilityDB/MobilityDB && | ||
mkdir MobilityDB/build && | ||
cd MobilityDB/build && | ||
cmake .. -DMEOS=on -DGEOS_INCLUDE_DIR=/usr/geos39/include/ -DGEOS_LIBRARY=/usr/geos39/lib64/libgeos_c.so -DGEOS_CONFIG=/usr/geos39/bin/geos-config -DPROJ_INCLUDE_DIRS=/usr/proj81/include/ -DPROJ_LIBRARIES=/usr/proj81/lib/libproj.so && | ||
make -j && | ||
make install | ||
# Skip tests since they will be thoroughly tested in the next job | ||
CIBW_TEST_SKIP: "*" | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: pymeos_cffi-wheels-${{ matrix.os }} | ||
path: ./pymeos_cffi/wheelhouse/*.whl | ||
|
||
test_wheels: | ||
name: Test PyMEOS CFFI wheel - Python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
needs: build_wheels | ||
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" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: pymeos_cffi-wheels-${{ matrix.os }} | ||
path: ./pymeos_cffi_wheels | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
|
||
- name: Install PyMEOS dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -f ./pymeos_cffi_wheels pymeos_cffi | ||
pip install -r pymeos/dev-requirements.txt | ||
- name: Test PyMEOS with pytest | ||
working-directory: pymeos | ||
run: pytest | ||
|
||
upload_pypi: | ||
name: Upload to PyPI | ||
needs: [ test_wheels, build_sdist ] | ||
runs-on: ubuntu-22.04 | ||
if: github.repository == 'MobilityDB/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 | ||
with: | ||
skip_existing: true | ||
|
||
create_release: | ||
name: Create GitHub Release | ||
needs: [ test_wheels, build_sdist ] | ||
runs-on: ubuntu-22.04 | ||
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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.idea | ||
.vscode | ||
|
||
.micromamba | ||
d | ||
|
||
.eggs | ||
build | ||
dist | ||
|
||
*.egg-info | ||
|
||
*.c | ||
*.pyc | ||
*.o | ||
*.so | ||
|
||
test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
PostgreSQL License | ||
|
||
------------------------------------------------------------------------------- | ||
This PyMEOS CFFI code is provided under The PostgreSQL License. | ||
|
||
Copyright (c) 2020, Université libre de Bruxelles and PyMEOS CFFI contributors | ||
|
||
PyMEOS CFFI includes MEOS, which includes portions of PostGIS version 3 source code released under the GNU General | ||
Public License (GPLv2 or later). Copyright (c) 2001-2023, PostGIS contributors | ||
|
||
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby | ||
granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. | ||
|
||
IN NO EVENT SHALL UNIVERSITÉ LIBRE DE BRUXELLES AND PYMEOS CFFI CONTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST | ||
PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF UNIVERSITÉ LIBRE DE BRUXELLES AND PYMEOS CFFI CONTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH | ||
DAMAGE. | ||
|
||
UNIVERSITÉ LIBRE DE BRUXELLES AND PYMEOS CFFI CONTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND UNIVERSITÉ LIBRE DE BRUXELLES AND PYMEOS CFFI CONTRIBUTORS HAVE NO OBLIGATIONS TO PROVIDE | ||
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | ||
------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include pymeos_cffi/builder/meos.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#  | ||
|
||
[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. | ||
|
||
PyMEOS CFFI is a Python library that wraps the MEOS C library using CFFI, providing a set of python functions | ||
that allows to use all MEOS functionality while automatically taking care of conversions between basic Python and C types | ||
(such as Python's `str` to C's `char *`). | ||
|
||
This library is not meant to be used directly by the user, since most of the functions receive or return C objects | ||
(CFFI's `cdata` type). | ||
|
||
The [PyMEOS](../pymeos) library is built on top of this library and exposes all the functionality | ||
of MEOS through a set of Python classes. | ||
|
||
# Usage | ||
|
||
## Installation | ||
|
||
````shell | ||
pip install pymeos-cffi | ||
```` | ||
|
||
## Source installation | ||
If the pre-built distribution is not available for your system, `pip` will try to make source distribution. For that, you will | ||
need to make sure you have the following requirements: | ||
|
||
- C compiler | ||
- [MEOS Library](https://www.libmeos.org/) | ||
|
||
If the installation fails, you can submit an issue in the [PyMEOS issue tracker](https://github.com/MobilityDB/PyMEOS/issues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cffi | ||
python-dateutil | ||
shapely | ||
build |
Oops, something went wrong.