A framework for implementing the Stateless OpenPGP CLI
Project description
The Stateless OpenPGP Command-Line Interface
The Stateless OpenPGP Command-Line
Interface
(or sop
) is a specification that encourages OpenPGP implementators
to provide a common, relatively simple command-line API for purposes
of object security.
This Python module helps implementers build such a CLI from any implementation accessible to the Python interpreter.
It does not provide such an implementation itself -- this is just the scaffolding for the command line, which should make it relatively easy to supply a handful of python functions as methods to a class.
Note that if the user has argcomplete
installed, they should also
get tab completion in standard shells like bash
basically for free.
Example
Here is an example of a minimal command-line tool that just implements
the convert()
interface, using (imaginary) module foo
that has the
appropriate
#!/usr/bin/python3
# PYTHON_ARGCOMPLETE_OK
import sop
import foo
class FooSop(sop.StatelessOpenPGP):
def __init__(self):
super().__init__(prog='FooPGP', version='0.17')
# overrides go here...
def convert(self, key:bytes, armor:bool=True, **kwargs:Namespace) -> bytes:
self.raise_on_unknown_options(**kwargs)
return foo.bytes_to_openpgp_key(key).get_certificate(armor=armor)
if __name__ = "__main__":
foo = FooSop()
foo.dispatch()
Module Goals
Extensibility
An implementer who wants to extend sop
in a simple way (e.g. adding
an option to an existing subcommand, or adding a special option)
should be able to do so without breaking this interface.
Minimal dependencies
The aim is to only depend on modules from stdlib. We make an
exception for optional modules like argcomplete
, which can be
skipped.
Type-checking
All the code in here should be well-annotated
Self-documenting
Implementers should learn what they need to know from the docstrings, like so:
import sop
help(sop)
help(sop.StatelessOpenPGP)
Semantic Versioning
The major version number will only change when backward-incompatible changes are made.
As long as the major version number is 0, the same holds true for the minor version number.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sop-0.1.1.tar.gz
.
File metadata
- Download URL: sop-0.1.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.5rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 388d2e2774f1ea8d690df9af5f887d9318932b14736feb249235e7ef9521785c |
|
MD5 | c56bc01c1a38288569303c220a7e588a |
|
BLAKE2b-256 | 97bcfaec6d73a5c7505fd74e0ea8fe97c86695bf9fb2f8ea521018011951f5fd |
File details
Details for the file sop-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: sop-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.5rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54aad8cfc5aaabe55ca3d0acbc751cb2393ebf5ab8c379828ac75448be3c7c58 |
|
MD5 | 0d79d3fc16cdfc260801581464064ffc |
|
BLAKE2b-256 | 07fb5855b6442bd97231dbd2f1a0497050a6be26616667b1ebea7526b44bd99f |