Wrap any Linux command and use it as a Python 3 method.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmdwrapper
.gitignore
.travis.yml
.unit-tests.sh
LICENSE.txt
README.md
setup.py

README.md

Build Status

CmdWrapper - wrap any Linux command and use it as a Python 3 method

Info

Python-CmdWrapper is a set of object oriented classes that can help you wrap any Linux command and use it as a Python 3 method.

We are following the best practices of sofware engineering to offer a Python module that is easy to use, object oriented, extensible and fully compatible with the Python standards (PEP8, pylint recommendations...).

Example

>>> from CmdWrapper import CmdWrapper

>>> find = CmdWrapper('find')

>>> result = find('/etc', '-maxdepth', '1', '-name', 'e*')
>>> print('stdout:', result.stdout)
/etc
/etc/ethertypes
/etc/environment

>>> print('stdout lines:', result.stdout.lines)
['/etc', '/etc/ethertypes', '/etc/environment']

>>> print('stdout firstline:', result.stdout.firstline)
/etc

>>> print('exit-code:', result.returncode)
0

Code Quality

The code quality is tested and validated with Travis CI and:

  • pylint (Python checker)
  • flake8 (Python checker)
  • pep257 (docstrings)
  • coverage.py (coverage of the unit-tests)

The goal is to have a source code that is 100% covered with unit-tests and following Python's standards (PEP8) and best practices (pylint recommendations).

Contribution

I encourage you to fork the project and send me your pull requests!