|
| 1 | +linux-utils: Linux system administration tools for Python |
| 2 | +========================================================= |
| 3 | + |
| 4 | +.. image:: https://travis-ci.org/xolox/python-linux-utils.svg?branch=master |
| 5 | + :target: https://travis-ci.org/xolox/python-linux-utils |
| 6 | + |
| 7 | +.. image:: https://coveralls.io/repos/xolox/python-linux-utils/badge.svg?branch=master |
| 8 | + :target: https://coveralls.io/r/xolox/python-linux-utils?branch=master |
| 9 | + |
| 10 | +The Python package `linux-utils` provides utility functions that make it easy |
| 11 | +to script system administration tasks on Linux_ systems in Python. At the |
| 12 | +moment only parsing of the ``/etc/fstab`` and ``/etc/crypttab`` configuration |
| 13 | +files is implemented, but more functionality will soon be released. The package |
| 14 | +is currently tested on cPython 2.6, 2.7, 3.4, 3.5, 3.6 and PyPy (2.7). |
| 15 | + |
| 16 | +.. contents:: |
| 17 | + :local: |
| 18 | + |
| 19 | +Installation |
| 20 | +------------ |
| 21 | + |
| 22 | +The `linux-utils` package is available on PyPI_ which means installation should |
| 23 | +be as simple as: |
| 24 | + |
| 25 | +.. code-block:: sh |
| 26 | +
|
| 27 | + $ pip install linux-utils |
| 28 | +
|
| 29 | +There's actually a multitude of ways to install Python packages (e.g. the `per |
| 30 | +user site-packages directory`_, `virtual environments`_ or just installing |
| 31 | +system wide) and I have no intention of getting into that discussion here, so |
| 32 | +if this intimidates you then read up on your options before returning to these |
| 33 | +instructions ;-). |
| 34 | + |
| 35 | +Usage |
| 36 | +----- |
| 37 | + |
| 38 | +Please refer to the API documentation available on `Read the Docs`_. |
| 39 | + |
| 40 | +History |
| 41 | +------- |
| 42 | + |
| 43 | +Back in 2015 I wrote some Python code to parse the Linux configuration files |
| 44 | +``/etc/fstab`` and ``/etc/crypttab`` for use in crypto-drive-manager_. Fast |
| 45 | +forward to 2017 and I found myself wanting to use the same functionality |
| 46 | +in rsync-system-backup_. Three options presented themselves to me: |
| 47 | + |
| 48 | +1. **Copy/paste the relevant code.** Having to maintain the same code in |
| 49 | + multiple places causes lower quality code because having to duplicate the |
| 50 | + effort of writing documentation, developing tests and fixing bugs is a very |
| 51 | + demotivating endeavor. |
| 52 | + |
| 53 | + In fact sometime in 2016 I *did* copy/paste parts of this code into a |
| 54 | + project at work, because I needed similar functionality there. Of course |
| 55 | + since then the two implementations have started diverging :-p. |
| 56 | + |
| 57 | +2. **Make crypto-drive-manager a dependency of rsync-system-backup.** Although |
| 58 | + this approach is less ugly than copy/pasting the code, it still isn't |
| 59 | + exactly elegant because the two projects have nothing to do with each other |
| 60 | + apart from working with LUKS encrypted disks on Linux. |
| 61 | + |
| 62 | +3. **Extract the functionality into a new package.** In my opinion this is |
| 63 | + clearly the most elegant approach, unfortunately it also requires the most |
| 64 | + work from me :-). On the plus side I'm publishing the new package with a |
| 65 | + test suite which means less untested code remains in crypto-drive-manager_ |
| 66 | + (which doesn't have a test suite at the time of writing). |
| 67 | + |
| 68 | +While extracting the code I shortly considered integrating the functionality |
| 69 | +into debuntu-tools_, however the ``/etc/fstab`` and ``/etc/crypttab`` parsing |
| 70 | +isn't specific to Debian or Ubuntu at all and debuntu-tools_ has several |
| 71 | +dependencies that aren't relevant to Linux configuration file parsing. |
| 72 | + |
| 73 | +Tangentially related: The reason I went with the extremely generic name |
| 74 | +`linux-utils` is because I will be adding more *"specific to Linux but not |
| 75 | +Debian"* functionality to this package in the very near future :-). |
| 76 | + |
| 77 | +Contact |
| 78 | +------- |
| 79 | + |
| 80 | +The latest version of `linux-utils` is available on PyPI_ and GitHub_. The |
| 81 | +documentation is hosted on `Read the Docs`_. For bug reports please create an |
| 82 | +issue on GitHub_. If you have questions, suggestions, etc. feel free to send me |
| 83 | +an e-mail at ` [email protected]`_. |
| 84 | + |
| 85 | +License |
| 86 | +------- |
| 87 | + |
| 88 | +This software is licensed under the `MIT license`_. |
| 89 | + |
| 90 | +© 2017 Peter Odding. |
| 91 | + |
| 92 | +.. External references: |
| 93 | +
|
| 94 | +.. _crypto-drive-manager: https://pypi.python.org/pypi/crypto-drive-manager |
| 95 | +.. _debuntu-tools: https://pypi.python.org/pypi/debuntu-tools |
| 96 | +.. _GitHub: https://github.com/xolox/python-linux-utils |
| 97 | +.. _Linux: https://en.wikipedia.org/wiki/Linux |
| 98 | +.. _MIT license: http://en.wikipedia.org/wiki/MIT_License |
| 99 | +.. _per user site-packages directory: https://www.python.org/dev/peps/pep-0370/ |
| 100 | + |
| 101 | +.. _PyPI: https://pypi.python.org/pypi/linux-utils |
| 102 | +.. _Python Package Index: https://pypi.python.org/pypi/linux-utils |
| 103 | +.. _Python: https://www.python.org/ |
| 104 | +.. _Read the Docs: https://linux-utils.readthedocs.org |
| 105 | +.. _rsync-system-backup: https://pypi.python.org/pypi/rsync-system-backup |
| 106 | +.. _virtual environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/ |
0 commit comments