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.2.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for lighthouse-scoring-calculator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 073044c007ee789e583c4c5225076e277023464a31c9f4da671583c46b4ec9d7
MD5 9bede4087f5ec200ccf44703344024ca
BLAKE2b-256 0b62e8b10eba036c8cb35b7ed2e8b92d195809cbf8db93fd2b14ec6d1bcbe48b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lighthouse_scoring_calculator-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e06916b5529ced5a368b10421849f613d7332c0b96ead60f845d781ed3bbbf23
MD5 0662f4737e4823e81a82a14a21ce6130
BLAKE2b-256 6d15ea8aaf8c55a409c25e39ce1bb072c14e3ae4568341c9069619828060fd3d

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