A Python wrapper module for OpenTrep
Project description
OpenTrepWrapper
Refefences
- OpenTREP project: https://github.com/trep/opentrep
- This GitHub project: https://github.com/trep/wrapper
- OpenTravelData (OPTD) project: https://github.com/opentraveldata/opentraveldata
- How to install
pyenv
andpipenv
Configuration
Installation of OpenTREP
This module does not install OpenTREP, you have to do that.
On RedHat/CentOS/Fedora, OpenTREP is packaged and can therefore easily
be installed with the native packager manager (dnf
or yum
).
On the platforms, it can be installed by following the instructions
in the README.md
file.
For the remaining of this document, it assumed that OpenTREP has been
installed from the sources in ${HOME}/dev/deliveries/opentrep-latest
.
You can easily customize the PYTHONPATH
and LD_LIBRARY_PATH
environment variables to suit your own settings.
- You may put the package created by
setuptools
in the repository with:
$ export TREP_DIR="${HOME}/dev/deliveries/opentrep-latest"
$ export PYTHONPATH="${TREP_DIR}/lib/python3.7/site-packages/pyopentrep:${TREP_DIR}/lib"
$ export LD_LIBRARY_PATH="${TREP_DIR}/lib"
$ export PATH="${TREP_DIR}/bin:${PATH}"
Installation of pyenv
and pipenv
- Install Python:
$ pyenv install 3.8.2
$ pyenv global 3.8.2 && pip install -U pip pipenv && pyenv global system
- Clone this Git repository:
$ mkdir -p ~/dev/geo/trep && git clone https://github.com/trep/wrapper.git ~/dev/geo/trep/wrapper
- Install the Python virtual environment:
$ cd ~/dev/geo/trep/wrapper
$ pipenv install && pipenv install --dev
Test the wrapper application
- In the following Python examples, it is assumed that an interactive Python Shell has been launched:
$ pipenv run python
- Or, on MacOS:
$ ASAN_OPTIONS=detect_container_overflow=0 \
DYLD_INSERT_LIBRARIES=/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib \
/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
- Import the module:
>>> from OpenTrepWrapper import main_trep, index_trep
>>> from OpenTrepWrapper import DEFAULT_LOG, DEFAULT_FMT, DEFAULT_DB
- Index the OPTD data file:
>>> index_trep (xapianDBPath = '/tmp/opentrep/xapian_traveldb', logFilePath = '/tmp/opentrep/opeentrep-indexer.log', verbose = False)
- Search:
>>> main_trep (searchString = 'nce sfo', outputFormat = 'S', xapianDBPath = '/tmp/opentrep/xapian_traveldb', logFilePath = '/tmp/opentrep/opeentrep-searcher.log', verbose = False)
([(89.8466, 'NCE'), (357.45599999999996, 'SFO')], '')
- End the Python session:
>>> quit()
- On MacOS, if there is an issue with the interceptors:
$ ASAN_OPTIONS=detect_container_overflow=0 \
DYLD_INSERT_LIBRARIES=/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib \
/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python test.py
......
----------------------------------------------------------------------
Ran 6 tests in 2.832s
OK
Release OpenTrepWrapper to PyPi
- Build the Python artifacts for OpenTrepWrapper:
$ rm -rf dist && mkdir dist
$ pipenv run python setup.py sdist bdist_wheel bdist_egg
$ ls -lFh dist
total 48
-rw-r--r-- 1 user staff 7.1K Nov 22 01:03 OpenTrepWrapper-0.7.4.post3-py3-none-any.whl
-rw-r--r-- 1 user staff 6.7K Nov 22 01:03 OpenTrepWrapper-0.7.4.post3-py3.7.egg
-rw-r--r-- 1 user staff 6.2K Nov 22 01:03 OpenTrepWrapper-0.7.4.post3.tar.gz
- Publish to PyPi:
$ pipenv run twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for OpenTrepWrapper-0.7.5.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7376cc0524533639f89b1039b93fbf57e222180c4162822c266d7cc2eca6b9de |
|
MD5 | 4974a44c701cc51910226bf16c25a3e0 |
|
BLAKE2b-256 | 3d6cb599a7e688aa5d4d29c856018312ce588270a83cd01de39e732308a2c9fd |
Close
Hashes for OpenTrepWrapper-0.7.5.post1-py3.8.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 729fb17a8f0558c0de51105c9993f65e76442a4337e2fe9bc9dbeee69cf25da7 |
|
MD5 | d783c80cb9acbed6ecd750febaafa037 |
|
BLAKE2b-256 | f1450152b7d3da1a9a6cadde4b756a712512cd2d81ecab20cddab0276a547e04 |
Close
Hashes for OpenTrepWrapper-0.7.5.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1e6253ce14167525a607047de7c8c0f6c360c4f408837f426ee10f9908074cd |
|
MD5 | f2dfbc77ec6e345f2751c0932e174ee7 |
|
BLAKE2b-256 | 1708bda85701af0bd9f2392199a145548b78e8b2d5d040a9f92fb02b0f59f612 |