Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

orderings

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orderings

Ordering enumeration and protocols.

  • 1.6.0
  • PyPI
  • Socket score

Maintainers
1

orderings

License Version Downloads Discord

Documentation Check Test Coverage

Ordering enumeration and protocols.

Installation

Python 3.8 or above is required.

pip

Installing the library with pip is quite simple:

$ pip install orderings

Alternatively, the library can be installed from source:

$ pip install git+https://github.com/nekitdev/orderings.git

Or via cloning the repository:

$ git clone https://github.com/nekitdev/orderings.git
$ cd orderings
$ pip install .

poetry

You can add orderings as a dependency with the following command:

$ poetry add orderings

Or by directly specifying it in the configuration like so:

[tool.poetry.dependencies]
orderings = "^1.6.0"

Alternatively, you can add it directly from the source:

[tool.poetry.dependencies.orderings]
git = "https://github.com/nekitdev/orderings.git"

Motivation

Sometimes it's simpler to handle ordering in one method, for example when comparing iterators; then it's trivial to implement the regular ordering methods using the compare method.

Examples

Core

The core of orderings is the Ordering enumeration and the Compare protocol:

from typing import Generic, TypeVar

from attrs import frozen
from orderings import Compare, Ordered, Ordering, compare
from typing_extensions import Self

T = TypeVar("T", bound=Ordered)


@frozen()
class Wrap(Compare, Generic[T]):
    value: T

    def compare(self, other: Self) -> Ordering:
        return compare(self.value, other.value)

Compare implements all ordering operations (==, !=, <, >, <=, >=) using the compare method.

Documentation

You can find the documentation here.

Support

If you need support with the library, you can send an email or refer to the official Discord server.

Changelog

You can find the changelog here.

Security Policy

You can find the Security Policy of orderings here.

Contributing

If you are interested in contributing to orderings, make sure to take a look at the Contributing Guide, as well as the Code of Conduct.

License

orderings is licensed under the MIT License terms. See License for details.

Keywords

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc