Skip to content

Commit 8bb1fad

Browse files
committed
Add internal api doc
1 parent 3cbfae4 commit 8bb1fad

8 files changed

Lines changed: 81 additions & 20 deletions

File tree

cmdstanpy/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def _cleanup_tmpdir() -> None:
5050
from .utils import set_cmdstan_path # noqa
5151
from .utils import (
5252
cmdstan_path,
53+
cmdstan_version,
5354
install_cmdstan,
5455
set_make_env,
5556
show_versions,
@@ -71,4 +72,5 @@ def _cleanup_tmpdir() -> None:
7172
'write_stan_json',
7273
'show_versions',
7374
'rebuild_cmdstan',
75+
'cmdstan_version',
7476
]

cmdstanpy/install_cxx_toolchain.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424
from typing import Any, Dict, List
2525

2626
from cmdstanpy import _DOT_CMDSTAN
27-
from cmdstanpy.utils import (
28-
pushd,
29-
validate_dir,
30-
wrap_url_progress_hook,
31-
)
27+
from cmdstanpy.utils import pushd, validate_dir, wrap_url_progress_hook
3228

3329
EXTENSION = '.exe' if platform.system() == 'Windows' else ''
3430
IS_64BITS = sys.maxsize > 2 ** 32

cmdstanpy/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,7 @@ def show_versions(output: bool = True) -> str:
11631163

11641164
try:
11651165
deps_info.append(('cmdstan_folder', cmdstan_path()))
1166+
deps_info.append(('cmdstan', str(cmdstan_version())))
11661167
# pylint: disable=broad-except
11671168
except Exception:
11681169
deps_info.append(('cmdstan', 'NOT FOUND'))

docsrc/api.rst

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
API Reference
55
#############
66

7+
The following documents the public API of CmdStanPy. It is expected to be stable between versions,
8+
with backwards compatibility between minor versions and deprecation warnings preceeding breaking changes.
9+
There is also the `internal API <internal_api.rst>`__, which is makes no such guarantees.
10+
11+
.. toctree::
12+
:hidden:
13+
14+
internal_api.rst
15+
716
*******
817
Classes
918
*******
@@ -54,22 +63,15 @@ CmdStanVB
5463
:members:
5564

5665

57-
InferenceMetadata
58-
=================
59-
60-
.. autoclass:: cmdstanpy.InferenceMetadata
61-
:members:
62-
63-
RunSet
64-
======
65-
66-
.. autoclass:: cmdstanpy.stanfit.RunSet
67-
:members:
68-
6966
*********
7067
Functions
7168
*********
7269

70+
show_versions
71+
=============
72+
73+
.. autofunction:: cmdstanpy.show_versions
74+
7375
cmdstan_path
7476
============
7577

@@ -85,6 +87,11 @@ set_cmdstan_path
8587

8688
.. autofunction:: cmdstanpy.set_cmdstan_path
8789

90+
cmdstan_version
91+
================
92+
93+
.. autofunction:: cmdstanpy.cmdstan_version
94+
8895
set_make_env
8996
============
9097

docsrc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# serve to show the default.
1414

1515
import os
16-
import sys
1716
import subprocess
17+
import sys
1818

1919
# debug info
2020
print("python exec:", sys.executable)

docsrc/env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- python=3.7
6+
- python=3.9
77
- ipykernel
88
- ipython
99
- ipywidgets

docsrc/internal_api.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.. py:currentmodule:: cmdstanpy
2+
3+
######################
4+
Internal API Reference
5+
######################
6+
7+
The following documents the internal API of CmdStanPy. No guarantees are made about backwards compatibility between
8+
minor versions and refactors are expected. If you find yourself needing something exposed here, please
9+
`open an issue <https://github.com/stan-dev/cmdstanpy/issues>`__ requesting it be added to the `public API <api.rst>`__.
10+
11+
*******
12+
Classes
13+
*******
14+
15+
InferenceMetadata
16+
=================
17+
18+
.. autoclass:: cmdstanpy.InferenceMetadata
19+
:members:
20+
21+
RunSet
22+
======
23+
24+
.. autoclass:: cmdstanpy.stanfit.RunSet
25+
:members:
26+
27+
CompilerOptions
28+
===============
29+
30+
.. autoclass:: cmdstanpy.compiler_opts.CompilerOptions
31+
:members:
32+
33+
CmdStanArgs
34+
===========
35+
36+
.. autoclass:: cmdstanpy.cmdstan_args.CmdStanArgs
37+
:members:
38+
39+
SamplerArgs
40+
===========
41+
42+
.. autoclass:: cmdstanpy.cmdstan_args.SamplerArgs
43+
:members:
44+
45+
OptimizeArgs
46+
============
47+
48+
.. autoclass:: cmdstanpy.cmdstan_args.OptimizeArgs
49+
:members:
50+
51+
VariationalArgs
52+
===============
53+
54+
.. autoclass:: cmdstanpy.cmdstan_args.VariationalArgs
55+
:members:
56+

test/test_runset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from cmdstanpy.stanfit import RunSet
99
from cmdstanpy.utils import EXTENSION
1010

11-
1211
HERE = os.path.dirname(os.path.abspath(__file__))
1312
DATAFILES_PATH = os.path.join(HERE, 'data')
1413

0 commit comments

Comments
 (0)