Catalog PyPI
PACKAGE EXPLORERView in registry

abstract-metrics

PyPI

A lightweight framework for defining arbitrary business metrics as Python code.

Versions collected1
Direct dependencies0From release 0.1.0.dev5
Last observed20 Oct, 17:41 UTC

README

Version 0.1.0.dev5 documentation

Check All Build & Publish

✨Abstract✨ metrics

A lightweight framework for defining arbitrary business metrics as Python code.

Installation

pip install abstract-metrics

Basic Usage

  1. Install
  2. Subclass one of the metric types (e.g. ApplicationMetricBoolean)
  3. Add an optimistic compute method that returns your metric.
  4. Register a runner with your metric and run it!

Example

Let's say you want to write a metric that checks if one of your applications follows your organizations application naming standards. We will use the ApplicationMetricBoolean type to do this. All metrics are formated as {subject}Metric{type}. In this case, our subject is an Application and our type is Boolean.

Because Applications are our subject, we need to subclass ApplicationMetricBoolean. This class has a few methods that we can use to help us compute our metric. The most important one is compute. This method is called by the runner and should return a the boolean value. Additionally, we should use the application property (via the Application wrapper) to store any context we need to compute this metric.


from metric import Application, ApplicationMetric
from metric.utils import MatrixRunner
from metric.types import OutputFormat

def main():
    # Construct list of basic Application objects
    apps = [Application(app) for app in ["myorg-sales-app", "sandbox-dinasour"]]
    # Construct a list of our metrics
    metrics = [AppNameCompliance]

    # This will not only construct our Application Metrics but it will also execute
    # them and print them to stdout as a table.
    MatrixRunner(format=OutputFormat.OUTPUT_FORMAT_TABLE).run(apps, metrics)

class AppNameCompliance(ApplicationMetricBoolean):
    r"""All Application names should start with 'myorg-'."""

    def compute(self):
        if self.application.name.startswith("myorg-"):
            return True
        return False

If we run this code, we'll get the following output:

Application             AppNameCompliance
myorg-finance-app                    True
myorg-marketing-service              True
myorg-sales-app                      True
sandbox-dinasour                    False

Downloads & popularity

1downloads
1-day window · source-reported counts19 Oct 2026
54270
2026-07-23: 2 · observed 2026-10-20T20:54:07.4160035Z · period 2026-07-23–2026-07-232026-07-24: 3 · observed 2026-10-20T20:54:07.4160035Z · period 2026-07-24–2026-07-242026-07-26: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-07-26–2026-07-262026-07-27: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-07-27–2026-07-272026-07-29: 4 · observed 2026-10-20T20:54:07.4160035Z · period 2026-07-29–2026-07-292026-08-01: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-01–2026-08-012026-08-02: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-02–2026-08-022026-08-03: 12 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-03–2026-08-032026-08-04: 7 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-04–2026-08-042026-08-06: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-06–2026-08-062026-08-09: 4 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-09–2026-08-092026-08-13: 2 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-13–2026-08-132026-08-14: 4 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-14–2026-08-142026-08-16: 2 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-16–2026-08-162026-08-17: 8 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-17–2026-08-172026-08-18: 54 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-18–2026-08-182026-08-20: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-20–2026-08-202026-08-23: 3 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-23–2026-08-232026-08-24: 11 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-24–2026-08-242026-08-28: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-28–2026-08-282026-08-29: 3 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-29–2026-08-292026-08-30: 2 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-30–2026-08-302026-08-31: 5 · observed 2026-10-20T20:54:07.4160035Z · period 2026-08-31–2026-08-312026-09-03: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-03–2026-09-032026-09-06: 6 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-06–2026-09-062026-09-07: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-07–2026-09-072026-09-09: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-09–2026-09-092026-09-10: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-10–2026-09-102026-09-12: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-12–2026-09-122026-09-14: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-14–2026-09-142026-09-21: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-21–2026-09-212026-09-22: 2 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-22–2026-09-222026-09-23: 11 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-23–2026-09-232026-09-25: 2 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-25–2026-09-252026-09-26: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-26–2026-09-262026-09-27: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-27–2026-09-272026-09-28: 4 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-28–2026-09-282026-09-29: 3 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-29–2026-09-292026-09-30: 8 · observed 2026-10-20T20:54:07.4160035Z · period 2026-09-30–2026-09-302026-10-01: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-01–2026-10-012026-10-05: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-05–2026-10-052026-10-06: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-06–2026-10-062026-10-07: 2 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-07–2026-10-072026-10-08: 3 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-08–2026-10-082026-10-09: 4 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-09–2026-10-092026-10-10: 3 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-10–2026-10-102026-10-13: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-13–2026-10-132026-10-19: 1 · observed 2026-10-20T20:54:07.4160035Z · period 2026-10-19–2026-10-19
23 Jul19 Oct

