Skip to main content

Calculate the Lighthouse scoring for a website

Project description

Lighthouse Scoring Calculator

Python package to calculate the Lighthouse scoring for a website (same as pagespeed.web.dev)

GPLv3 License PyPI

Authors

Acknowledgements

Features

  • Python module to directly use the calculator in Python projects
  • CLI to use the calculator directly from the command line
  • Multiple Lighthouse version support
  • Cross platform
  • Support for Lighthouse mobile and desktop test

Usage/Examples

from lighthouse_scoring_calculator import LighthouseScoringCalculator

testData = {
    "FCP": 2130,
    "SI": 5800,
    "FMP": 4000,
    "TTI": 7300,
    "FCI": 6500,
    "LCP": 4000,
    "TBT": 600,
    "CLS": 0.25
}

calculator = LighthouseScoringCalculator(testData, "mobile", "v9")

print("Score:", calculator.calc_score())
print("Rating of FCP:", calculator.get_rating("FCP"))

CLI Reference

usage: lighthouse_scoring_calculator.py [-h] [-d DEVICE] [-v VERSION] [--fcp FCP] [--si SI] [--fmp FMP] [--tti TTI] [--fci FCI] [--lcp LCP] [--tbt TBT] [--cls CLS]

Calculate the score and rating of each metric
Example: $ python3 -m lighthouse_scoring_calculator -d mobile -v v9 --fcp 2130 --si 5800 --fmp 4000 --tti 7300 --fci 6500 --lcp 4000 --tbt 600 --cls 0.25

options:
  -h, --help            show this help message and exit
  -d DEVICE, --device DEVICE
                        The device type
  -v VERSION, --version VERSION
                        The lighthouse version
  --fcp FCP             The First Contentful Paint metric
  --si SI               The Speed Index metric
  --fmp FMP             The First Meaningful Paint metric
  --tti TTI             The Time to Interactive metric
  --fci FCI             The First CPU Idle metric
  --lcp LCP             The Largest Contentful Paint metric
  --tbt TBT             The Total Blocking Time metric
  --cls CLS             The Cumulative Layout Shift metric

Installation

You can install the Lighthouse Scoring Calculator from PyPI:

python -m pip install lighthouse-scoring-calculator

Feedback

If you have any feedback, please reach out to us via GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lighthouse-scoring-calculator-1.0.3.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file lighthouse-scoring-calculator-1.0.3.tar.gz.

File metadata

File hashes

Hashes for lighthouse-scoring-calculator-1.0.3.tar.gz
Algorithm Hash digest
SHA256 901b8e07832116daa299b9bd7c2e04b5dddd623fdf8f00a1c446a2ecf441930e
MD5 701e99ec726488b10651d2fb4abcb598
BLAKE2b-256 d1a7fa2efe0301221bb0703850d7a2c7a46d0770b88f2d6efe43a570606e6cf8

See more details on using hashes here.

File details

Details for the file lighthouse_scoring_calculator-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lighthouse_scoring_calculator-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 360d00480930e34c7cd1f8d4e6ae74c40d133aa7a664c9d2208f96da530be7c0
MD5 0bf33c6371ba232aa9126c3b489614c4
BLAKE2b-256 05606c483cda9cfd4777cf40ce2499d7d7585a53efa3ecf95587c7ed32659606

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page