Improves documentation

This commit is contained in:
Sergi Delgado Segura
2019-07-10 16:43:51 +01:00
parent d1c5b3dd6a
commit 32bece41b2
4 changed files with 108 additions and 8 deletions

View File

@@ -1,7 +1,78 @@
# Dependencies
The app has the following dependencies (which can be satisfied by using `pip install -r requirements.txt`):
`pisa-cli` has both system-wide and Python dependencies. This document walks you trough how to satisfy them.
#### Cryptography
`cryptography`
## System-wide dependencies
`pisa-cli` 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 `pisa-cli`.
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
#### OSX
`python3` can be installed using `Homebriew` as follows:
brew install python3
`pip3` will be installed alongside `python3` in this case.
## Python dependencies
`pisa-cli` has the following dependencies (which can be satisfied by using `pip install -r requirements.txt`):
- `cryptography`

View File

@@ -0,0 +1,20 @@
# Install
`pisa-cli` 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.
In order to run `pisa-cli`, you should set your `PYTHONPATH` env variable to include the folder that contains the `apps` folder. You can do so by running:
export PYTHONPATH=$PYTHONPATH:<absolute_path_to_apps>
For example, for user alice running a UNIX system and having `apps` in her home folder, she would run:
export PYTHONPATH=$PYTHONPATH:/home/alice/
You should also include the command in your `.bash_rc` 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_apps>' >> ~/.bash_rc
Once the `PYTHONPATH` is set, you should be able to run `pisa-cli` straightaway. Try it by running:
cd <absolute_path_to_apps>/apps/cli
python pisa-cli.py -h

View File

@@ -1,8 +1,15 @@
## pisa-cli
`pisa-cli` is a command line interface to interact with the PISA server.
`pisa-cli` is a command line interface to interact with the PISA server, written in Python3.
#### Usage
### Dependencies
Refer to [DEPENCENCIES.md](DEPENCENCIES.md)
### Installation
Refer to [INSTALL.md](INSTALL.md)
### Usage
python pisa-cli.py [global options] command [command options] [arguments]
@@ -119,8 +126,8 @@ Run:
Shows the list of commands or help about how to run a specific command.
#### Usage
python pisa-cli help command
python pisa-cli help
or
python pisa-cli command -h
python pisa-cli help command

View File

@@ -8,9 +8,9 @@ from sys import argv
from getopt import getopt, GetoptError
from hashlib import sha256
from binascii import unhexlify
from apps.cli.blob import Blob
from requests import ConnectTimeout, ConnectionError
from apps.cli import DEFAULT_PISA_API_SERVER, DEFAULT_PISA_API_PORT, CLIENT_LOG_FILE
from apps.cli.blob import Blob
from apps.cli.help import help_add_appointment, help_get_appointment
@@ -211,6 +211,8 @@ if __name__ == '__main__':
else:
sys.exit("Unknown command. Use help to check the list of available commands.")
else:
sys.exit("No command provided. Use help to check the list of available commands.")
except GetoptError as e:
print(e)