Skip to content

Commit 6b9ee72

Browse files
author
Pan
committed
Updated readme, documentation, requirements.
1 parent a811e69 commit 6b9ee72

File tree

7 files changed

+125
-31
lines changed

7 files changed

+125
-31
lines changed

README.rst

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ Native code based client with extremely high performance - based on ``libssh2``
1616
:alt: Latest Version
1717
.. image:: https://travis-ci.org/ParallelSSH/parallel-ssh.svg?branch=master
1818
:target: https://travis-ci.org/ParallelSSH/parallel-ssh
19+
.. image:: https://ci.appveyor.com/api/projects/status/github/parallelssh/parallel-ssh?svg=true&branch=master
20+
:target: https://ci.appveyor.com/project/pkittenis/parallel-ssh
1921
.. image:: https://codecov.io/gh/ParallelSSH/parallel-ssh/branch/master/graph/badge.svg
2022
:target: https://codecov.io/gh/ParallelSSH/parallel-ssh
2123
.. image:: https://img.shields.io/pypi/wheel/parallel-ssh.svg
22-
:target: https://pypi.python.org/pypi/parallel-ssh
24+
:target: https://pypi.python.org/pypi/parallel-ssh
2325
.. image:: https://readthedocs.org/projects/parallel-ssh/badge/?version=latest
2426
:target: http://parallel-ssh.readthedocs.org/en/latest/
2527
:alt: Latest documentation
@@ -46,6 +48,8 @@ Run ``uname`` on two remote hosts in parallel with ``sudo``.
4648

4749
.. code-block:: python
4850
51+
from __future__ import print_function
52+
4953
from pssh.pssh_client import ParallelSSHClient
5054
5155
hosts = ['myhost1', 'myhost2']
@@ -75,7 +79,7 @@ See `this post <https://parallel-ssh.org/post/parallel-ssh-libssh2>`_ for a perf
7579

7680
To make use of this new client, ``ParallelSSHClient`` can be imported from ``pssh.pssh2_client`` instead. Their respective APIs are almost identical.
7781

78-
The new client will become the default and will replace the current ``pssh.pssh_client`` in a new major version of the library - ``2.0.0`` - once remaining features have been implemented. The native client should be considered as *beta* status until the ``2.0.0`` release when it is made the default.
82+
The new client will become the default and will replace the current ``pssh.pssh_client`` in a new major version of the library - ``2.0.0`` - once remaining features have been implemented.
7983

8084
The current default client will remain available as an option under a new name.
8185

