  We present GammaBayes, a Bayesian Python package for dark matter detection
with the Cherenkov Telescope Array (CTA). GammaBayes takes as input the CTA
measurements of gamma rays and a user-specified dark-matter particle model. It
outputs the posterior distribution for parameters of the dark-matter model
including the velocity-averaged cross section for dark-matter self interactions
$\langle\sigma v\rangle$ and the dark-matter mass $m_\chi$. It also outputs the
Bayesian evidence, which can be used for model selection. We demonstrate
GammaBayes using 525 hours of simulated data, corresponding to $10^8$ observed
gamma-ray events. The vast majority of this simulated data consists of noise,
but $100000$ events arise from the annihilation of scalar singlet dark matter
with $m_\chi= 1$ TeV. We recover the dark matter mass within a 95% credible
interval of $m_\chi \sim 0.96-1.07$ TeV. Meanwhile, the velocity averaged cross
section is constrained to $\langle\sigma v\rangle \sim 1.4-2.1\times10^{-25}$
cm$^3$ s$^{-1}$ (95% credibility). This is equivalent to measuring the number
of dark-matter annihilation events to be $N_S \sim 1.1_{-0.2}^{+0.2} \times
10^5$. The no-signal hypothesis $\langle \sigma v \rangle=0$ is ruled out with
about $5\sigma$ credibility. We discuss how GammaBayes can be extended to
include more sophisticated signal and background models and the computational
challenges that must be addressed to facilitate these upgrades. The source code
is publicly available at https://github.com/lpin0002/GammaBayes.
