# sortedcontainers-stubs
Community-maintained Python type stubs for the
[sortedcontainers](https://grantjenks.com/docs/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][issues], not at the sortedcontainers repo.
[issues]: https://github.com/h4l/sortedcontainers-stubs/issues
## History
These stubs were initially offered to sortedcontainers in a
[PR](https://github.com/grantjenks/python-sortedcontainers/pull/107). 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/h4l/sortedcontainers-stubs",
"name": "sortedcontainers-stubs",
"maintainer": "Hal Blackburn",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "hwtb2@cam.ac.uk",
"keywords": "",
"author": "Hal Blackburn",
"author_email": "hwtb2@cam.ac.uk",
"download_url": "https://files.pythonhosted.org/packages/f3/05/ca2588cc4d7bbe49819c0da58dc9ea5a95b1cec21278977cb4175c27427b/sortedcontainers_stubs-2.4.2.tar.gz",
"platform": null,
"description": "# sortedcontainers-stubs\n\nCommunity-maintained Python type stubs for the\n[sortedcontainers](https://grantjenks.com/docs/sortedcontainers/) Python\nlibrary. sortedcontainers provides dict, set and list data structures that\nmaintain the order of their elements by value (not by insertion order).\n\nThe sortedcontainers API has some differences and additional methods compared to\nregular Python dict, set and list types, and has additional requirements for\nkeys/values on whether they need to be hashable or comparable. These type stubs\nallow type checkers to enforce these details, which makes sortedcontainers\neasier to use.\n\n## Install\n\n```\n$ pip install sortedcontainers-stubs\n```\n\nOnce you've installed the package, mypy (or other tools) should automatically\nfind the types without any configuration.\n\n## Usage Notes\n\n`sortedcontainers.sorteddict.SortedKeyDict` and\n`sortedcontainers.sortedset.SortedKeySet` are stub-only subclasses of\n`SortedDict` and `SortedSet` \u2014 they don't exist at runtime. They exist as type\nstubs to describe the different return types of the `SortedDict` and `SortedSet`\nconstructors, which vary depending if a key function is used or not.\n\nHowever, `sortedcontainers.sortedlist.SortedKeyList` _is_ a real type that\nexists at runtime.\n\n## Version numbers\n\nThe sortedcontainers-stubs major and minor versions correspond to major and\nminor versions of sortedcontainers. The patch number increments independently if\nrequired to fix an issue. So if you're using sortedcontainers `2.4.X`, use the\nlatest `2.4.X` version of sortedcontainers-stubs.\n\nCurrently sortedcontainers-stubs version `2.4.0` has dependency metadata\nsupporting sortedcontainers `>=2,<3` as there are minimal API differences so far\nsince 2.0.\n\n## Reporting Issues\n\nReport issues with type stubs [here, at the sortedcontainers-stubs\nissues][issues], not at the sortedcontainers repo.\n\n[issues]: https://github.com/h4l/sortedcontainers-stubs/issues\n\n## History\n\nThese stubs were initially offered to sortedcontainers in a\n[PR](https://github.com/grantjenks/python-sortedcontainers/pull/107). After some\ndiscussion, the sortedcontainers developer, Grant Jenkins, indicated they'd\nprefer to keep the sortedcontainers codebase without type annotations, and\npublish the type stubs in a separate package. This repo is based on the stubs\nfrom that PR.\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Type stubs for sortedcontainers",
"version": "2.4.2",
"project_urls": {
"Changes": "https://github.com/h4l/sortedcontainers-stubs/blob/main/CHANGELOG.md",
"Homepage": "https://github.com/h4l/sortedcontainers-stubs",
"Issues": "https://github.com/h4l/sortedcontainers-stubs/issues",
"Repository": "https://github.com/h4l/sortedcontainers-stubs"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "561e38bb079b145c60d500c012f314180d5025a936c5eda0a7c73ffd3885f1f9",
"md5": "ec1a50f1ada707234092ffa820320a43",
"sha256": "6cdbcf9c71198729dd6c0a8a7dc9742768f25b49384b91965d716a9d16ca7b2a"
},
"downloads": -1,
"filename": "sortedcontainers_stubs-2.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ec1a50f1ada707234092ffa820320a43",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 8850,
"upload_time": "2023-10-28T07:32:06",
"upload_time_iso_8601": "2023-10-28T07:32:06.901843Z",
"url": "https://files.pythonhosted.org/packages/56/1e/38bb079b145c60d500c012f314180d5025a936c5eda0a7c73ffd3885f1f9/sortedcontainers_stubs-2.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f305ca2588cc4d7bbe49819c0da58dc9ea5a95b1cec21278977cb4175c27427b",
"md5": "548bf543a6019b922b6ad5f94e0ba62e",
"sha256": "c24e33877effa5a3eb85357112496ba33a0b681c05e0d5d3745664fd3be75d82"
},
"downloads": -1,
"filename": "sortedcontainers_stubs-2.4.2.tar.gz",
"has_sig": false,
"md5_digest": "548bf543a6019b922b6ad5f94e0ba62e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 7285,
"upload_time": "2023-10-28T07:32:07",
"upload_time_iso_8601": "2023-10-28T07:32:07.896897Z",
"url": "https://files.pythonhosted.org/packages/f3/05/ca2588cc4d7bbe49819c0da58dc9ea5a95b1cec21278977cb4175c27427b/sortedcontainers_stubs-2.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-28 07:32:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "h4l",
"github_project": "sortedcontainers-stubs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sortedcontainers-stubs"
}