@@ -126,7 +130,7 @@ Once either standard output is iterated on *to completion*, or ``client.join(out
126130
0
127131
128132
129-
The client's ``join`` function can be used to block and wait for all parallel commands to finish:
133+
The client's ``join`` function can be used to wait for all commands in output object to finish:
130134

131135
.. code-block:: python
132136
@@ -136,6 +140,8 @@ Similarly, output and exit codes are available after ``client.join`` is called:
136140

137141
.. code-block:: python
138142
143+
from pprint import pprint
144+
139145
output = client.run_command('exit 0')
140146
141147
# Wait for commands to complete and gather exit codes.
@@ -157,11 +163,12 @@ Similarly, output and exit codes are available after ``client.join`` is called:
157163
158164
There is also a built in host logger that can be enabled to log output from remote hosts. The helper function ``pssh.utils.enable_host_logger`` will enable host logging to stdout.
159165

160-
To log output without having to iterate over output generators, the ``consume_output`` flag can be enabled - for example:
166+
To log output without having to iterate over output generators, the ``consume_output`` flag *must* be enabled - for example:
161167

162168
.. code-block:: python
163169
164170
from pssh.utils import enable_host_logger
171+
165172
enable_host_logger()
166173
client.join(client.run_command('uname'), consume_output=True)
167174
@@ -171,20 +178,20 @@ To log output without having to iterate over output generators, the ``consume_ou
171178
[localhost] Linux
172179
173180
174-
SFTP/SCP
175-
********
181+
SFTP
182+
******
176183

177-
SFTP is supported natively, no ``scp`` binary required.
184+
SFTP is supported natively.
178185

179-
For example to copy a local file to remote hosts in parallel:
186+
To copy a local file to remote hosts in parallel:
180187

181188
.. code-block:: python
182189
183190
from pssh.pssh_client import ParallelSSHClient
184-
from pssh import utils
191+
from pssh.utils import enable_logger, logger
185192
from gevent import joinall
186193
187-
utils.enable_logger(utils.logger)
194+
enable_logger(logger)
188195
hosts = ['myhost1', 'myhost2']
189196
client = ParallelSSHClient(hosts)
190197
cmds = client.copy_file('../test', 'test_dir/test')
@@ -238,7 +245,7 @@ Output *generation* is done remotely and has no effect on the event loop until o
238245
User's group
239246
*************
240247

241-
here is a public `ParallelSSH Google group <https://groups.google.com/forum/#!forum/parallelssh>`_ setup for this purpose - both posting and viewing are open to the public.
248+
There is a public `ParallelSSH Google group <https://groups.google.com/forum/#!forum/parallelssh>`_ setup for this purpose - both posting and viewing are open to the public.
242249

243250
.. image:: https://ga-beacon.appspot.com/UA-9132694-7/parallel-ssh/README.rst?pixel
244251
:target: https://github.com/igrigorik/ga-beacon

ci/docker/build-packages.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ for x in `ls -1d ci/docker/{fedora,centos}*`; do
1212
docker pull $docker_tag || echo
1313
docker build --cache-from $docker_tag $x -t $name
1414
docker tag $name $docker_tag
15-
docker push $docker_tag
16-
sudo rm -rf build dist
15+
# docker push $docker_tag
16+
# sudo rm -rf build dist
1717
docker run -v "$(pwd):/src/" "$name" --rpm-dist $dist -s python -t rpm setup.py
1818
done
1919

@@ -23,12 +23,12 @@ for x in `ls -1d ci/docker/{debian,ubuntu}*`; do
2323
docker pull $docker_tag || echo
2424
docker build --cache-from $docker_tag $x -t $name
2525
docker tag $name $docker_tag
26-
docker push $docker_tag
27-
sudo rm -rf build dist
26+
# docker push $docker_tag
27+
# sudo rm -rf build dist
2828
docker run -v "$(pwd):/src/" "$name" --iteration $name -s python -t deb setup.py
2929
done
3030

31-
sudo chown -R ${USER} *
31+
# sudo chown -R ${USER} *
3232

3333
ls -ltrh *.{rpm,deb}
3434

ci/docker/debian7/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ FROM cdrx/fpm-debian:7
22

33
RUN apt-get -y update
44
RUN apt-get -y install python-setuptools python-dev libssh2-1-dev python-pip git
5+
RUN pip install -U pip -i https://pypi.python.org/simple/
56
RUN pip install -U setuptools
6-
RUN pip install -U pip wheel
7+
RUN pip install -U wheel

doc/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ Parallel-SSH Documentation
1010
:alt: Latest Version
1111
.. image:: https://travis-ci.org/ParallelSSH/parallel-ssh.svg?branch=master
1212
:target: https://travis-ci.org/ParallelSSH/parallel-ssh
13+
.. image:: https://ci.appveyor.com/api/projects/status/github/parallelssh/ssh2-python?svg=true&branch=master
14+
:target: https://ci.appveyor.com/project/pkittenis/ssh2-python
1315
.. image:: https://codecov.io/gh/ParallelSSH/parallel-ssh/branch/master/graph/badge.svg
1416
:target: https://codecov.io/gh/ParallelSSH/parallel-ssh
1517
.. image:: https://img.shields.io/pypi/wheel/parallel-ssh.svg
16-
:target: https://pypi.python.org/pypi/parallel-ssh
18+
:target: https://pypi.python.org/pypi/parallel-ssh
1719
.. image:: https://readthedocs.org/projects/parallel-ssh/badge/?version=latest
1820
:target: http://parallel-ssh.readthedocs.org/en/latest/
1921
:alt: Latest documentation
2022

2123
``parallel-ssh`` is a non-blocking parallel SSH client library.
2224

23-
It uses non-blocking asynchronous SSH sessions and is, to date, the only publicly available non-blocking SSH client library for Python, as well as the only non-blocking *parallel* SSH client library available for Python.
25+
It uses non-blocking asynchronous SSH sessions and is to date the only publicly available non-blocking SSH client library, as well as the only non-blocking *parallel* SSH client library available for Python.
2426

2527
.. toctree::
2628
:maxdepth: 2
@@ -79,7 +81,6 @@ The API is mostly identical to the current clients, though some features are not
7981
From version ``2.x.x`` onwards, the ``ssh2-python`` based clients will *become the default*, replacing the current ``pssh_client.ParallelSSHClient``, with the current clients renamed.
8082

8183

82-
8384
Indices and tables
8485
==================
8586

doc/installation.rst

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ Installation is handled by Python's standard ``setuptools`` library and ``pip``.
77
Pip Install
88
------------
99

10-
::
10+
``pip`` may need to be updated to be able to install binary wheel packages.
1111

12-
pip install parallel-ssh
12+
.. code-block:: shell
13+
14+
pip install -U pip
15+
16+
pip install parallel-ssh
1317
1418
If ``pip`` is not available on your Python platform, `see this installation guide <http://docs.python-guide.org/en/latest/starting/installation/>`_.
1519

@@ -22,31 +26,94 @@ If you are running a deprecated Python version such as ``2.6`` you may need to i
2226

2327
For example, to install the ``1.0.0`` version, run the following.
2428

25-
.. code-block:: python
29+
.. code-block:: shell
2630
2731
pip install parallel-ssh==1.0.0
2832
2933
``1.0.0`` is compatible with all Python versions over or equal to ``2.6``, including all of the ``3.x`` series.
3034

3135
Older versions such as `0.70.x` are compatible with Python ``2.5`` and ``2.x`` but not the ``3.x`` series.
3236

33-
Source Code
34-
-------------
37+
Dependencies
38+
--------------
39+
40+
When installing from source, it is responsibility of user to satisfy dependencies. For pre-built binary wheel packages with dependencies included, see `Pip Install`_.
41+
42+
============ ================
43+
Dependency Minimum Version
44+
============ ================
45+
``libssh2`` ``1.6``
46+
``gevent`` ``1.1``
47+
``paramiko`` ``1.15.3``
48+
============ ================
49+
50+
51+
Building from Source
52+
----------------------
3553

36-
Parallel-SSH is hosted on GitHub and the repository can be cloned with the following
54+
55+
``parallel-ssh`` is hosted on GitHub and the repository can be cloned with the following
3756

3857
.. code-block:: shell
3958
4059
git clone [email protected]:ParallelSSH/parallel-ssh.git
60+
cd parallel-ssh
4161
4262
To install from source run:
4363

4464
.. code-block:: shell
4565
4666
python setup.py install
4767
48-
Or with `pip`'s development mode which will ensure local changes are made available:
68+
Or with ``pip``'s development mode which will ensure local changes are made available:
4969

5070
.. code-block:: shell
5171
5272
pip install -e .
73+
74+
Building System Packages
75+
--------------------------
76+
77+
For convenience, a script making use of Docker is provided at `ci/docker/build-packages.sh <https://github.com/ParallelSSH/parallel-ssh/blob/master/ci/docker/build-packages.sh>`_ that will build system packages for Centos/RedHat 6/7, Ubuntu 14.04/16.04, Debian 7/8 and Fedora 22/23/24.
78+
79+
Note that these packages make use of system libraries that may need to be updated to be compatible with ``parallel-ssh`` - see `Dependencies`_.
80+
81+
.. code-block:: shell
82+
83+
git clone [email protected]:ParallelSSH/parallel-ssh.git
84+
cd parallel-ssh
85+
# Checkout a tag for tagged builds - git tag; git checkout <tag>
86+
./ci/docker/build-packages.sh
87+
ls -1tr
88+
89+
.. code-block:: shell
90+
91+
python-parallel-ssh-1.2.0+4.ga811e69.dirty-1.el6.x86_64.rpm
92+
python-parallel-ssh-1.2.0+4.ga811e69.dirty-1.el7.x86_64.rpm
93+
python-parallel-ssh-1.2.0+4.ga811e69.dirty-1.fc22.x86_64.rpm
94+
python-parallel-ssh-1.2.0+4.ga811e69.dirty-1.fc23.x86_64.rpm
95+
python-parallel-ssh-1.2.0+4.ga811e69.dirty-1.fc24.x86_64.rpm
96+
python-parallel-ssh_1.2.0+4.ga811e69.dirty-debian7_amd64.deb
97+
python-parallel-ssh_1.2.0+4.ga811e69.dirty-debian8_amd64.deb
98+
99+
Specific System Package Build
100+
_______________________________
101+
102+
To build for only a specific system/distribution, run the two following commands, substituting distribution with the desired one from `ci/docker <https://github.com/ParallelSSH/parallel-ssh/blob/master/ci/docker>`_. See `existing Dockerfiles <https://github.com/ParallelSSH/parallel-ssh/tree/master/ci/docker/ubuntu16.04/Dockerfile>`_ for examples on how to create system packages for other distributions.
103+
104+
Debian based
105+
+++++++++++++
106+
107+
.. code-block:: shell
108+
109+
docker build --cache-from parallelssh/ssh2-python:debian7 ci/docker/debian7 -t debian7
110+
docker run -v "$(pwd):/src/" debian7 --iteration debian7 -s python -t deb setup.py
111+
112+
113+
RPM based
114+
++++++++++
115+
116+
.. code-block:: shell
117+
118+
docker build --cache-from parallelssh/ssh2-python:centos7 ci/docker/centos7 -t centos7
119+
docker run -v "$(pwd):/src/" centos7 --rpm-dist el7 -s python -t rpm setup.py

doc/quickstart.rst

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,25 @@ User/password authentication can be used by providing user name and password cre
129129
Programmatic Private Key authentication
130130
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131131

132-
It is also possible to programmatically use a private key for authentication.
132+
It is also possible to programmatically use a private key for authentication.
133133

134-
The helper function :py:func:`load_private_key <pssh.utils.load_private_key>` is provided to easily load all possible key types. It takes either a file path or a file-like object.
134+
Native Client
135+
______________
135136

136-
:File path:
137+
For the native client (``pssh.pssh2_client``), only private key filepath is needed. The corresponding public key *must* be available in the same directory as ``my_pkey.pub`` where private key file is ``my_pkey``. Public key file name and path will be made configurable in a future version.
138+
139+
.. code-block:: python
140+
141+
from pssh.pssh2_client import ParallelSSHClient
142+
143+
client = ParallelSSHClient(hosts, pkey='my_pkey')
144+
145+
Paramiko Client
146+
__________________
147+
148+
For the paramiko based client, the helper function :py:func:`load_private_key <pssh.utils.load_private_key>` is provided to easily load all possible key types. It takes either a file path or a file-like object.
149+
150+
:File path:
137151
.. code-block:: python
138152
139153
from pssh.pssh_client import ParallelSSHClient
@@ -142,6 +156,10 @@ The helper function :py:func:`load_private_key <pssh.utils.load_private_key>` is
142156
pkey = load_private_key('my_pkey.pem')
143157
client = ParallelSSHClient(hosts, pkey=pkey)
144158
159+
.. note::
160+
161+
The two available clients support different key types and authentication mechanisms - see Paramiko and libssh2 documentation for details, as well as `clients features comparison <ssh2.html>`_.
162+
145163
Output for Last Executed Commands
146164
-----------------------------------
147165

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
paramiko>=1.15.3,<2.2
2-
gevent
2+
gevent>=1.1
33
ssh2-python>=0.6.0

0 commit comments

Comments
 (0)