wrapper

Wrapper around the OpenTrep library

View the Project on GitHub trep/wrapper

OpenTrepWrapper

Table of Content (ToC)

Table of contents generated with markdown-toc

Overview

OpenTREP aims at providing a clean API, its corresponding C++ implementation and Python extension, for parsing travel-/transport-focused requests. It powers the https://transport-search.org Web site (as well as its newer version, https://www2.transport-search.org).

As part of the OpenTREP releases, there is a Python extension, named opentrep and published on PyPi. That Python extension comes as a so-called binary wheel only for MacOS (which makes it very easy to install on that platform, then). Contributions are welcome to also build wheels for other platforms (e.g., Linux, including WSL on MS Windows). So far, for those other platforms, the Python extension has to be built from the source distribution, also available on PyPi in the same place.

OpenTrepWrapper (this project) provides a simple Python wrapper around the OpenTREP Python extension, and is also released on PyPi.

Refefences

Configuration

Installation of pyenv and pipenv

Installation of OpenTREP

This module does not install OpenTREP itself; the overview gives the general procedure on how to do it.

Also, on RedHat/CentOS/Fedora, OpenTREP is packaged and can therefore easily be installed with the native packager manager (dnf or yum).

Alternatively, on most of the platforms, it can be installed by following the instructions in the OpenTREP README.md file.

Download the OpenTravelData (OPTD) data and index them

Test of the OpenTREP Python extension

Test the wrapper application


  + JSON output format:
```python
>>> otp.search(search_string="nce sfo", outputFormat="J")
search_string: nce sfo
Raw (JSON) result from the OpenTrep library:
{
    "locations": [
        {
            "iata_code": "NCE",
            "icao_code": "LFMN",
            "geonames_id": "6299418",
            "feature_class": "S",
            "feature_code": "AIRP",
            ...
        },
        {
            "iata_code": "SFO",
            "icao_code": "",
            "geonames_id": "5391959",
            "feature_class": "P",
            "feature_code": "PPLA2",
            ...
        }
    ]
}

------------------

====================== 3 passed in 1.35s =======================


# Release OpenTrepWrapper to PyPi
* Build the Python artifacts for OpenTrepWrapper:
```bash
$ rm -rf dist build */*.egg-info *.egg-info .tox MANIFEST
$ pipenv run python setup.py sdist bdist_wheel
$ ls -lFh dist
total 56
-rw-r--r--  1 user  staff   7.7K Mar  2 11:14 OpenTrepWrapper-0.7.7.post1-py3-none-any.whl
-rw-r--r--  1 user  staff   7.3K Mar  2 11:14 OpenTrepWrapper-0.7.7.post1-py3.8.egg
-rw-r--r--  1 user  staff   8.4K Mar  2 11:14 OpenTrepWrapper-0.7.7.post1.tar.gz