Skip to content
Snippets Groups Projects
Commit 32505718 authored by Nico's avatar Nico
Browse files

Set up flit for briar-wrapper

Closes
#2.
parent 22f3fd30
No related branches found
No related tags found
1 merge request!2Set up flit for briar-wrapper
Pipeline #3992 passed
Showing with 59 additions and 36 deletions
.coverage
__pycache__
dist
......@@ -8,6 +8,18 @@ It uses the
[Briar REST API](https://code.briarproject.org/briar/briar/blob/master/briar-headless/README.md)
and therefore requires Java.
## Installation
The easiest way to install Briar Wrapper is to
install [the package from PyPi.org](https://pypi.org/project/briar_wrapper/):
`pip install briar_wrapper`
You can also build it yourself by runninng the following command:
`flit build`
Note that you need to [have installed flit](https://pypi.org/project/flit/) to
do this.
## Design Goals
* Main platform is GNU/Linux, but should also support (at least) Windows and macOS
......
......@@ -2,10 +2,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
project(
'briar-wrapper',
version: '0.1.0',
meson_version: '>= 0.50.0',
)
"""Wrapper for the Briar REST API"""
subdir('src')
__version__ = "0.0.2"
......@@ -9,8 +9,8 @@ from time import sleep
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
from briar.api.constants import BASE_HTTP_URL, BRIAR_AUTH_TOKEN, BRIAR_DB
from briar.api.models.socket_listener import SocketListener
from briar_wrapper.constants import BASE_HTTP_URL, BRIAR_AUTH_TOKEN, BRIAR_DB
from briar_wrapper.models.socket_listener import SocketListener
class Api:
......
File moved
File moved
......@@ -7,8 +7,8 @@ from urllib.parse import urljoin
from requests import get as _get
from requests import post as _post
from briar.api.constants import BASE_HTTP_URL
from briar.api.model import Model
from briar_wrapper.constants import BASE_HTTP_URL
from briar_wrapper.model import Model
class Contacts(Model):
......
......@@ -7,8 +7,8 @@ from urllib.parse import urljoin
from requests import get as _get
from requests import post as _post
from briar.api.constants import BASE_HTTP_URL
from briar.api.model import Model
from briar_wrapper.constants import BASE_HTTP_URL
from briar_wrapper.model import Model
class PrivateChat(Model):
......
......@@ -8,8 +8,8 @@ from threading import Thread
import websockets
from briar.api.constants import WEBSOCKET_URL
from briar.api.model import Model
from briar_wrapper.constants import WEBSOCKET_URL
from briar_wrapper.model import Model
class SocketListener(Model): # pylint: disable=too-few-public-methods
......
[build-system]
requires = ["flit"]
build-backend = "flit.buildapi"
[tool.flit.metadata]
module = "briar_wrapper"
author = "Briar Community"
author-email = "contact@briarproject.org"
home-page = "https://code.briarproject.org/briar/python-briar-wrapper"
requires = [
"requests2>=2.16.0",
"websockets>=8.0.2",
]
requires-python=">=3"
description-file="README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Java",
"Programming Language :: Python :: 3",
"Topic :: Communications :: Chat",
]
[tool.flit.metadata.urls]
"Bug Tracker" = "https://code.briarproject.org/briar/python-briar-wrapper/issues/"
"Briar REST API" = "https://code.briarproject.org/briar/briar/blob/master/briar-headless/README.md"
# Copyright (c) 2019 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
PACKAGE_DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
MODULE_DIR = join_paths(PACKAGE_DATA_DIR, 'briar')
python3 = import('python3')
conf = configuration_data()
conf.set('PYTHON', python3.find_python().path())
conf.set('VERSION', meson.project_version())
conf.set('PACKAGE_DATA_DIR', PACKAGE_DATA_DIR)
install_subdir('briar/api', install_dir: MODULE_DIR)
......@@ -6,7 +6,7 @@ import json
import requests_mock
from briar.api.models.contacts import Contacts
from briar_wrapper.models.contacts import Contacts
BASE_HTTP_URL = "http://localhost:7000/v1/contacts/"
......
......@@ -6,7 +6,7 @@ import json
import requests_mock
from briar.api.models.private_chat import PrivateChat
from briar_wrapper.models.private_chat import PrivateChat
BASE_HTTP_URL = "http://localhost:7000/v1/messages/%s"
......
......@@ -7,8 +7,8 @@ from pathlib import Path
import pytest
from briar.api.constants import BASE_HTTP_URL, BRIAR_AUTH_TOKEN
from briar.api.constants import BRIAR_DB, WEBSOCKET_URL
from briar_wrapper.constants import BASE_HTTP_URL, BRIAR_AUTH_TOKEN
from briar_wrapper.constants import BRIAR_DB, WEBSOCKET_URL
def test_base_http_url():
......
......@@ -3,4 +3,4 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
pycodestyle --show-source --show-pep8 src tests
pycodestyle --show-source --show-pep8 briar_wrapper tests
......@@ -3,4 +3,4 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
pylint src tests
pylint briar_wrapper tests
......@@ -3,4 +3,4 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
PYTHONPATH=src pytest --cov=src tests/
PYTHONPATH=briar_wrapper pytest --cov=briar_wrapper tests/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment