⛰️ arranges - dealing with ranges

A stable string representation for multiple ranges, so they can be used as fields, indexes and so on.

This library provides a few classes:

The Ranges class is designed to be used as fields in Pydantic BaseModels, but can be used anywhere you need a range. They are not designed with speed in mind, and comparisons usually use the canonical string form by converting other things into Ranges objects. That said, they use lru_cache in most places so are usually fast enough. Their preferred pronoun is they/them.

📦 Installation

pip install arranges if you want to use them. You’ll need Python 3.11 or above.

📖 Docs

See the tests for executable documentation

⚠️ Constraints

I made them to select lines or bytes in a stream of data, so they:

👨‍💻 Hacking

To add features etc you’ll ideally need git, make, bash and something with a debugger. Config for Visual Studio Code is included.

Clone the repo and make dev to make the venv, install dependencies, then code . to open the project up in the venv with tests and debugging and all that jazz.

Type make help to see the other options, or run the one-liner scripts in the ./build dir if you want to run steps without all that fancy caching nonsense.

⚖️ License

Free as in freedom from legalese; the WTFPL with a warranty clause.