From de14c5aa676c67758e058dba8033556fa4bc7f54 Mon Sep 17 00:00:00 2001 From: Diviloper Date: Sun, 21 Apr 2024 08:55:45 +0200 Subject: [PATCH 1/3] Update README installation info --- README.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d76e8d97..36bc8b6d 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,31 @@ This repository contains 2 subprojects: ````shell pip install pymeos ```` -> PyMEOS wheel should be compatible with any system, but it is possible that the pre-built distribution is + +> PyMEOS wheel should be compatible with any system, but it is possible that the pre-built distribution is > not available for PyMEOS CFFI for some OS/Architecture. -> If it is not available, see the [source installation notes on PyMEOS CFFI's readme](../pymeos_cffi#installation) +> If it is not available, see the [source installation notes on PyMEOS CFFI's readme](../pymeos_cffi#installation) > on how to proceed +### Using conda + +PyMEOS is also available on the conda-forge channel. To install it, first add the conda-forge channel to your conda +configuration: + +````shell +conda config --add channels conda-forge +conda config --set channel_priority strict +```` + +Then, you can install PyMEOS using the following command: + +````shell +conda install conda-forge::pymeos +```` + ## Sample code -> **IMPORTANT** Before using any PyMEOS function, always call `pymeos_initialize`. Otherwise, the library will +> **IMPORTANT** Before using any PyMEOS function, always call `pymeos_initialize`. Otherwise, the library will > crash with a `Segmentation Fault` error. You should also always call `pymeos_finalize` at the end of your code. ````python @@ -38,10 +55,14 @@ from pymeos import pymeos_initialize, pymeos_finalize, TGeogPointInst, TGeogPoin # Important: Always initialize MEOS library pymeos_initialize() -sequence_from_string = TGeogPointSeq(string='[Point(10.0 10.0)@2019-09-01 00:00:00+01, Point(20.0 20.0)@2019-09-02 00:00:00+01, Point(10.0 10.0)@2019-09-03 00:00:00+01]') +sequence_from_string = TGeogPointSeq( + string='[Point(10.0 10.0)@2019-09-01 00:00:00+01, Point(20.0 20.0)@2019-09-02 00:00:00+01, Point(10.0 10.0)@2019-09-03 00:00:00+01]') print(f'Output: {sequence_from_string}') -sequence_from_points = TGeogPointSeq(instant_list=[TGeogPointInst(string='Point(10.0 10.0)@2019-09-01 00:00:00+01'), TGeogPointInst(string='Point(20.0 20.0)@2019-09-02 00:00:00+01'), TGeogPointInst(string='Point(10.0 10.0)@2019-09-03 00:00:00+01')], lower_inc=True, upper_inc=True) +sequence_from_points = TGeogPointSeq(instant_list=[TGeogPointInst(string='Point(10.0 10.0)@2019-09-01 00:00:00+01'), + TGeogPointInst(string='Point(20.0 20.0)@2019-09-02 00:00:00+01'), + TGeogPointInst(string='Point(10.0 10.0)@2019-09-03 00:00:00+01')], + lower_inc=True, upper_inc=True) speed = sequence_from_points.speed() print(f'Speeds: {speed}') @@ -53,4 +74,5 @@ For more examples, see [PyMEOS Examples repository](https://github.com/MobilityD # Documentation -Visit our [ReadTheDocs page](https://pymeos.readthedocs.io/en/latest/) for a more complete and detailed documentation, including an installation manual and several examples. \ No newline at end of file +Visit our [ReadTheDocs page](https://pymeos.readthedocs.io/en/latest/) for a more complete and detailed documentation, +including an installation manual and several examples. \ No newline at end of file From 325a57ff60421bbca5328079027c3aab1eba473a Mon Sep 17 00:00:00 2001 From: Diviloper Date: Sun, 21 Apr 2024 08:55:57 +0200 Subject: [PATCH 2/3] Update installation info in docs --- docs/index.rst | 16 ++++++++-- docs/src/installation.rst | 62 ++++++++++++++++++++++++++------------- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index befc8409..0de31b2b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,11 +22,23 @@ Installing PyMEOS ================== We recommend installing PyMEOS using one of the available built -distributions using ``pip``: +distributions using ``pip`` or ``conda``: + +Using ``pip``: .. code-block:: console - $ pip install pymeos + pip install pymeos + + +Using ``conda``: + +.. code-block:: console + + conda config --add channels conda-forge + conda config --set channel_priority strict + conda install -c conda-forge pymeos + See the `installation documentation <./src/installation.html>`__ for more details and advanced installation instructions. diff --git a/docs/src/installation.rst b/docs/src/installation.rst index b0fa609a..71ff2e0f 100644 --- a/docs/src/installation.rst +++ b/docs/src/installation.rst @@ -10,21 +10,31 @@ and can be installed using ``pip``. Installation from PyPI ^^^^^^^^^^^^^^^^^^^^^^ -PyMEOS and PyMEOS CFFI are available as binary distributions (wheel) for Linux platforms on -`PyPI `__. The distributions include the most recent version of MEOS available at the -time of the PyMEOS release. Install the binary wheel with pip as follows: +PyMEOS and PyMEOS CFFI are available as binary distributions (wheel) for Linux (x64) and MacOS (x64 and arm64) platforms +on `PyPI `__. The distributions include the most recent version of MEOS available at +the time of the PyMEOS release. Install the binary wheel with pip as follows: .. code-block:: console - $ pip install pymeos + pip install pymeos Installation using conda ^^^^^^^^^^^^^^^^^^^^^^^^ -PyMEOS is available on the conda-forge channel. Install as follows:: +PyMEOS is also available on the conda-forge channel. +First, set conda-forge as the priority channel: - $ conda install conda-forge::pymeos +.. code-block:: console + + conda config --add channels conda-forge + conda config --set channel_priority strict + +Then, install PyMEOS as follows: + +.. code-block:: console + + conda install conda-forge::pymeos Installation from source with custom MEOS library @@ -40,10 +50,12 @@ since PyMEOS is a pure Python package and doesn't interact with MEOS directly. First, make sure that MEOS is installed in your system. You can install it following the instructions in the `MEOS documentation `__. -Then, install PyMEOS CFFI from source:: +Then, install PyMEOS CFFI from source: + +.. code-block:: console - $ pip install pymeos-cffi --no-binary pymeos-cffi - $ pip install pymeos + pip install pymeos-cffi --no-binary pymeos-cffi + pip install pymeos Updating the PyMEOS CFFI wrapper for custom MEOS library @@ -60,31 +72,41 @@ using the builder scripts provided in the ``pymeos_cffi`` package. hasn't changed, or you'll get an import error when using ``pymeos``. First, you will need to get the source code of PyMEOS CFFI. You can do so by downloading the source distribution -from PyPI, or by cloning the repository from GitHub:: +from PyPI, or by cloning the repository from GitHub: + +.. code-block:: console - $ git clone git@github.com:MobilityDB/PyMEOS.git - $ cd PyMEOS/pymeos_cffi + git clone git@github.com:MobilityDB/PyMEOS.git + cd PyMEOS/pymeos_cffi Then, you will need to run the header builder script, which will generate a new header file based on the MEOS version installed in your system. The script accepts two parameters, a path to the MEOS header file, and a path to your -MEOS library:: +MEOS library: + +.. code-block:: console - $ python3 ./pymeos_cffi/builder/build_header.py + python3 ./pymeos_cffi/builder/build_header.py -If no parameters are passed, the script will use the default header file and library path:: +If no parameters are passed, the script will use the default header file and library path: + +.. code-block:: console - $ python3 ./pymeos_cffi/builder/build_header.py /usr/local/include/meos.h /usr/local/lib/libmeos.so + python3 ./pymeos_cffi/builder/build_header.py /usr/local/include/meos.h /usr/local/lib/libmeos.so The second parameter is optional and is used to remove any function defined in the header file not exposed by the library. If omitted, this step will not be performed. -Then, you have to generate the PyMEOS CFFI wrapper functions using the functions builder script:: +Then, you have to generate the PyMEOS CFFI wrapper functions using the functions builder script: - $ python3 ./pymeos_cffi/builder/build_pymeos_functions.py +.. code-block:: console + + python3 ./pymeos_cffi/builder/build_pymeos_functions.py This will update the ``functions.py`` file that contains all the python functions exposed by the library. -Finally, you can install the updated PyMEOS CFFI package:: +Finally, you can install the updated PyMEOS CFFI package: + +.. code-block:: console - $ pip install . + pip install . From 67e080d4f83b6b03e00e596c6d0d46f94bd5a332 Mon Sep 17 00:00:00 2001 From: Diviloper Date: Sun, 21 Apr 2024 09:01:14 +0200 Subject: [PATCH 3/3] Update installation readme --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 36bc8b6d..f7d28b17 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ This repository contains 2 subprojects: ## Installation +You can install PyMEOS (`pymeos` and `pymeos-cffi`) using `pip`, `conda`, or from sources. + +### Using pip + ````shell pip install pymeos ```` @@ -44,6 +48,11 @@ Then, you can install PyMEOS using the following command: conda install conda-forge::pymeos ```` +### Source installation + +For detailed instructions on how to install PyMEOS from sources, see +the [installation page](https://pymeos.readthedocs.io/en/latest/src/installation.html#) in the PyMEOS Documentation. + ## Sample code > **IMPORTANT** Before using any PyMEOS function, always call `pymeos_initialize`. Otherwise, the library will @@ -69,8 +78,12 @@ print(f'Speeds: {speed}') # Call finish at the end of your code pymeos_finalize() ```` +```` +Output: [POINT(10 10)@2019-09-01 01:00:00+02, POINT(20 20)@2019-09-02 01:00:00+02, POINT(10 10)@2019-09-03 01:00:00+02] +Speeds: Interp=Step;[17.84556057812839@2019-09-01 01:00:00+02, 17.84556057812839@2019-09-03 01:00:00+02] +```` -For more examples, see [PyMEOS Examples repository](https://github.com/MobilityDB/PyMEOS-Examples) +For more examples and use-cases, see [PyMEOS Examples repository](https://github.com/MobilityDB/PyMEOS-Examples) # Documentation