Skip to content

Commit 3a521a1

Browse files
Initial working Python API docs drop.
1 parent 5337d89 commit 3a521a1

File tree

11 files changed

+2142
-187
lines changed

11 files changed

+2142
-187
lines changed

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BUILDDIR = _build
99

1010
DOXYGEN_XML=doxygen/xml
1111

12-
all: ${DOXYGEN_XML}
12+
all: #${DOXYGEN_XML}
1313
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1414

1515
${DOXYGEN_XML}: ../c/kastore.h

docs/_static/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Placeholder file to keep git happy.

docs/c-api.rst

Lines changed: 3 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,6 @@
11
.. _sec_c_api:
22

3-
===================
4-
C API Documentation
5-
===================
6-
7-
This is the C API documentation for kastore.
8-
9-
.. todo:: Give a short example program.
10-
11-
12-
******************
13-
General principles
14-
******************
15-
16-
--------------
17-
Error handling
18-
--------------
19-
20-
Functions return 0 to indicate success or an
21-
:ref:`error code <sec_c_api_error_codes>` to indicate a failure condition.
22-
Thus, the return value of all functions must be checked to ensure safety.
23-
24-
-------------
25-
Array lengths
26-
-------------
27-
28-
The length of arrays is specified in terms of the number of elements not bytes.
29-
30-
*********
31-
Top level
32-
*********
33-
34-
.. doxygenstruct:: kastore_t
35-
36-
.. doxygenfunction:: kastore_open
37-
.. doxygenfunction:: kastore_close
38-
39-
.. doxygenfunction:: kas_strerror
40-
41-
.. _sec_c_api_get:
42-
43-
*************
44-
Get functions
45-
*************
46-
47-
Get functions provide the interface for querying a store. The most general interface
48-
is :c:func:`kastore_get`, but it is usually more convenient to use one of the
49-
:ref:`typed get functions <sec_c_api_typed_get>`.
50-
51-
.. doxygenfunction:: kastore_get
52-
.. doxygenfunction:: kastore_gets
53-
54-
.. _sec_c_api_typed_get:
55-
56-
----------
57-
Typed gets
58-
----------
59-
60-
The functions listed here provide a convenient short-cut for accessing arrays
61-
where the key is a standard NULL terminated C string and the type of the
62-
array is known in advance.
63-
64-
.. doxygengroup:: TYPED_GETS_GROUP
65-
:content-only:
66-
67-
.. _sec_c_api_put:
68-
69-
*************
70-
Put functions
71-
*************
72-
73-
Put functions provide the interface for inserting data into store. The most
74-
general interface is :c:func:`kastore_put` which allows keys to be arbitrary
75-
bytes, but it is usually more convenient to use one of the :ref:`typed put
76-
functions <sec_c_api_typed_put>`.
77-
78-
.. doxygenfunction:: kastore_put
79-
.. doxygenfunction:: kastore_puts
80-
81-
.. _sec_c_api_typed_put:
82-
83-
----------
84-
Typed puts
85-
----------
86-
87-
The functions listed here provide a convenient short-cut for inserting
88-
key-array pairs where the key is a standard NULL terminated C string and the
89-
type of the array is known in advance.
90-
91-
.. doxygengroup:: TYPED_PUTS_GROUP
92-
:content-only:
93-
94-
95-
*********
96-
Constants
97-
*********
98-
99-
.. _sec_c_api_error_codes:
100-
101-
------
102-
Errors
103-
------
104-
105-
.. doxygengroup:: ERROR_GROUP
106-
:content-only:
107-
108-
-----
109-
Types
110-
-----
111-
112-
.. doxygengroup:: TYPE_GROUP
113-
:content-only:
114-
115-
-------------------
116-
Version information
117-
-------------------
118-
119-
.. doxygengroup:: API_VERSION_GROUP
120-
:content-only:
121-
122-
.. doxygengroup:: FILE_VERSION_GROUP
123-
:content-only:
124-
125-
***********************
126-
Miscellaneous functions
127-
***********************
128-
129-
.. doxygenstruct:: kas_version_t
130-
:members:
131-
132-
.. doxygenfunction:: kas_version
133-
134-
.. doxygenfunction:: kas_dynamic_api_init
3+
=====
4+
C API
5+
=====
1356

docs/conf.py

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# -- Project information -----------------------------------------------------
2626

27-
project = 'kastore'
27+
project = 'tskit'
2828
copyright = '2018, Tskit developers'
2929
author = 'Tskit developers'
3030

