{"id":22498,"library":"types-pyfarmhash","title":"Types for pyfarmhash","description":"Typing stubs for pyfarmhash, provided by typeshed. Currently at version 0.4.0.20260408, updated regularly alongside typeshed releases. These stubs enable type-checking for the pyfarmhash library, which provides farmhash hash functions. Requires Python >=3.10.","status":"active","version":"0.4.0.20260408","language":"python","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typeshed","stubs","pyfarmhash","typing","hash"],"install":[{"cmd":"pip install types-pyfarmhash","lang":"bash","label":"Install stubs"}],"dependencies":[],"imports":[{"note":"The stubs mirror the module structure of pyfarmhash. Import directly from 'pyfarmhash', not a submodule.","wrong":"import pyfarmhash.farmhash","symbol":"FarmHash","correct":"from pyfarmhash import FarmHash; from typeshed stubs: import pyfarmhash"}],"quickstart":{"code":"import pyfarmhash\n\n# hash64 with bytes or string seed\nresult = pyfarmhash.hash64(b\"hello\", seed=123)\nprint(result)\n\n# hash64 with string seed (encoded in C)\nresult = pyfarmhash.hash64(\"hello\", seed=456)\nprint(result)\n","lang":"python","description":"Basic usage of pyfarmhash with type stub support."},"warnings":[{"fix":"Always pass seed as keyword: pyfarmhash.hash64(b'data', seed=0)","message":"The seed parameter must be provided as a keyword argument for some functions.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure input is bytes: pyfarmhash.hash64(b'123') vs hash64(123).","message":"Input types must be bytes or str for hash functions. Passing integers or other types will raise TypeError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install the runtime library: pip install pyfarmhash","cause":"pyfarmhash itself is not installed; only the stubs are installed.","error":"ImportError: No module named 'pyfarmhash'"},{"fix":"Use b'str' or my_str.encode()","cause":"Passing a string without encoding when bytes is expected.","error":"TypeError: expected bytes, not str"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}