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)
Authors
Acknowledgements
- lh-scorecalc
- Inspired by this website: https://googlechrome.github.io/lighthouse/scorecalc/
- Awesome README
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lighthouse-scoring-calculator-1.0.2.tar.gz
.
File metadata
- Download URL: lighthouse-scoring-calculator-1.0.2.tar.gz
- Upload date:
- Size: 43.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073044c007ee789e583c4c5225076e277023464a31c9f4da671583c46b4ec9d7 |
|
MD5 | 9bede4087f5ec200ccf44703344024ca |
|
BLAKE2b-256 | 0b62e8b10eba036c8cb35b7ed2e8b92d195809cbf8db93fd2b14ec6d1bcbe48b |
File details
Details for the file lighthouse_scoring_calculator-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: lighthouse_scoring_calculator-1.0.2-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e06916b5529ced5a368b10421849f613d7332c0b96ead60f845d781ed3bbbf23 |
|
MD5 | 0662f4737e4823e81a82a14a21ce6130 |
|
BLAKE2b-256 | 6d15ea8aaf8c55a409c25e39ce1bb072c14e3ae4568341c9069619828060fd3d |