Skip to main content

LibProton

CircleCI

This is a library which simplifies the task of creating Proton compliant scoring scripts.

It supports Python 3.7+.

Install

Install from PyPI:

pip install libproton

API

The following is a complete and minimal Proton compliant scorer, and shows the expected usage of the library.

#!/usr/bin/env python

import libproton

class Scorer:
    def __init__(self, teams_data, arena_data):
        self._teams_data = teams_data
        self._arena_data = arena_data

    def calculate_scores(self):
        """Main scoring entry point.

           Expected to return a mapping of TLA -> score for each team in
           the input data. Errors either in the input or otherwise should
           be handled by raising exceptions.
        """
        scores = {}
        for tla in self._teams_data.keys():
            scores[tla] = 4
        return scores

    def validate(self, extra_data):
        """An optional additional method to validate the scoresheet.

           If this method is implemented it will be called with the value
           of the ``other`` key from the input. If the key is not present
           then this method will still be called (with ``None``).

           If there are validation errors the this method should raise
           an exception about them.
        """
        pass

if __name__ == '__main__:
    libproton.main(Scorer)

Tests

Run ./script/test.

Release files for libproton 3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libproton 3.3
File Size Uploaded
libproton-3.3.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for libproton 3.3
File Interpreter ABI Platform
libproton-3.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 16.0 kB

Release files / libproton-3.3.tar.gz

Download URL libproton-3.3.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
42f903a41f201a6fa2b8a5edde8c343db04f3037e6a9270c1c1382486acfc0e1
BLAKE2b-256 checksum
How to use checksums
d9ec13ca32148a042227ed4d0483ba6305f87a07759f37ddd524c0d6029b583d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release files / libproton-3.3-py2.py3-none-any.whl

Download URL libproton-3.3-py2.py3-none-any.whl
Size 8.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bfdb949ac8306ab0bd201472f651a046c33cc604de53e9c8151cb11d43b9b2a3
BLAKE2b-256 checksum
How to use checksums
b11dc156cb46f83dd68c7313b1355b03d7158b790b70ae6af83c6b67c96083ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

3.3 This release

2 release files

3.2

2 release files

3.1

2 release files

3.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page