{"id":24733,"library":"treys","title":"treys","description":"treys is a pure Python poker hand evaluation library. It provides fast evaluation of 5-, 6-, and 7-card poker hands, as well as deck and card utilities. Current version 0.1.8 is stable with low release cadence.","status":"active","version":"0.1.8","language":"python","source_language":"en","source_url":"https://github.com/ihendley/treys","tags":["poker","hand-evaluation","card-games","games"],"install":[{"cmd":"pip install treys","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Card is exported at package level","wrong":"from treys.card import Card","symbol":"Card","correct":"from treys import Card"},{"note":"Deck is exported at package level","wrong":"from treys.deck import Deck","symbol":"Deck","correct":"from treys import Deck"},{"note":"Evaluator is exported at package level","wrong":"from treys.evaluator import Evaluator","symbol":"Evaluator","correct":"from treys import Evaluator"}],"quickstart":{"code":"from treys import Card, Deck, Evaluator\n\ndeck = Deck()\nboard = deck.draw(5)\nhand = deck.draw(2)\n\nevaluator = Evaluator()\nrank = evaluator.evaluate(board, hand)\nprint(\"Hand rank:\", evaluator.class_to_string(evaluator.get_rank_class(rank)))\nprint(\"Hand description:\", evaluator.get_hand_description(board, hand))","lang":"python","description":"Basic usage: create a deck, draw a community board and a hand, then evaluate the hand rank."},"warnings":[{"fix":"Use Card.new or Card.from_str to create cards from string, not the Card constructor directly.","message":"Card objects printed as strings show a representation like 'Ah' (Ace of hearts), but for input use Card.new('Ah') or Card.from_str('Ah').","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'from treys import Card, Deck, Evaluator' instead of deep imports.","message":"In version 0.1.6 and earlier, the import path was 'treys.card', 'treys.deck', 'treys.evaluator'. In 0.1.7+ the public API changed to import from 'treys' directly.","severity":"breaking","affected_versions":">=0.1.7"},{"fix":"No action needed; just be aware of the two-step process to get a rank string.","message":"The method evaluator.get_rank_class() returns an integer; evaluator.class_to_string() converts it to a human-readable rank string. There is no plan to remove but usage is stable.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.1.8':32 '5':16 '6':17 '7':19 'cadenc':38 'card':20,28,44 'card-gam':43 'current':30 'deck':26 'evalu':9,14,42 'fast':13 'game':45,46 'hand':8,22,41 'hand-evalu':40 'librari':10 'low':36 'poker':7,21,39 'provid':12 'pure':5 'python':6 'releas':37 'stabl':34 'trey':1,2 'util':29 'version':31 'well':24","created_at":"2026-05-01T08:14:38.697219+00:00","updated_at":"2026-05-01T08:14:38.697219+00:00","problems":[{"fix":"Use 'from treys import Card' instead of 'import treys'.","cause":"Old import pattern 'import treys' and then 'treys.Card' does not work because Card is not automatically imported. The library uses explicit submodule imports.","error":"AttributeError: module 'treys' has no attribute 'Card'"},{"fix":"Use 'Th' for ten of hearts. For full card string, e.g., 'Ah' for Ace of hearts.","cause":"Hand string '10h' is invalid; treys expects single-character ranks (2-9, T, J, Q, K, A) and suits (h, d, c, s). Ten is represented as 'Th'.","error":"ValueError: The card '10h' could not be interpreted"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.8","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/ihendley/treys","docs":null,"changelog":null,"pypi":"https://pypi.org/project/treys/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}