Reference OParl Client implementation

grindhold 9962a23d05 build: bump to 0.4.0 3 years ago
.tx 445576cf86 Add transifex client config 3 years ago
examples 7afeb0878a Proper Dockerfile 3 years ago
po ca829deea1 Update meta info 3 years ago
scripts cfe245aa75 Move language list detection to external python script 3 years ago
src cd49836ebf Add get_organization_url 3 years ago
test 88f410c2f1 Remove debug check 3 years ago
.dockerignore 7afeb0878a Proper Dockerfile 3 years ago
.gitignore e83239311e i18n: got everything to compile 3 years ago
Dockerfile 9a25e55e66 Reduce docker container size 3 years ago
LICENSE f1c2c0d406 added lgp 4 years ago
README.md 7240f56fca Improve setup guide 3 years ago
meson.build 9962a23d05 build: bump to 0.4.0 3 years ago
meson_options.txt 7679b7e6b2 bump copyright years 4 years ago
oparl-0.4.deps 9962a23d05 build: bump to 0.4.0 3 years ago

README.md

liboparl

liboparl is a client library for OParl that is easily integratable in various programming languages using gobject introspections.

Features

  • Parsing all OParl objects
  • Check syntactic spec conformity - types and fieldnames are correct
  • Check semantic spec conformity - values are realistic and make sense [ in progress ]

Meta-Features

  • Unittests
  • API-Documentation (GNOME Devhelp book format)
  • i18n

Characteristics

The library's objective is to abstract OParls object format away from you. You as someone who develops an application for OParl does not need to know how to resolve the ids that objects yield to you and how to parse the objects themselves and check them for correctness.

The library does not want to interfere with your way to write programs which is why liboparl leaves all non-OParl-related tasks to you. OParl exposes anything it needs from you through signals and interfaces. For example, if liboparl wants to request a new object via HTTP, it triggers the signal resolve_url that belongs to the OParl.Client-Object. This signal gives you an url and expects to get a JSON-string back. You can implement this method however you feel is right for your project. If you program liboparl in Python you could use requests. If you program liboparl in Perl, you could use LWP. This also gives you the possibility to handle multithreading as you wish. And the best thing: liboparl can provide an API that is as clean and uncluttered as possible.

As mentioned before, liboparl is a GObject-based library. This means that you can use it in any programming language that supports GObject-Introspection. Famous examples are e.g. Python Ruby or Lua. Check if your favoured language is available at GObjectIntrospecion

Dependencies

The following libraries have to be present for liboparl to run:

  • glib-2.0 (For use with GIR-Languages on ubuntu : gir1.2-glib-2.0)
  • json-glib-1.0 (For use with GIR-Languages ubuntu: gir1.2-json-1.0)

Building

Meson > 0.40.0 is used as the buildsystem for liboparl. The build dependencies are the following:

  • valac > 0.32 - Vala compiler
  • valadoc - Vala documentation tool
  • g-ir-compiler - GObject introspection compiler (package gobject-introspection in ubuntu)
  • json-glib-dev - Dev headers for json-glib (package libjson-glib-dev in ubuntu)
  • libgirepository1.0-dev - Dev headers for gobject introspection
  • gettext

Ubuntu: sudo apt install valac valadoc gobject-introspection libjson-glib-dev libgirepository1.0-dev gettext

Clone and build the library as follows:

git clone https://github.com/oparl/liboparl
mkdir liboparl/build
cd liboparl/build
meson
ninja

Add --prefix=/usr to install systemwide on ubuntu. Add --buildtype=release for a release build.

If you desire to install the library, execute as root:

ninja install

Localization/Internationalization

All user-facing output generated by liboparl is managed with the gettext library. By default, strings are written in English and wrapped with the default _("String to be translated") function Gettext provides.

Whenever you make changes to the strings in liboparl's code base please run ninja liboparl-pot from inside your build directory to update the potfile.

If you want to contribute translations to the project you can do so at our Transifex project page: https://transifex.com/oparl/liboparl.

If you happen across an error in the source strings, please let us know by opening an issue on GitHub at https://github.com/OParl/liboparl/issues/new?labels=l10n

Running the examples

liboparl supports GObject-Introspection which means you can consume it in various popular languages including but not limited to: Python, Perl, Lua, JS, PHP. I compiled some examples on how to program against the library in Python in the examples-folder.

Feel free to add examples for your favorite language.

Note: If you installed the library in /usr/local, you have to export the following environment variables for the examples to work:

export LD_LIBRARY_PATH=/usr/local/lib
export GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0/

Docker

This repository contains a dockerfile which installs liboparl on a ubuntu base image and is automatically updated on Docker Hub. This is e.g. used for the validator