pypistats · 48 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-19 – 2026-10-1912026-10-20T20:54:07.4160035Z
2026-10-13 – 2026-10-1312026-10-20T20:54:07.4160035Z
2026-10-10 – 2026-10-1032026-10-20T20:54:07.4160035Z
2026-10-09 – 2026-10-0942026-10-20T20:54:07.4160035Z
2026-10-08 – 2026-10-0832026-10-20T20:54:07.4160035Z
2026-10-07 – 2026-10-0722026-10-20T20:54:07.4160035Z
2026-10-06 – 2026-10-0612026-10-20T20:54:07.4160035Z
2026-10-05 – 2026-10-0512026-10-20T20:54:07.4160035Z
2026-10-01 – 2026-10-0112026-10-20T20:54:07.4160035Z
2026-09-30 – 2026-09-3082026-10-20T20:54:07.4160035Z
2026-09-29 – 2026-09-2932026-10-20T20:54:07.4160035Z
2026-09-28 – 2026-09-2842026-10-20T20:54:07.4160035Z
2026-09-27 – 2026-09-2712026-10-20T20:54:07.4160035Z
2026-09-26 – 2026-09-2612026-10-20T20:54:07.4160035Z
2026-09-25 – 2026-09-2522026-10-20T20:54:07.4160035Z
2026-09-23 – 2026-09-23112026-10-20T20:54:07.4160035Z
2026-09-22 – 2026-09-2222026-10-20T20:54:07.4160035Z
2026-09-21 – 2026-09-2112026-10-20T20:54:07.4160035Z
2026-09-14 – 2026-09-1412026-10-20T20:54:07.4160035Z
2026-09-12 – 2026-09-1212026-10-20T20:54:07.4160035Z
2026-09-10 – 2026-09-1012026-10-20T20:54:07.4160035Z
2026-09-09 – 2026-09-0912026-10-20T20:54:07.4160035Z
2026-09-07 – 2026-09-0712026-10-20T20:54:07.4160035Z
2026-09-06 – 2026-09-0662026-10-20T20:54:07.4160035Z
2026-09-03 – 2026-09-0312026-10-20T20:54:07.4160035Z
2026-08-31 – 2026-08-3152026-10-20T20:54:07.4160035Z
2026-08-30 – 2026-08-3022026-10-20T20:54:07.4160035Z
2026-08-29 – 2026-08-2932026-10-20T20:54:07.4160035Z
2026-08-28 – 2026-08-2812026-10-20T20:54:07.4160035Z
2026-08-24 – 2026-08-24112026-10-20T20:54:07.4160035Z
2026-08-23 – 2026-08-2332026-10-20T20:54:07.4160035Z
2026-08-20 – 2026-08-2012026-10-20T20:54:07.4160035Z
2026-08-18 – 2026-08-18542026-10-20T20:54:07.4160035Z
2026-08-17 – 2026-08-1782026-10-20T20:54:07.4160035Z
2026-08-16 – 2026-08-1622026-10-20T20:54:07.4160035Z
2026-08-14 – 2026-08-1442026-10-20T20:54:07.4160035Z
2026-08-13 – 2026-08-1322026-10-20T20:54:07.4160035Z
2026-08-09 – 2026-08-0942026-10-20T20:54:07.4160035Z
2026-08-06 – 2026-08-0612026-10-20T20:54:07.4160035Z
2026-08-04 – 2026-08-0472026-10-20T20:54:07.4160035Z
2026-08-03 – 2026-08-03122026-10-20T20:54:07.4160035Z
2026-08-02 – 2026-08-0212026-10-20T20:54:07.4160035Z
2026-08-01 – 2026-08-0112026-10-20T20:54:07.4160035Z
2026-07-29 – 2026-07-2942026-10-20T20:54:07.4160035Z
2026-07-27 – 2026-07-2712026-10-20T20:54:07.4160035Z
2026-07-26 – 2026-07-2612026-10-20T20:54:07.4160035Z
2026-07-24 – 2026-07-2432026-10-20T20:54:07.4160035Z
2026-07-23 – 2026-07-2322026-10-20T20:54:07.4160035Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.0.dev520 Sept 20230

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:41 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:23d92fce21e80d69f7cb9e94db403d079f177cc091226f6c2f41057fcc30bdb9