Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Based on a idea by @lbb.
Automatically generate argparse based env-var/CLI-interface from a given function.
Example:
Given a function with a docstring and type hints.
def hello(name: str):
'''
Say hello to name.
Args:
name: Your name.
Raises:
Nothing.
Returns:
Nothing.
'''
print('Hello', name)
Create a CLI interface:
argmagic(hello)
Argmagic will call the function with all parameters filled from CLI arguments.
$ ./hello.py -h
usage: hello [-h] [--name NAME]
Say hello to name.
optional arguments:
-h, --help show this help message and exit
--name NAME Your name.
Additionally all specified parameters can also be defined via environment variables.
$ NAME=test hello.py
Hello test
These can then again be overriden by CLI arguments.
$ NAME=test hello.py --name something
Hello something
Current parsing of lists, tuples and unions are supported.
For example a typehint containing List[str]
, will parse input [a, b, c]
to
a python list containing ["a", "b", "c"]
.
Also these types can be arbitrarily nested, such as Dict[str, List[int]]
will
correctly parse strings of structure {a: [1, 2, 3], b: [5, 3]}
.
Syntax overview:
Tuple syntax:
(a, b, c)
List syntax:
[a, b, c]
Dict syntax:
{a: i, b: j, k: l}
click uses decorators
FAQs
Parse environment variables and CLI arguments for a given function signature.
We found that argmagic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.