Skip to content
Snippets Groups Projects
Commit 861671b8 authored by inso's avatar inso
Browse files

Merge branch 'dev'

parents 3287840a 0ccbd5eb
No related branches found
No related tags found
No related merge requests found
Pipeline #2778 passed
# Duniter Python API
[![Coverage Status](https://coveralls.io/repos/duniter/duniter-python-api/badge.svg?branch=master&service=github)](https://coveralls.io/github/duniter/duniter-python-api?branch=master)
Python implementation of [Duniter](https://git.duniter.org/nodes/typescript/duniter) BMA API
## Features
* Supports Duniter's [Basic Merkle API](https://git.duniter.org/nodes/typescript/duniter/blob/master/doc/HTTP_API.md) and [protocol](https://git.duniter.org/nodes/typescript/duniter/blob/master/doc/Protocol.md)
* Asynchronous
* Duniter signing key
## Requirements
* Python >= 3.5
* [aiohttp >= 0.19](https://pypi.python.org/pypi/aiohttp "aiohttp")
* [pylibscrypt](https://pypi.python.org/pypi/pylibscrypt "pylibscrypt")
* [libnacl](https://pypi.python.org/pypi/libnacl "libnacl")
* [base58](https://pypi.python.org/pypi/base58 "base58")
## Installation
You can install duniter-python-api and all its dependencies via the following pip install:
`pip3 install duniterpy`
Please take a look at the document [HTTP API](https://git.duniter.org/nodes/typescript/duniter/blob/master/doc/HTTP_API.md) to learn about the API.
## Development
- Create a python environment with pyenv
- Add PYTHONPATH env var to your shell containing the path to this repository
- Take a look at examples
- Run examples from parent folder `python example/request_data.py`
## Documentation
- [HTML Documentation](https://git.duniter.org/clients/python/duniterpy/tree/master/docs/_build/html)
- [Examples](https://git.duniter.org/clients/python/duniterpy/tree/master/examples)
Duniter Python API
==================
.. image:: https://coveralls.io/repos/duniter/duniter-python-api/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/duniter/duniter-python-api?branch=master
Python implementation of `Duniter <https://git.duniter.org/nodes/typescript/duniter>`_ BMA API
Features
--------
* Supports Duniter's `Basic Merkle API <https://git.duniter.org/nodes/typescript/duniter/blob/master/doc/HTTP_API.md>`_ and `protocol <https://git.duniter.org/nodes/typescript/duniter/blob/master/doc/Protocol.md>`_
* Asynchronous
* Duniter signing key
Requirements
------------
* Python >= 3.5
* `aiohttp >= 0.19 <https://pypi.python.org/pypi/aiohttp>`_
* `pylibscrypt <https://pypi.python.org/pypi/pylibscrypt>`_
* `libnacl <https://pypi.python.org/pypi/libnacl>`_
* `base58 <https://pypi.python.org/pypi/base58>`_
Installation
------------
You can install duniter-python-api and all its dependencies via the following pip install:
:code:`pip3 install duniterpy`
Please take a look at the document `HTTP API <https://git.duniter.org/nodes/typescript/duniter/blob/master/doc/HTTP_API.md>`_ to learn about the API.
Development
-----------
* Create a python environment with pyenv
* Add PYTHONPATH env var to your shell containing the path to this repository
* Take a look at examples
* Run examples from parent folder :code:`python examples/request_data.py`
Documentation
-------------
* `HTML Documentation <https://git.duniter.org/clients/python/duniterpy/tree/master/docs/_build/html>`_
* `Examples <https://git.duniter.org/clients/python/duniterpy/tree/master/examples>`_
Packaging and deploy
--------------------
Pypi
++++
*The README file must be in RestructuredText format (README.rst) for the long description field of the package.*
In the development pyenv environment, install the following tools::
pip install --upgrade pip setuptools wheel
pip install twine
Change the version number (semantic version number)::
./release.sh 0.42.3
Build the Pypi package in the ``dist`` folder::
python setup.py sdist bdist_wheel
Deploy the package on the Pypi repository::
twine upload dist/*
import attr import attr
import re import re
from ..document import MalformedDocumentError
from ..block import BlockUID from ..block import BlockUID
from ..constants import ws2p_public_prefix_regex, ws2p_private_prefix_regex,\ from ..constants import ws2p_public_prefix_regex, ws2p_private_prefix_regex,\
pubkey_regex, signature_regex, ws2pid_regex, block_uid_regex, ws2p_head_regex pubkey_regex, signature_regex, ws2pid_regex, block_uid_regex, ws2p_head_regex
...@@ -108,7 +107,7 @@ class HeadV1: ...@@ -108,7 +107,7 @@ class HeadV1:
.format( .format(
ws2pid=ws2pid_regex, ws2pid=ws2pid_regex,
software="[A-Za-z-_]+", software="[A-Za-z-_]+",
software_version="[0-9]+[.][0-9]+[.][0-9]+", software_version="[0-9]+[.][0-9]+[.][0-9]+-?[A-Za-z0-9\.]+",
pow_prefix="[0-9]+")) pow_prefix="[0-9]+"))
v0 = attr.ib(type=HeadV0) v0 = attr.ib(type=HeadV0)
...@@ -165,7 +164,7 @@ class HeadV2: ...@@ -165,7 +164,7 @@ class HeadV2:
data = HeadV2.re_inline.match(offload) data = HeadV2.re_inline.match(offload)
free_member_room = int(data.group(1)) free_member_room = int(data.group(1))
free_mirror_room = int(data.group(2)) free_mirror_room = int(data.group(2))
return cls(v1, free_member_room, free_mirror_room), offload return cls(v1, free_member_room, free_mirror_room), ""
except AttributeError: except AttributeError:
raise MalformedDocumentError("HeadV2") raise MalformedDocumentError("HeadV2")
......
...@@ -52,7 +52,7 @@ setup( ...@@ -52,7 +52,7 @@ setup(
description="A python implementation of [duniter](https://github.com/duniter/duniter) API", description="A python implementation of [duniter](https://github.com/duniter/duniter) API",
long_description=open('README.md').read(), long_description=open('README.rst').read(),
# Active la prise en compte du fichier MANIFEST.in # Active la prise en compte du fichier MANIFEST.in
include_package_data=True, include_package_data=True,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment