A module for command-line options with a pythonic, decorator-centric syntax.
The following example auto-generates help with docstrings, type casting for
arguments and enforcing argument count:
import pyopt
expose = pyopt.Exposer()
@expose.args
def regular_function(arg1:str, arg2:int):
'''Your help - the docstring'''
# bla, etc, foobar spam...
print(repr(arg1), repr(arg2))
if __name__ == "__main__":
expose.run()
There are 3 modes of operation:
1. expose.args - A decorator for positional arguments.
2. expose.kwargs - A decorator for keyword arguments.
3. expose.mixed - A decorator for keyword and positional arguments.
Currently known compromises that are open to discussion, e-mail me:
1. This module was specifically designed with python 3 in mind, certain features
can be converted to python 2.x, but the awesome ones can't.
2. Keyword command-line functions require every argument to start with a
different letter to avoid collisions.
3. Annotations aren't mandatory, I don't know if this is the right way to go,
it's an explicity vs convenience issue.
4. Booleans can't default to True. I couldn't think of a use case for this
so tell me if you did.
License: whatever, I don't mind. Google Code made me choose so I went with
the "New BSD". If somebody has a better idea, e-mail, comment or whatnot.
Hearing from whoever uses this code would be nice, but you really shouldn't
feel obliged.
Contact me at: ubershmekel at gmail
Metadata
Release files for pyopt 0.84
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyopt-0.84.zip | 10.4 kB | Without provenance | Details for pyopt-0.84.zip |
Release files / pyopt-0.84.zip
| Download URL | pyopt-0.84.zip |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4230ae1924189c805551d1a1c153c608aa9600ded829d5126fd8a8274110be4
|
|
BLAKE2b-256 checksum How to use checksums |
b350b7d53d8f3a71694555672268a7ad559f2ae40bd1fc8b97e13af6604f99f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyopt 0.84
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.