{"id":28408,"library":"tranco","title":"Tranco","description":"A Python library for accessing the Tranco top sites ranking, which is hardened against manipulation. Current version 0.8.1. Released periodically.","status":"active","version":"0.8.1","language":"python","source_language":"en","source_url":"https://github.com/DistriNet/tranco-python-package","tags":["tranco","top sites","ranking","web research"],"install":[{"cmd":"pip install tranco","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Correct import path as of v0.8+","symbol":"Tranco","correct":"from tranco import Tranco"}],"quickstart":{"code":"from tranco import Tranco\n\nt = Tranco(cache=True, cache_dir='.tranco')\nlatest_list = t.list()\nprint(latest_list.top(10)[:5])","lang":"python","description":"Initialize Tranco client with caching, fetch latest list, and print top 5 domains."},"warnings":[{"fix":"Use `from tranco import Tranco` and then `Tranco()`.","message":"In v0.8.0, the API changed from `tranco.Tranco()` to `Tranco()` direct import. Old code using `import tranco; t = tranco.Tranco()` may still work but is deprecated.","severity":"breaking","affected_versions":"<0.8.0"},{"fix":"Use `latest_list.top(n)` to get top n domains or `list(latest_list)` to get all.","message":"The `Tranco.list()` method returns a `TrancoList` object. Accessing `latest_list.top(10)` works, but iterating directly over the list object is deprecated; use `.top()` or `.list()` methods.","severity":"deprecated","affected_versions":"all"},{"fix":"Set `cache=False` or delete the cache directory (`./.tranco` by default).","message":"The `cache` parameter defaults to `True` in v0.8.0+, which caches the list locally. If you have an old cache file, it may prevent fetching a fresh list unless you clear the cache or set `cache=False`.","severity":"gotcha","affected_versions":">=0.8.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install with `pip install tranco` and use `from tranco import Tranco`.","cause":"The package is not installed or the import path is incorrect.","error":"ModuleNotFoundError: No module named 'tranco'"},{"fix":"Use `from tranco import Tranco` and then instantiate with `Tranco()`.","cause":"Trying to access the class via module incorrectly in older versions or after a bad install.","error":"AttributeError: module 'tranco' has no attribute 'Tranco'"},{"fix":"Use `t.list(date='latest')` or check available dates with `t.available_dates()`.","cause":"Requesting a list for a date that does not exist (e.g., future date or before dataset start).","error":"ValueError: The Tranco list is not available for the specified date"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}