Merge branch 'fix-reactor-tests'

This commit is contained in:
Jack Robison 2018-10-02 09:09:34 -04:00
commit bdf6887791
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
4 changed files with 25 additions and 23 deletions

View file

@ -1,8 +1,8 @@
# Installing LBRY
The recommended way to install LBRY is to use an installer. We provide installers for all major operating systems. See the [README](README.md).
If only the json-rpc API server is needed the recommended way to install LBRY is to use a pre-built binary. We provide binaries for all major operating systems. See the [README](README.md).
These instructions are for installing from source code, which is recommended if you are interested in doing development work or LBRY is not available on your operating system (godspeed, TempleOS users).
These instructions are for installing LBRY from source, which is recommended if you are interested in doing development work or LBRY is not available on your operating system (godspeed, TempleOS users).
## Prerequisites
@ -10,7 +10,7 @@ Before starting, you'll need to install some additional libraries depending on y
### Python
LBRY requires Python 2.7. Python 3 is not supported.
Running `lbrynet` from source requires [Python 3.7](https://www.python.org/downloads/release/python-370/)
### OS X Prerequisites
@ -30,7 +30,7 @@ sudo pip install virtualenv
On Ubuntu (we recommend 16.04), install the following:
```
sudo apt-get install build-essential python2.7 python2.7-dev python-pip git python-virtualenv libssl-dev libffi-dev python-protobuf
sudo apt-get install build-essential python3.7 python3.7-dev git python-virtualenv libssl-dev python-protobuf
```
On Raspbian, you will also need to install `python-pyparsing`.
@ -54,11 +54,9 @@ If using virtualenv, which is recommended, copy the *PYTHONPATH\Lib\distutils* d
It's recommended to use [Unofficial Windows Binaries for Python Extension Packages](http://www.lfd.uci.edu/~gohlke/pythonlibs/) for as many of the required packages as possible.
Currently, available binaries include:
- Cython
- Twisted
- Zope.interface
- pywin32
- requests
Install the above binaries with `pip install *.whl`
@ -74,19 +72,23 @@ To install:
git clone https://github.com/lbryio/lbry.git
cd lbry
virtualenv lbry-venv
virtualenv lbry-venv --python=python3.7
source lbry-venv/bin/activate
python --version # Python 3 is not supported. Make sure you're on Python 2.7
pip install -U -r requirements.txt
pip install -U -r requirements_testing.txt
pip install --editable .
python --version # Python 2 is not supported. Make sure you're on Python 3.7
pip install --editable .[test] # [test] installs extras needed for running the tests
```
To start LBRY, run `lbrynet-daemon` in a terminal.
To run the unit tests from the repo directory:
```
trial --reactor=asyncio tests.unit
```
To verify your install, `which lbrynet-daemon` should return a path inside of the `lbry-venv` folder created by the `virtualenv` command.
To start the API server:
`lbrynet start`
To verify your install, `which lbrynet` should return a path inside of the `lbry-venv` folder created by the `virtualenv` command.
## Making a Change
@ -102,6 +104,6 @@ Then run:
pip install --editable .
```
This will install `lbrynet-daemon` in such a way that the changes you make to the code will be used as soon as you restart the daemon.
This will install `lbrynet` in such a way that the changes you make to the code will be used as soon as you restart the API server.
Happy hacking!

View file

@ -2,9 +2,7 @@
LBRY is an open-source protocol providing distribution, discovery, and purchase of digital content (data) via a decentralized network. It utilizes the [LBRY blockchain](https://github.com/lbryio/lbrycrd) as a global namespace and database of digital content. Blockchain entries contain searchable content metadata, identities, and rights and access rules. LBRY also provides a data network that consists of peers uploading and downloading data from other peers, possibly in exchange for payments, and a distributed hash table, used by peers to discover other peers.
This project aims to provide a daemon that can interact with the network via a json-rpc interface over HTTP.
The project is written in Python 3.7+ and extensively uses Twisted framework.
This project provides an SDK for building applications using the LBRY protocol. The SDK is written in Python 3.7+ using Twisted. For other languages or platforms, a JSONRPC API is provided.
## Installation
@ -12,13 +10,13 @@ Our [releases page](https://github.com/lbryio/lbry/releases) contains pre-built
## Usage
Run `lbrynet start` to launch the daemon.
Run `lbrynet start` to launch the API server.
By default, `lbrynet` will provide a JSON-RPC server at `http://localhost:5279`. It is easy to interact with via cURL or sane programming languages.
Our [quickstart guide](http://lbry.io/quickstart) provides a simple walkthrough and examples for learning.
The full API is documented [here](https://lbryio.github.io/lbry/cli).
The full API is documented [here](https://lbry.tech/api/sdk).
## Running from source
@ -42,4 +40,4 @@ The primary contact for this project is [@jackrobison](mailto:jack@lbry.io)
## Additional information and links
The documentation for the api can be found [here](https://lbry.io/api).
The documentation for the api can be found [here](https://lbry.tech/api/sdk).

View file

@ -4,12 +4,13 @@ if 'twisted.internet.reactor' not in sys.modules:
asyncioreactor.install()
else:
from twisted.internet import reactor
if not isinstance(reactor, asyncioreactor.AsyncioSelectorReactor):
if not isinstance(reactor, asyncioreactor.AsyncioSelectorReactor) and getattr(sys, 'frozen', False):
# pyinstaller hooks install the default reactor before
# any of our code runs, see kivy for similar problem:
# https://github.com/kivy/kivy/issues/4182
del sys.modules['twisted.internet.reactor']
asyncioreactor.install()
from twisted.internet import reactor
import json
import asyncio

View file

@ -22,6 +22,7 @@ setup(
'console_scripts': 'lbrynet=lbrynet.cli:main'
},
install_requires=[
'asyncio',
'aiohttp',
'twisted[tls]==18.7.0',
'appdirs',