Skip to main content

Description

Xtreys(eXtended treys) is a lightweight add-on to the library Treys. Xtreys uses integers created from Treys to rank hole cards, calculate equity, etc.

Installation

First, open your terminal and run:

pip install git+https://github.com/bingchiliingsacker-dot/Xtreys.git

or:

pip install xtreys

Note: If you run into any issues installing or using Xtreys, feel free to open a ticket on the Issues tab!

Usages

One of Xtreys' goals is to evaluate hole cards only. Cards are ranked from 1 to 91 with 'A-A' or pocket Ace's being the strongest and a '2-7' being the weakest hand

The function for this is preflop_eval.

Here is a quick test to see if Xtreys is working:

from treys import Deck
from xtreys import preflop_eval

d = Deck()
cards = d.draw(2)

rank = preflop_eval(cards)
print(f"Pre-flop hand rank:\t{rank}") #Output: Pre-flop hand rank:    1-91

Another usage of Xtreys is calculating the approximate and accurate equity of cards. approximate_equity gives an approximate equity from 0.1(lowest) to 0.9(highest).

Heres a quick test:

from xtreys import approximate_equity

d = Deck()

cards = d.draw(2)
flop_board = d.draw(3)
turn_card = d.draw(1)
river_card = d.draw(1)

turn_board = flop_board + turn_card
river_board = flop_board + river_card

flop_equity = approximate_equity(cards, flop_board)

print('---Flop---')
print(f'Approximate equity:\t{flop_equity}')
print('')

turn_equity = approximate_equity(cards, turn_board)

print('---Turn---')
print(f'Approximate equity:\t{turn_equity}')
print('')

river_equity = approximate_equity(cards, river_board)

print('---River---')
print(f'Approximate equity:\t{river_equity}')

'''
Output:
---Flop---
Approximate equity:     0.2

---Turn---
Approximate equity:     0.3

---River---
Approximate equity:     0.2
'''

Accurate equity outputs a much more pinpoint equity than approximate equity, it needs a cards variable of type list[int], a board variable of type list[int], and how many Monte-Carlo simulations you want to make(default=50).

Heres a quick test for accurate_equity:

from xtreys import accurate_equity
d = Deck()

cards = d.draw(2)
flop_board = d.draw(3)
turn_card = d.draw(1)
river_card = d.draw(1)

turn_board = flop_board + turn_card
river_board = flop_board + river_card

flop_equity = accurate_equity(cards, flop_board, 100)

print('---Flop---')
print(f'Accurate equity:\t{flop_equity:.2f}')
print('')

turn_equity = accurate_equity(cards, turn_board, 150)

print('---Turn---')
print(f'Accurate equity:\t{turn_equity:.2f}')
print('')

river_equity = accurate_equity(cards, river_board)

print('---River---')
print(f'Accurate equity:\t{river_equity:.2f}')

'''
Output:

---Flop---
Accurate equity:        0.54

---Turn---
Accurate equity:        0.39

---River---
Accurate equity:        0.30
'''

relative_equity outputs almost the same equity as accurate_equity, the only difference between the two is that relative_equity calculates the equity of the players hand based on behavior unlike accurate_equity which is accurate mathematically.

Here is a quick test for relative_equity:

from treys import Deck

for _ in range(5):
	deck = Deck()
	
	cards = deck.draw(2)
	board = deck.draw(3)
	
	opp_cards = [
	    deck.draw(2),
	    deck.draw(2),
	    deck.draw(2)
	]
	
	choice = ['bet', 'fold', 'check', 'call', 'raise', 'all_in']
	
	decision = choices(choice, k=3)
	
	equity = relative_equity(
	    cards=cards,
	    board=board,
	    opp_cards=opp_cards,
	    decision=decision,
	    average_aggression=uniform(0.0, 10.0)
	    )
	
	print('---Relative Equity Test---')
	print(f'cards:\t{cards}')
	print(f'Opponent cards:\t{opp_cards}')
	print(f'Board:\t{board}')
	print(f'Equity:\t{equity}')
	print('')

Metadata

Release files for xtreys 0.2.43

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xtreys 0.2.43
File Size Uploaded Provenance Actions
xtreys-0.2.43.tar.gz 4.9 kB With provenance Details for xtreys-0.2.43.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xtreys 0.2.43
File Interpreter ABI Platform Actions
xtreys-0.2.43-py3-none-any.whl Python 3 none any Details for xtreys-0.2.43-py3-none-any.whl

Total release size: 10.2 kB

Release files / xtreys-0.2.43.tar.gz

Download URL xtreys-0.2.43.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4d269397fea0adcf8e0c633681c2f9154913399cb9281cc7c459580b3efc8bca
BLAKE2b-256 checksum
How to use checksums
751a3b8aeaaccc810a89045d18971fe814794fad02519e32bbcbcb16f03e9f08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release files / xtreys-0.2.43-py3-none-any.whl

Download URL xtreys-0.2.43-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffb7a30a52019a86127bb1ace94d6751e25728279e9130032e83cc46cfb52e76
BLAKE2b-256 checksum
How to use checksums
a643e6a9aa2391eb159330ec0a904cce8627ac001d4cc4c2e26912298df20615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Security for xtreys 0.2.43

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xtreys-0.2.43.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page