Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Declare program arguments in a type-safe way.
This project builds on top of argparse
by adding type-safety and allowing a more expressive argument parser definition.
from arcparse import arcparser, flag
from pathlib import Path
@arcparser
class Args:
path: Path
recurse: bool = flag("-r")
item_limit: int = 100
output_path: Path | None
args = Args.parse()
print(f"Scanning {args.path}...")
...
For more examples see Examples.
# Using pip
$ pip install arcparse
This project was inspired by swansonk14/typed-argument-parser.
from __future__ import annotations
makes all annotations strings at runtime. This library relies on class variable annotations's types being actual types. inspect.get_annotations(obj, eval_str=True)
is used to evaluate string annotations to types in order to assign converters. If an argument is annotated with a non-builtin type which is defined outside of the argument-defining class body the type can't be found which results in NameError
s. This is avoidable either by only using custom types which have been defined in the argument-defining class body (which is restrictive), or alternatively by not using the annotations
import which should not be necessary from python 3.13 forward thanks to PEP 649.
FAQs
Declare program arguments in a type-safe way
We found that arcparse 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.