From 406550b77bbfa71d30748c846b4872ee130713f2 Mon Sep 17 00:00:00 2001 From: Tpt Date: Sat, 8 Aug 2020 18:20:35 +0200 Subject: [PATCH] Improves Python documentation --- README.md | 7 +++++-- python/Cargo.toml | 9 +++++++-- python/README.md | 31 +++++++++++++++---------------- python/docs/conf.py | 2 +- python/docs/index.rst | 21 +++++++++++---------- python/src/io.rs | 2 -- 6 files changed, 39 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 28e1a7b5..4c0a8416 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Oxigraph [![Latest Version](https://img.shields.io/crates/v/oxigraph.svg)](https://crates.io/crates/oxigraph) [![Released API docs](https://docs.rs/oxigraph/badge.svg)](https://docs.rs/oxigraph) +[![PyPI](https://img.shields.io/pypi/v/pyoxigraph)](https://pypi.org/project/pyoxigraph/) [![npm](https://img.shields.io/npm/v/oxigraph)](https://www.npmjs.com/package/oxigraph) [![actions status](https://github.com/oxigraph/oxigraph/workflows/build/badge.svg)](https://github.com/oxigraph/oxigraph/actions) [![Gitter](https://badges.gitter.im/oxigraph/community.svg)](https://gitter.im/oxigraph/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) @@ -19,13 +20,15 @@ It is split into multiple parts: * The `lib` directory contains the database written as a Rust library. [![Latest Version](https://img.shields.io/crates/v/oxigraph.svg)](https://crates.io/crates/oxigraph) [![Released API docs](https://docs.rs/oxigraph/badge.svg)](https://docs.rs/oxigraph) -* The `python` directory contains bindings to use Oxigraph in Python. See [its README](https://github.com/oxigraph/oxigraph/blob/master/python/README.md) for the Python bindings documentation. +* The `python` directory contains Pyoxigraph. Pyoxigrapg allows to use Oxigraph in Python. See the [Pyoxigraph website](https://oxigraph.org/pyoxigraph/) for Pyoxigraph documentation. [![PyPI](https://img.shields.io/pypi/v/pyoxigraph)](https://pypi.org/project/pyoxigraph/) * The `js` directory contains bindings to use Oxigraph in JavaScript with the help of WebAssembly. See [its README](https://github.com/oxigraph/oxigraph/blob/master/js/README.md) for the JS bindings documentation. [![npm](https://img.shields.io/npm/v/oxigraph)](https://www.npmjs.com/package/oxigraph) * The `server` directory contains a stand-alone binary of a web server implementing the [SPARQL 1.1 Protocol](https://www.w3.org/TR/sparql11-protocol/). It uses the [RocksDB](https://rocksdb.org/) key-value store. [![Latest Version](https://img.shields.io/crates/v/oxigraph_server.svg)](https://crates.io/crates/oxigraph_server) +[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/oxigraph/oxigraph?sort=semver)](https://hub.docker.com/repository/docker/oxigraph/oxigraph) * The `wikibase` directory contains a stand-alone binary of a web server able to synchronize with a [Wikibase instance](https://wikiba.se/). -[![Latest Version](https://img.shields.io/crates/v/oxigraph_wikibase.svg)](https://crates.io/crates/oxigraph_wikibase) +[![Latest Version](https://img.shields.io/crates/v/oxigraph_wikibase.svg)](https://crates.io/crates/oxigraph_wikibase) +[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/oxigraph/oxigraph-wikibase?sort=semver)](https://hub.docker.com/repository/docker/oxigraph/oxigraph-wikibase) Oxigraph implements the following specifications: * [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/). diff --git a/python/Cargo.toml b/python/Cargo.toml index ced83729..7459fc8b 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pyoxigraph" version = "0.1.0-rc.1" -authors = ["Tpt "] +authors = ["Tpt"] license = "MIT/Apache-2.0" readme = "README.md" keywords = ["RDF", "SPARQL", "graph-database", "database"] @@ -33,4 +33,9 @@ classifier = [ "Programming Language :: Python :: 3.8", "Programming Language :: Rust", "Topic :: Database :: Database Engines/Servers" -] \ No newline at end of file +] +project-url = [ + "Documentation, https://oxigraph.org/pyoxigraph/", + "Source, https://github.com/oxigraph/oxigraph/tree/master/python" +] +requires-python = ">=3.5" diff --git a/python/README.md b/python/README.md index e121bc70..28ff3155 100644 --- a/python/README.md +++ b/python/README.md @@ -1,5 +1,5 @@ -Oxigraph for Python (`pyoxigraph`) -================================== +Pyoxigraph (Oxigraph for Python) +================================ [![PyPI](https://img.shields.io/pypi/v/pyoxigraph)](https://pypi.org/project/pyoxigraph/) ![PyPI - Implementation](https://img.shields.io/pypi/implementation/pyoxigraph) @@ -7,44 +7,43 @@ Oxigraph for Python (`pyoxigraph`) [![actions status](https://github.com/oxigraph/oxigraph/workflows/build/badge.svg)](https://github.com/oxigraph/oxigraph/actions) [![Gitter](https://badges.gitter.im/oxigraph/community.svg)](https://gitter.im/oxigraph/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -Pyoxigraph is a Python library on top of Oxigraph. - -Oxigraph is a graph database implementing the [SPARQL](https://www.w3.org/TR/sparql11-overview/) standard. - -It offers two stores with [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/) capabilities. +Pyoxigraph is a graph database library implementing the [SPARQL](https://www.w3.org/TR/sparql11-overview/) standard. +It is a Python library written on top of [Oxigraph](https://github.com/oxigraph/oxigraph). + +Pyoxigraph offers two stores with [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/) capabilities. One of the store is in-memory, and the other one is disk based. -It also provides a set of utility functions for reading, writing and processing RDF files. - -The stores are also able to load and dump RDF data serialized in +It also provides a set of utility functions for reading, writing and processing RDF files in [Turtle](https://www.w3.org/TR/turtle/), [TriG](https://www.w3.org/TR/trig/), [N-Triples](https://www.w3.org/TR/n-triples/), [N-Quads](https://www.w3.org/TR/n-quads/) and [RDF/XML](https://www.w3.org/TR/rdf-syntax-grammar/). -It is distributed on Pypi using the [`pyoxigraph` package](https://pypi.org/project/pyoxigraph/). +Pyoxigraph is distributed [on Pypi](https://pypi.org/project/pyoxigraph/). Run `pip install pyoxigraph` to install it. +Pyoxigraph documentation is [available on Oxigraph website](https://oxigraph.org/pyoxigraph/). + ## Build the development version -To build and install the lastest version of pyoxigraph you need to clone this git repository +To build and install the development version of pyoxigraph you need to clone this git repository and to run `pip install .` in the `python` directory (the one this README is in). ## How to contribute -The Oxigraph bindings are written in Rust using [PyO3](https://github.com/PyO3/pyo3). +Pyoxigraph is written in Rust using [PyO3](https://github.com/PyO3/pyo3). -They are build using [Maturin](https://github.com/PyO3/maturin). +Pyoxigraph is build using [Maturin](https://github.com/PyO3/maturin). Maturin could be installed using the usual `pip install maturin`. -To install development version of Oxigraph just run `maturin develop`. +To install a development version of Oxigraph just run `maturin develop`. The Python bindings tests are written in Python. To run them use the usual `python -m unittest` in the `tests` directory. -To release a new version of `pyoxigraph` run: +To release a new version of Pyoxigraph run: ```bash docker run --rm -v $(pwd):/io konstin2/maturin publish ``` diff --git a/python/docs/conf.py b/python/docs/conf.py index 6d1c8e52..010cf622 100644 --- a/python/docs/conf.py +++ b/python/docs/conf.py @@ -8,7 +8,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent.absolute())) # -- Project information ----------------------------------------------------- -project = "Oxigraph" +project = "pyoxigraph" copyright = f"{datetime.date.today().year}, Oxigraph contributors" author = pyoxigraph.__author__ version = pyoxigraph.__version__ diff --git a/python/docs/index.rst b/python/docs/index.rst index 7d531b2f..ba460a93 100644 --- a/python/docs/index.rst +++ b/python/docs/index.rst @@ -1,5 +1,5 @@ -Oxigraph Python (``pyoxigraph`` |release|) -========================================== +pyoxigraph |release| +==================== .. image:: https://img.shields.io/pypi/v/pyoxigraph :alt: PyPI @@ -12,30 +12,31 @@ Oxigraph Python (``pyoxigraph`` |release|) :alt: PyPI - License -Oxigraph is a graph database implementing the `SPARQL `_ standard. +Pyoxigraph is a graph database library implementing the `SPARQL `_ standard. + +It is built on top of `Oxigraph `_ using `PyO3 `_ to provides a Python API. It offers two stores with `SPARQL 1.1 Query `_ capabilities. One of the store is in-memory, and the other one is disk based. -It also provides a set of utility functions for reading, writing and processing RDF files. - -The stores are also able to load and dump RDF data serialized in +It also provides a set of utility functions for reading, writing and processing RDF files in `Turtle `_, `TriG `_, `N-Triples `_, `N-Quads `_ and `RDF/XML `_. -Oxigraph Python is distributed on Pypi using the `pyoxigraph `_ package. -It can be installed using the usual ``pip install pyoxigraph``. +pyoxigraph is `distributed on Pypi `_. -Oxigraph source code is on `GitHub `_. +Oxigraph and pyoxigraph source code are on `GitHub `_. Installation """""""""""" -Just run the usual ``pip install pyoxigraph``. +Pyoxigraph is distributed on `Pypi `_. + +To install it, run the usual ``pip install pyoxigraph`` Example diff --git a/python/src/io.rs b/python/src/io.rs index 63f733be..b8e28c5c 100644 --- a/python/src/io.rs +++ b/python/src/io.rs @@ -104,8 +104,6 @@ pub fn parse( /// :type output: io.RawIOBase or io.BufferedIOBase /// :param mime_type: the MIME type of the RDF serialization /// :type mime_type: str -/// :return: the serialized RDF -/// :rtype: bytes /// :raises ValueError: if the MIME type is not supported /// :raises TypeError: if a triple is given during a quad format serialization or reverse ///