mirror of
https://github.com/aljazceru/python-teos.git
synced 2026-02-03 05:34:25 +01:00
Move requeriments to root and creates readmes
This commit is contained in:
@@ -46,6 +46,10 @@ if rcode == 0:
|
||||
rcode, message = self.check_end_time(end_time, start_time, block_height)
|
||||
```
|
||||
|
||||
## Dev requirements
|
||||
In order to contrubite you will need to install additional dependencies. They can be found at `requirements-dev.txt`. Install them by running:
|
||||
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
## Code Documentation
|
||||
Code should be, at least, documented using docstrings. We use the [Sphinx Google Style](https://www.sphinx-doc.org/en/master/usage/extensions/example_google.html#example-google) for documenting functions.
|
||||
|
||||
86
DEPENDENCIES.md
Normal file
86
DEPENDENCIES.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# Dependencies
|
||||
|
||||
`teos` has both system-wide and Python dependencies. This document walks you through how to satisfy them.
|
||||
|
||||
## System-wide dependencies
|
||||
|
||||
`teos` has the following system-wide dependencies:
|
||||
|
||||
- `python3`
|
||||
- `pip3`
|
||||
|
||||
### Checking if the dependencies are already satisfied
|
||||
|
||||
Most UNIX systems ship with `python3` already installed, whereas OSX systems tend to ship with `python2`. In order to check our python version we should run:
|
||||
|
||||
python --version
|
||||
|
||||
For what we will get something like:
|
||||
|
||||
Python 2.X.X
|
||||
|
||||
Or
|
||||
|
||||
Python 3.X.X
|
||||
|
||||
It is also likely that, if `python3` is installed in our system, the `python` alias is not set to it but instead to `python2`. In order to check so, we can run:
|
||||
|
||||
python3 --version
|
||||
|
||||
If `python3` is installed but the `python` alias is not set to it, we should either set it, or use `python3` to run `teos`.
|
||||
|
||||
Regarding `pip`, we can check what version is installed in our system (if any) by running:
|
||||
|
||||
pip --version
|
||||
|
||||
For what we will get something like:
|
||||
|
||||
pip X.X.X from /usr/local/lib/python2.X/dist-packages/pip (python 2.X)
|
||||
|
||||
Or
|
||||
|
||||
pip X.X.X from /usr/local/lib/python3.X/dist-packages/pip (python 3.X)
|
||||
|
||||
A similar thing to the `python` alias applies to the `pip` alias. We can check if pip3 is install by running:
|
||||
|
||||
pip3 --version
|
||||
|
||||
And, if it happens to be installed, change the alias to `pip3`, or use `pip3` instead of `pip`.
|
||||
|
||||
|
||||
### Installing the dependencies
|
||||
|
||||
`python3` ca be downloaded from the [Python official website](https://www.python.org/downloads/) or installed using a package manager, depending on your distribution. Examples for both UNIX-like and OSX systems are provided.
|
||||
|
||||
#### Ubuntu
|
||||
|
||||
`python3` can be installed using `apt` as follows:
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3
|
||||
|
||||
and for `pip3`:
|
||||
|
||||
sudo apt-get install python3-pip
|
||||
pip install --upgrade pip==9.0.3
|
||||
|
||||
#### OSX
|
||||
|
||||
`python3` can be installed using `Homebrew` as follows:
|
||||
|
||||
brew install python3
|
||||
|
||||
`pip3` will be installed alongside `python3` in this case.
|
||||
|
||||
## Python dependencies
|
||||
|
||||
`teos` has the following dependencies (which can be satisfied by using `pip install -r requirements.txt`):
|
||||
|
||||
- `zmq`
|
||||
- `flask`
|
||||
- `cryptography`
|
||||
- `coincurve`
|
||||
- `pyzbase32`
|
||||
- `requests`
|
||||
- `plyvel`
|
||||
|
||||
35
INSTALL.md
Normal file
35
INSTALL.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Install
|
||||
|
||||
`teos` has some dependencies that can be satisfied by following [DEPENDENCIES.md](DEPENDENCIES.md). If your system already satisfies the dependencies, you can skip that part.
|
||||
|
||||
There are two ways of running `teos`: adding the library to the `PYTHONPATH` env variable, or running it as a module.
|
||||
|
||||
## Modifying `PYTHONPATH`
|
||||
In order to run `teos`, you should set your `PYTHONPATH` env variable to include the **outer** teos folder. You can do so by running:
|
||||
|
||||
export PYTHONPATH=$PYTHONPATH:<absolute_path_to_teos>
|
||||
|
||||
For example, for user alice running a UNIX system and having `teos` in her home folder, she would run:
|
||||
|
||||
export PYTHONPATH=$PYTHONPATH:/home/alice/teos/
|
||||
|
||||
You should also include the command in your `.bashrc` to avoid having to run it every time you open a new terminal. You can do it by running:
|
||||
|
||||
echo 'export PYTHONPATH=$PYTHONPATH:<absolute_path_to_teos>' >> ~/.bashrc
|
||||
|
||||
Once the `PYTHONPATH` is set, you should be able to run `teos` straightaway. Try it by running:
|
||||
|
||||
cd <absolute_path_to_teos>/teos/
|
||||
python teosd.py
|
||||
|
||||
## Running `teos` as a module
|
||||
Python code can be also run as a module, to do so you need to use `python -m`. From the **outer** teos directory run:
|
||||
|
||||
python -m teos.teosd
|
||||
|
||||
Notice that if you run `teos` as a module, you'll need to replace all the calls from `python teosd.py` to `python -m teos.teosd`
|
||||
|
||||
## Modify configuration parameters
|
||||
If you'd like to modify some of the configuration defaults (such as the user directory, where the logs will be stored) you can do so in the config file located at:
|
||||
|
||||
<absolute_path_to_teos>/teos/conf.py
|
||||
34
README.md
Normal file
34
README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# The Eye of Satoshi (TEOS)
|
||||
|
||||
The Eye of Satoshi is a Lightning watchtower compliant with [BOLT13](https://github.com/sr-gi/bolt13), written in Python 3.
|
||||
|
||||
TEOS consists in three main modules:
|
||||
|
||||
- `teos`: including the tower's main functionality (server-side)
|
||||
- `cli`: including a reference command line interface (client-side)
|
||||
- `common`: including shared functionality between `teos` and `cli`.
|
||||
|
||||
Additionally, tests for every module can be found at `tests`.
|
||||
|
||||
|
||||
### Running TEOS
|
||||
In order to run `teos` you will need to create a configuration file (follow [INSTALL.md](INSTALL.md)) and run `teosd.py`. Currently you will also need a set of keys (to sign appointments) stored in your data directory.
|
||||
|
||||
You can use `generate_keys.py` to generate those keys.
|
||||
|
||||
### Interacting with a TEOS instance
|
||||
You can interact with a `teos` instance (either run by yourself or someone else) by using `teos_cli` under `cli`.
|
||||
|
||||
Since `teos_cli` works independently of `teos`, you will need a separate configuration file for this (follow [cli/INSTALL.md](cli/INSTALL.md)) and a different set of keys. You can use `generate_keys.py` to generate those keys.
|
||||
|
||||
Notice that `teos_cli` is a simple way to interact with `teos`, but ideally that should be part of your wallet functionality (therefore why they are independent entities). `teos_cli` can be used as an example for how to send data to a [BOLT13](https://github.com/sr-gi/bolt13) compliant watchtower.
|
||||
|
||||
## Dependencies
|
||||
Refer to [DEPENDENCIES.md](DEPENDENCIES.md)
|
||||
|
||||
## Installation
|
||||
|
||||
Refer to [INSTALL.md](INSTALL.md)
|
||||
|
||||
## Contributing
|
||||
Refer to [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
@@ -1,3 +0,0 @@
|
||||
responses
|
||||
pytest
|
||||
black
|
||||
@@ -1,3 +1,4 @@
|
||||
pytest
|
||||
black
|
||||
responses
|
||||
bitcoind_mock===0.0.4
|
||||
Reference in New Issue
Block a user