Improves Python documentation

pull/46/head
Tpt 4 years ago
parent 6e76758c39
commit 406550b77b
  1. 7
      README.md
  2. 9
      python/Cargo.toml
  3. 31
      python/README.md
  4. 2
      python/docs/conf.py
  5. 21
      python/docs/index.rst
  6. 2
      python/src/io.rs

@ -3,6 +3,7 @@ Oxigraph
[![Latest Version](https://img.shields.io/crates/v/oxigraph.svg)](https://crates.io/crates/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) [![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) [![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) [![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) [![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. * 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) [![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) [![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. * 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) [![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. * 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) [![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/). * 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: Oxigraph implements the following specifications:
* [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/). * [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/).

@ -1,7 +1,7 @@
[package] [package]
name = "pyoxigraph" name = "pyoxigraph"
version = "0.1.0-rc.1" version = "0.1.0-rc.1"
authors = ["Tpt <thomas@pellissier-tanon.fr>"] authors = ["Tpt"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
readme = "README.md" readme = "README.md"
keywords = ["RDF", "SPARQL", "graph-database", "database"] keywords = ["RDF", "SPARQL", "graph-database", "database"]
@ -33,4 +33,9 @@ classifier = [
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Rust", "Programming Language :: Rust",
"Topic :: Database :: Database Engines/Servers" "Topic :: Database :: Database Engines/Servers"
] ]
project-url = [
"Documentation, https://oxigraph.org/pyoxigraph/",
"Source, https://github.com/oxigraph/oxigraph/tree/master/python"
]
requires-python = ">=3.5"

@ -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](https://img.shields.io/pypi/v/pyoxigraph)](https://pypi.org/project/pyoxigraph/)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/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) [![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) [![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. 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).
Oxigraph is a graph database implementing the [SPARQL](https://www.w3.org/TR/sparql11-overview/) standard.
Pyoxigraph offers two stores with [SPARQL 1.1 Query](https://www.w3.org/TR/sparql11-query/) capabilities.
It 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. 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. It also provides a set of utility functions for reading, writing and processing RDF files in
The stores are also able to load and dump RDF data serialized in
[Turtle](https://www.w3.org/TR/turtle/), [Turtle](https://www.w3.org/TR/turtle/),
[TriG](https://www.w3.org/TR/trig/), [TriG](https://www.w3.org/TR/trig/),
[N-Triples](https://www.w3.org/TR/n-triples/), [N-Triples](https://www.w3.org/TR/n-triples/),
[N-Quads](https://www.w3.org/TR/n-quads/) and [N-Quads](https://www.w3.org/TR/n-quads/) and
[RDF/XML](https://www.w3.org/TR/rdf-syntax-grammar/). [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. Run `pip install pyoxigraph` to install it.
Pyoxigraph documentation is [available on Oxigraph website](https://oxigraph.org/pyoxigraph/).
## Build the development version ## 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). and to run `pip install .` in the `python` directory (the one this README is in).
## How to contribute ## 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`. 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. The Python bindings tests are written in Python.
To run them use the usual `python -m unittest` in the `tests` directory. 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 ```bash
docker run --rm -v $(pwd):/io konstin2/maturin publish docker run --rm -v $(pwd):/io konstin2/maturin publish
``` ```

@ -8,7 +8,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = "Oxigraph" project = "pyoxigraph"
copyright = f"{datetime.date.today().year}, Oxigraph contributors" copyright = f"{datetime.date.today().year}, Oxigraph contributors"
author = pyoxigraph.__author__ author = pyoxigraph.__author__
version = pyoxigraph.__version__ version = pyoxigraph.__version__

@ -1,5 +1,5 @@
Oxigraph Python (``pyoxigraph`` |release|) pyoxigraph |release|
========================================== ====================
.. image:: https://img.shields.io/pypi/v/pyoxigraph .. image:: https://img.shields.io/pypi/v/pyoxigraph
:alt: PyPI :alt: PyPI
@ -12,30 +12,31 @@ Oxigraph Python (``pyoxigraph`` |release|)
:alt: PyPI - License :alt: PyPI - License
Oxigraph is a graph database implementing the `SPARQL <https://www.w3.org/TR/sparql11-overview/>`_ standard. Pyoxigraph is a graph database library implementing the `SPARQL <https://www.w3.org/TR/sparql11-overview/>`_ standard.
It is built on top of `Oxigraph <https://github.com/oxigraph/oxigraph>`_ using `PyO3 <https://pyo3.rs/>`_ to provides a Python API.
It offers two stores with `SPARQL 1.1 Query <https://www.w3.org/TR/sparql11-query/>`_ capabilities. It 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. 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. It also provides a set of utility functions for reading, writing and processing RDF files in
The stores are also able to load and dump RDF data serialized in
`Turtle <https://www.w3.org/TR/turtle/>`_, `Turtle <https://www.w3.org/TR/turtle/>`_,
`TriG <https://www.w3.org/TR/trig/>`_, `TriG <https://www.w3.org/TR/trig/>`_,
`N-Triples <https://www.w3.org/TR/n-triples/>`_, `N-Triples <https://www.w3.org/TR/n-triples/>`_,
`N-Quads <https://www.w3.org/TR/n-quads/>`_ and `N-Quads <https://www.w3.org/TR/n-quads/>`_ and
`RDF/XML <https://www.w3.org/TR/rdf-syntax-grammar/>`_. `RDF/XML <https://www.w3.org/TR/rdf-syntax-grammar/>`_.
Oxigraph Python is distributed on Pypi using the `pyoxigraph <https://pypi.org/project/pyoxigraph/>`_ package. pyoxigraph is `distributed on Pypi <https://pypi.org/project/pyoxigraph/>`_.
It can be installed using the usual ``pip install pyoxigraph``.
Oxigraph source code is on `GitHub <https://github.com/oxigraph/oxigraph/tree/master/python>`_. Oxigraph and pyoxigraph source code are on `GitHub <https://github.com/oxigraph/oxigraph/tree/master/python>`_.
Installation Installation
"""""""""""" """"""""""""
Just run the usual ``pip install pyoxigraph``. Pyoxigraph is distributed on `Pypi <https://pypi.org/project/pyoxigraph/>`_.
To install it, run the usual ``pip install pyoxigraph``
Example Example

@ -104,8 +104,6 @@ pub fn parse(
/// :type output: io.RawIOBase or io.BufferedIOBase /// :type output: io.RawIOBase or io.BufferedIOBase
/// :param mime_type: the MIME type of the RDF serialization /// :param mime_type: the MIME type of the RDF serialization
/// :type mime_type: str /// :type mime_type: str
/// :return: the serialized RDF
/// :rtype: bytes
/// :raises ValueError: if the MIME type is not supported /// :raises ValueError: if the MIME type is not supported
/// :raises TypeError: if a triple is given during a quad format serialization or reverse /// :raises TypeError: if a triple is given during a quad format serialization or reverse
/// ///

Loading…
Cancel
Save