Skip to main content

Type stubs for sortedcontainers

Project description

sortedcontainers-stubs

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.

Install

$ pip install sortedcontainers-stubs

Once you've installed the package, mypy (or other tools) should automatically find the types without any configuration.

Usage Notes

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.

Version numbers

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.

Reporting Issues

Report issues with type stubs here, at the sortedcontainers-stubs issues, not at the sortedcontainers repo.

History

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sortedcontainers_stubs-2.4.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

sortedcontainers_stubs-2.4.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file sortedcontainers_stubs-2.4.2.tar.gz.

File metadata

File hashes

Hashes for sortedcontainers_stubs-2.4.2.tar.gz
Algorithm Hash digest
SHA256 c24e33877effa5a3eb85357112496ba33a0b681c05e0d5d3745664fd3be75d82
MD5 548bf543a6019b922b6ad5f94e0ba62e
BLAKE2b-256 f305ca2588cc4d7bbe49819c0da58dc9ea5a95b1cec21278977cb4175c27427b

See more details on using hashes here.

File details

Details for the file sortedcontainers_stubs-2.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sortedcontainers_stubs-2.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6cdbcf9c71198729dd6c0a8a7dc9742768f25b49384b91965d716a9d16ca7b2a
MD5 ec1a50f1ada707234092ffa820320a43
BLAKE2b-256 561e38bb079b145c60d500c012f314180d5025a936c5eda0a7c73ffd3885f1f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page