
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
A tiny utility to build CLI tools from Python TypedDict
schemas.
Define your parameters with type hints (and Annotated
for positionals), then call parse()
to get a typed dict and
stringify()
to turn it back into args.
uv pip install sleazy
from typing import Annotated, Literal, TypedDict
from sleazy import parse, stringify
class AppConfig(TypedDict):
# 1) Required positional (exactly one string)
input_file: Annotated[str, 1]
# 2) Optional positional (zero or more strings)
tags: Annotated[str, "*"]
# 3) Optional keyword args
output: str # string
verbose: bool # flag
retries: int # integer
mode: Literal["auto", "manual"] # choice via Literal or enum
if __name__ == "__main__":
# parse() returns a dict matching AppConfig
args = parse(AppConfig) # python example.py data.txt tag1 tag2 --output out.txt --verbose --retries 5 --mode auto
print(args)
# {
# 'input_file': 'data.txt',
# 'tags': ['tag1', 'tag2'],
# 'output': 'out.txt',
# 'verbose': True,
# 'retries': 5,
# 'mode': 'auto'
# }
# stringify back to CLI args, using AppConfig to keep positionals first
print(stringify(args, AppConfig))
# [
# 'data.txt',
# 'tag1', 'tag2',
# '--output', 'out.txt',
# '--verbose',
# '--retries', '5',
# '--mode', 'auto'
# ]
# Without the TypedDict, stringify treats everything as flags
print(stringify(args))
# [
# '--input-file', 'data.txt',
# '--tags', 'tag1', '--tags', 'tag2',
# '--output', 'out.txt',
# '--verbose',
# '--retries', '5',
# '--mode', 'auto'
# ]
Notes
Annotated[type, count]
(1
, ?
, *
, +
, or exact integer).--field-name
flags by default.TypedDict
type to stringify()
so it knows which fields are positional (and their order). Without it,
everything is emitted as a keyword flag.FAQs
TypedDict based cli argument parsing
We found that sleazy 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.