techcable.orderedset
A simple and efficient OrderedSet in pure python. Implements both MutableSet and Sequence.
Example Usage
from techcable.orderedset import OrderedSet
# prints {1, 2, 7, 3}
print(OrderedSet([1, 2, 7, 2, 3]))
# Implements all standard set methods, still preserves order
print(OrderedSet.of[1,2]) | OrderedSet([3,2,4])) # {1,2,3,4}
# OrderedSet.of(1, 2) is shorthand for OrderedSet([1, 2]),
# avoiding an extra pair of brackets
print(OrderedSet.of(1, 2)) # {1, 2}
# Implements `append` method, returning True on success
# and False if the item was a duplicate
oset = OrderedSet()
oset.append(1) # True
oset.append(2) # True
oset.append(1) # False - already in set, did nothing
oset.extend([2,3]) # True - at least one success
oset.append([2,3]) # False - all duplicates
Supports pydantic validation & serialization:
import pydantic
from techcable.orderedset import OrderedSet
model = pydantic.TypeAdapter(OrderedSet[int])
# prints OrderedSet.of(1,2,7,8)
print(repr(model.validate_python([1,2,7,8])))
assert model.dump_python(OrderedSet.of(1,2,7,8)) == [1,2,7,8]
Potential Future Features
- Implement
OrderedFrozenSet - Consider acceleration module using C/Rust/Cython
- Probably unnecessary since this has library has very little overhead compared to the builtin
set/list
- Probably unnecessary since this has library has very little overhead compared to the builtin
License
Licensed under either the Apache 2.0 License or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Metadata
Release files for techcable.orderedset 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| techcable_orderedset-0.1.8.tar.gz | 16.7 kB | Without provenance | Details for techcable_orderedset-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| techcable_orderedset-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for techcable_orderedset-0.1.8-py3-none-any.whl |
Total release size: 30.0 kB
Release files / techcable_orderedset-0.1.8.tar.gz
| Download URL | techcable_orderedset-0.1.8.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cf9316e8c069a3bafc3b09fe27966ab9744dcddb5247bfe2a88588b48a486b7
|
|
BLAKE2b-256 checksum How to use checksums |
c4d39c1d47c5c963737373dffe108108cc5f8cd368d10db4d65253000c14a386
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / techcable_orderedset-0.1.8-py3-none-any.whl
| Download URL | techcable_orderedset-0.1.8-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
829b74d37a54a2067c1c3560900d82199bd81114b4bed45efdb9fff5f6085f78
|
|
BLAKE2b-256 checksum How to use checksums |
05d56cfb6a823881a56398b8a5df3eab836898b4c64a8935ce77f1ae52ecf8ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for techcable.orderedset 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.