Skip to content
Snippets Groups Projects
Commit d067f7d1 authored by Moul's avatar Moul
Browse files

Merge branch '100_pip_install' into 'dev'

100 pip install

See merge request !80
parents 4a4d80ae d0bab244
No related branches found
No related tags found
1 merge request!80100 pip install
...@@ -10,6 +10,7 @@ tabulate = "*" ...@@ -10,6 +10,7 @@ tabulate = "*"
scrypt = "*" scrypt = "*"
pyaes = "*" pyaes = "*"
PyNaCl = "*" PyNaCl = "*"
"e1839a8" = {path = ".", editable = true}
[dev-packages] [dev-packages]
......
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "22ac5bb64561eb08ea075a575e2b957157c4ecf5a04b37eada7331161eebe2e7" "sha256": "9781db60bd2b394b50555e7bd36ebf96fbd997f7c2ff27bf5fb9f6ab83a58674"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
"index": "pypi", "index": "pypi",
"version": "==0.4.1" "version": "==0.4.1"
}, },
"e1839a8": {
"editable": true,
"path": "."
},
"ipaddress": { "ipaddress": {
"hashes": [ "hashes": [
"sha256:64b28eec5e78e7510698f6d4da08800a5c575caa4a286c93d651c5d3ff7b6794", "sha256:64b28eec5e78e7510698f6d4da08800a5c575caa4a286c93d651c5d3ff7b6794",
......
# Silkaj # Silkaj
[![Version](https://img.shields.io/pypi/v/silkaj.svg)](https://pypi.python.org/pypi/silkaj) [![License](https://img.shields.io/pypi/l/silkaj.svg)](https://pypi.python.org/pypi/silkaj) [![Python versions](https://img.shields.io/pypi/pyversions/silkaj.svg)](https://pypi.python.org/pypi/silkaj)
- CLI Duniter client written with Python 3. - CLI Duniter client written with Python 3.
- [Website](https://silkaj.duniter.org) - [Website](https://silkaj.duniter.org)
## Install ## Install
### With release
Download [last release](https://git.duniter.org/clients/python/silkaj/tags) with `wget`.
Check it's integrity comparing it to `silkaj_sha256sum`:
```bash
sha256sum silkaj
```
Add executable permissions: ### Install from Pypi
```bash ```bash
chmod a+x silkaj pip3 install silkaj
``` ```
### Manually ### Other installation methods
- [Install with Pip](doc/install_pip.md)
- [Install with pipenv](doc/install_pipenv.md) - [Install with pipenv](doc/install_pipenv.md)
- [Install with the build](doc/install_build.md)
- [Build an executable with Pyinstaller](doc/build_with_pyinstaller.md) - [Build an executable with Pyinstaller](doc/build_with_pyinstaller.md)
- [Install as a drop-down for GNOME Shell with Argos](doc/argos.md) - [Install as a drop-down for GNOME Shell with Argos](doc/argos.md)
## Usage ## Usage
- Get help usage with `-h`, `--help` or `--usage` options, then run: - Get help usage with `-h`, `--help` or `--usage` options, then run:
```bash ```bash
./silkaj <sub-command> silkaj <sub-command>
``` ```
- Will automatically request and post data on `duniter.org 10901` main Ğ1 node. - Will automatically request and post data on `duniter.org 10901` main Ğ1 node.
- Specify a custom node with `-p` option: - Specify a custom node with `-p` option:
```bash ```bash
./silkaj <sub-command> -p <address>:<port> silkaj <sub-command> -p <address>:<port>
``` ```
## Features ## Features
...@@ -50,7 +49,7 @@ chmod a+x silkaj ...@@ -50,7 +49,7 @@ chmod a+x silkaj
## Example ## Example
```bash ```bash
./silkaj network silkaj network
### 20 peers ups, with 15 members and 5 non-members ### 20 peers ups, with 15 members and 5 non-members
......
#!/usr/bin/env python3
from silkaj.network_tools import check_port, best_node
from silkaj.silkaj import cli, manage_cmd
if __name__ == '__main__':
ep, cli_args = cli()
check_port(ep["port"])
best_node(ep, 1)
manage_cmd(ep, cli_args)
...@@ -12,7 +12,7 @@ pyenv rehash ...@@ -12,7 +12,7 @@ pyenv rehash
## Build ## Build
```bash ```bash
pyinstaller src/silkaj.py --hidden-import=_cffi_backend --hidden-import=_scrypt --onefile pyinstaller bin/silkaj --hidden-import=_cffi_backend --hidden-import=_scrypt --onefile
``` ```
You will found the exetuable file on `silkaj/dist` folder. You will found the exetuable file on `dist` folder.
## Install with the realease bundle
Build are built on Fedora, and only works on Fedora for now.
### Download
Download [last release](https://git.duniter.org/clients/python/silkaj/tags) with `wget`.
### Integrity check
Check it's integrity comparing it to `silkaj_sha256sum`:
```bash
sha256sum silkaj
```
### Add executable permissions:
```bash
chmod a+x silkaj
```
# Install Silkaj with Pip
## Install dependencies
```bash
sudo apt install python3-pip libssl-dev
```
On Ubuntu 14.04 and Debian 8, you need this package too:
```bash
sudo apt install libffi-dev
```
## Install from Pypi
```bash
pip3 install silkaj
```
## Install from sources
### Retrieve silkaj sources
```bash
sudo apt install git
git clone https://git.duniter.org/clients/python/silkaj.git
cd silkaj
```
### Install with dependencies
Just install:
```bash
pip3 install .
```
Or install it as "editable", for development:
```bash
pip3 install -e .
```
...@@ -10,15 +10,17 @@ git clone https://git.duniter.org/clients/python/silkaj.git ...@@ -10,15 +10,17 @@ git clone https://git.duniter.org/clients/python/silkaj.git
cd silkaj cd silkaj
``` ```
### Install dependencies ### Install with dependencies
```bash ```bash
pipenv install pipenv install "-e ."
``` ```
The double quotes are important, if you forget them, `pipenv` will install silkaj from pypi
### Activate pipenv and run silkaj ### Activate pipenv and run silkaj
```bash ```bash
pipenv shell pipenv shell
./silkaj silkaj
``` ```
## Manage Python versions with Pyenv ## Manage Python versions with Pyenv
......
En résumé :
1. Créer un compte sur pypi / pypi de test
2. Génrérer des paquets wheel (un source, un binaire).
3. Envoyer les paquets sur pypi
# Créer un compte sur pypi
De test : https://test.pypi.org/account/register/
De production : https://pypi.org/account/register/
Ça permet de gérer les versions et les projets (notamment ajouter des collaborateurs qui pourront aussi faire des livraisons).
# Générer les paquets
D'abord il faut installer/mettre à jour `setuptools` et `wheels`
```bash
pip install -U setuptools wheel twine
```
Ensuite créer les paquets source et binaire dans le dossier "dist/" :
```bash
$ python3 setup.py sdist bdist_wheel
$ ls dist/
silkaj-0.6.0-py3-none-any.whl silkaj-0.6.0.tar.gz
```
# Pousser les paquets sur pypi
Pour ne pas taper son password à chaque fois, on peut utiliser ça : https://github.com/pypa/twine#keyring-support
## Pousser sur l'environnement de test
Pour pousser la version $VERSION
```bash
twine upload --repository-url https://test.pypi.org/legacy/ dist/silkaj-$VERSION*
```
On peut voir le paquet ici : https://test.pypi.org/project/silkaj/
Pout installer le paquet depuis le dépôt de test sur un venv tout neuf :
```bash
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.python.org/simple/ silkaj
```
Le `--extra-index-url` sert à ajouter les paquets officiels, sinon il y aura un problème avec les dépendances absentes de l'environnement de test.
## Pousser sur l'environnement de test
Juste faire : `twine upload dist/silkaj-$VERSION*`
Pour installer le paquet dans un environnement tout propre :
```bash
pip install silkaj
```
...@@ -22,12 +22,13 @@ check_branch() { ...@@ -22,12 +22,13 @@ check_branch() {
} }
update_version() { update_version() {
sed -i "s/SILKAJ_VERSION = \"silkaj.*\"/SILKAJ_VERSION = \"silkaj $VERSION\"/" src/constants.py sed -i "s/SILKAJ_VERSION = \"silkaj.*\"/SILKAJ_VERSION = \"silkaj $VERSION\"/" silkaj/constants.py
sed -i "s/version=\".*\",/version=\"$VERSION\",/" setup.py
git diff git diff
} }
commit_tag() { commit_tag() {
git commit src/constants.py -m "v$VERSION" git commit silkaj/constants.py setup.py -m "v$VERSION"
git tag "v$VERSION" -a -m "$VERSION" git tag "v$VERSION" -a -m "$VERSION"
} }
...@@ -36,7 +37,7 @@ build() { ...@@ -36,7 +37,7 @@ build() {
error_message "Activate silkaj-env" error_message "Activate silkaj-env"
fi fi
exec_installed pyinstaller exec_installed pyinstaller
pyinstaller src/silkaj.py --hidden-import=_cffi_backend --hidden-import=_scrypt --onefile pyinstaller bin/silkaj --hidden-import=_cffi_backend --hidden-import=_scrypt --onefile
} }
checksum() { checksum() {
......
setup.py 0 → 100644
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="silkaj",
version="0.6.0",
author="Moul",
author_email="moul@moul.re",
description="Command line client for Duniter",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://git.duniter.org/clients/python/silkaj",
license='GNU AGPLv3',
packages=setuptools.find_packages(),
keywords='g1 duniter cryptocurrency librecurrency RTM',
classifiers=(
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3 :: Only',
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
),
install_requires=[
"commandlines",
"ipaddress",
"tabulate",
"pynacl",
"scrypt",
"pyaes",
],
scripts=[
'bin/silkaj',
],
)
src/silkaj.py
\ No newline at end of file
name = "silkaj"
from tools import get_publickey_from_seed, b58_decode, xor_bytes, message_exit from silkaj.tools import get_publickey_from_seed, b58_decode, xor_bytes, message_exit
from nacl import encoding from nacl import encoding
import nacl.hash import nacl.hash
from scrypt import hash from scrypt import hash
......
import urllib import urllib
from tabulate import tabulate from tabulate import tabulate
from auth import auth_method from silkaj.auth import auth_method
from tools import get_publickey_from_seed, message_exit, sign_document_from_seed from silkaj.tools import get_publickey_from_seed, message_exit, sign_document_from_seed
from network_tools import get_current_block, post_request from silkaj.network_tools import get_current_block, post_request
from license import license_approval from silkaj.license import license_approval
from constants import NO_MATCHING_ID from silkaj.constants import NO_MATCHING_ID
from wot import is_member, get_pubkey_from_id, get_pubkeys_from_id,\ from silkaj.wot import is_member, get_pubkey_from_id, get_pubkeys_from_id,\
get_uid_from_pubkey get_uid_from_pubkey
......
...@@ -5,10 +5,10 @@ from collections import OrderedDict ...@@ -5,10 +5,10 @@ from collections import OrderedDict
from tabulate import tabulate from tabulate import tabulate
from operator import itemgetter from operator import itemgetter
from wot import get_uid_from_pubkey from silkaj.wot import get_uid_from_pubkey
from network_tools import discover_peers, get_request, best_node, get_current_block from silkaj.network_tools import discover_peers, get_request, best_node, get_current_block
from tools import convert_time, get_currency_symbol, message_exit from silkaj.tools import convert_time, get_currency_symbol, message_exit
from constants import NO_MATCHING_ID from silkaj.constants import NO_MATCHING_ID
def currency_info(ep): def currency_info(ep):
......
File moved
File moved
from network_tools import get_request, get_current_block from silkaj.network_tools import get_request, get_current_block
from tools import get_currency_symbol, get_publickey_from_seed from silkaj.tools import get_currency_symbol, get_publickey_from_seed
from auth import auth_method from silkaj.auth import auth_method
from wot import check_public_key from silkaj.wot import check_public_key
def cmd_amount(ep, cli_args): def cmd_amount(ep, cli_args):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment