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.
sortedcontainers-stubs
Advanced tools
Community-maintained Python type stubs for the sortedcontainers Python library. sortedcontainers provides dict, set and list data structures that maintain the order of their elements by value (not by insertion order).
The sortedcontainers API has some differences and additional methods compared to regular Python dict, set and list types, and has additional requirements for keys/values on whether they need to be hashable or comparable. These type stubs allow type checkers to enforce these details, which makes sortedcontainers easier to use.
$ pip install sortedcontainers-stubs
Once you've installed the package, mypy (or other tools) should automatically find the types without any configuration.
sortedcontainers.sorteddict.SortedKeyDict
and
sortedcontainers.sortedset.SortedKeySet
are stub-only subclasses of
SortedDict
and SortedSet
— they don't exist at runtime. They exist as type
stubs to describe the different return types of the SortedDict
and SortedSet
constructors, which vary depending if a key function is used or not.
However, sortedcontainers.sortedlist.SortedKeyList
is a real type that
exists at runtime.
The sortedcontainers-stubs major and minor versions correspond to major and
minor versions of sortedcontainers. The patch number increments independently if
required to fix an issue. So if you're using sortedcontainers 2.4.X
, use the
latest 2.4.X
version of sortedcontainers-stubs.
Currently sortedcontainers-stubs version 2.4.0
has dependency metadata
supporting sortedcontainers >=2,<3
as there are minimal API differences so far
since 2.0.
Report issues with type stubs here, at the sortedcontainers-stubs issues, not at the sortedcontainers repo.
These stubs were initially offered to sortedcontainers in a PR. After some discussion, the sortedcontainers developer, Grant Jenkins, indicated they'd prefer to keep the sortedcontainers codebase without type annotations, and publish the type stubs in a separate package. This repo is based on the stubs from that PR.
FAQs
Type stubs for sortedcontainers
We found that sortedcontainers-stubs 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.