@@ -33,6 +33,57 @@
3333
# The full version, including alpha/beta/rc tags
3434
release = ''
3535

36+
###################################################################
37+
#
38+
# Monkey-patching sphinx to workaround really annoying bug in ivar
39+
# handling. See
40+
# https://stackoverflow.com/questions/31784830/sphinx-ivar-tag-goes-looking-for-cross-references
41+
#
42+
43+
from docutils import nodes
44+
from sphinx.util.docfields import TypedField
45+
from sphinx import addnodes
46+
47+
def patched_make_field(self, types, domain, items, env):
48+
# type: (List, unicode, Tuple) -> nodes.field
49+
def handle_item(fieldarg, content):
50+
par = nodes.paragraph()
51+
par += addnodes.literal_strong('', fieldarg) # Patch: this line added
52+
#par.extend(self.make_xrefs(self.rolename, domain, fieldarg,
53+
# addnodes.literal_strong))
54+
if fieldarg in types:
55+
par += nodes.Text(' (')
56+
# NOTE: using .pop() here to prevent a single type node to be
57+
# inserted twice into the doctree, which leads to
58+
# inconsistencies later when references are resolved
59+
fieldtype = types.pop(fieldarg)
60+
if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):
61+
typename = u''.join(n.astext() for n in fieldtype)
62+
par.extend(self.make_xrefs(self.typerolename, domain, typename,
63+
addnodes.literal_emphasis))
64+
else:
65+
par += fieldtype
66+
par += nodes.Text(')')
67+
par += nodes.Text(' -- ')
68+
par += content
69+
return par
70+
71+
fieldname = nodes.field_name('', self.label)
72+
if len(items) == 1 and self.can_collapse:
73+
fieldarg, content = items[0]
74+
bodynode = handle_item(fieldarg, content)
75+
else:
76+
bodynode = self.list_type()
77+
for fieldarg, content in items:
78+
bodynode += nodes.list_item('', handle_item(fieldarg, content))
79+
fieldbody = nodes.field_body('', bodynode)
80+
return nodes.field('', fieldname, fieldbody)
81+
82+
TypedField.make_field = patched_make_field
83+
84+
###################################################################
85+
86+
3687

3788
# -- General configuration ---------------------------------------------------
3889

@@ -110,7 +161,7 @@
110161
# -- Options for HTMLHelp output ---------------------------------------------
111162

112163
# Output file base name for HTML help builder.
113-
htmlhelp_basename = 'kastoredoc'
164+
htmlhelp_basename = 'tskitdoc'
114165

115166

116167
# -- Options for LaTeX output ------------------------------------------------
@@ -137,7 +188,7 @@
137188
# (source start file, target name, title,
138189
# author, documentclass [howto, manual, or own class]).
139190
latex_documents = [
140-
(master_doc, 'kastore.tex', 'kastore Documentation',
191+
(master_doc, 'tskit.tex', 'tskit Documentation',
141192
'Tskit developers', 'manual'),
142193
]
143194

@@ -147,7 +198,7 @@
147198
# One entry per manual page. List of tuples
148199
# (source start file, name, description, authors, manual section).
149200
man_pages = [
150-
(master_doc, 'kastore', 'kastore Documentation',
201+
(master_doc, 'tskit', 'tskit Documentation',
151202
[author], 1)
152203
]
153204

@@ -158,8 +209,8 @@
158209
# (source start file, target name, title, author,
159210
# dir menu entry, description, category)
160211
texinfo_documents = [
161-
(master_doc, 'kastore', 'kastore Documentation',
162-
author, 'kastore', 'One line description of project.',
212+
(master_doc, 'tskit', 'tskit Documentation',
213+
author, 'tskit', 'One line description of project.',
163214
'Miscellaneous'),
164215
]
165216

@@ -195,8 +246,8 @@
195246
todo_include_todos = True
196247

197248
# Breath extension lets us include doxygen C documentation.
198-
breathe_projects = {"kastore": "doxygen/xml" }
199-
breathe_default_project = "kastore"
249+
breathe_projects = {"tskit": "doxygen/xml" }
250+
breathe_default_project = "tskit"
200251
breathe_domain_by_extension = {"h": "c"}
201252
breathe_show_define_initializer = True
202253

docs/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ Welcome to kastore's documentation!
1414
installation
1515
python-api
1616
c-api
17-
format
1817
development
1918
changelogs
19+
interchange
20+
provenance
21+
tutorial
2022

2123

2224
Indices and tables

0 commit comments

Comments
 (0)