Skip to content

Commit 7b75b4f

Browse files
sphinx-related work (#554)
fixes #510
1 parent 715126c commit 7b75b4f

File tree

9 files changed

+59
-15
lines changed

9 files changed

+59
-15
lines changed

.github/workflows/docs.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: docs
2+
3+
on: ["push", "pull_request"]
4+
5+
jobs:
6+
docs:
7+
# We want to run on external PRs, but not on our own internal PRs as they'll be run
8+
# by the push to the branch.
9+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
10+
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.x'
17+
architecture: 'x64'
18+
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Build
23+
shell: bash
24+
run: |
25+
pip install -r requirements.txt
26+
make cython
27+
pip install .
28+
29+
- name: Sphinx Documentation Generator
30+
run: |
31+
pip install tox
32+
tox -e sphinx

docs/_static/README.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sphinx will copy the contents of docs/_static/ directory to the build location.

docs/api.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ API reference
55

66
.. autofunction:: pack
77

8-
:func:`dump` is alias for :func:`pack`
8+
``dump()`` is an alias for :func:`pack`
99

1010
.. autofunction:: packb
1111

12-
:func:`dumps` is alias for :func:`packb`
12+
``dumps()`` is an alias for :func:`packb`
1313

1414
.. autofunction:: unpack
1515

16-
:func:`load` is alias for :func:`unpack`
16+
``load()`` is an alias for :func:`unpack`
1717

1818
.. autofunction:: unpackb
1919

20-
:func:`loads` is alias for :func:`unpackb`
20+
``loads()`` is an alias for :func:`unpackb`
2121

2222
.. autoclass:: Packer
2323
:members:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
# sys.path.insert(0, os.path.abspath('.'))
19+
#sys.path.insert(0, os.path.abspath('..'))
2020

2121
# -- General configuration -----------------------------------------------------
2222

msgpack/_packer.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ cdef class Packer(object):
7171
7272
Packer's constructor has some keyword arguments:
7373
74-
:param callable default:
74+
:param default:
75+
When specified, it should be callable.
7576
Convert user type to builtin type that Packer supports.
7677
See also simplejson's document.
7778

msgpack/_unpacker.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ cdef class Unpacker(object):
217217
218218
:param file_like:
219219
File-like object having `.read(n)` method.
220-
If specified, unpacker reads serialized data from it and :meth:`feed()` is not usable.
220+
If specified, unpacker reads serialized data from it and `.feed()` is not usable.
221221
222222
:param int read_size:
223223
Used as `file_like.read(read_size)`. (default: `min(16*1024, max_buffer_size)`)
@@ -241,12 +241,12 @@ cdef class Unpacker(object):
241241
:param bool strict_map_key:
242242
If true (default), only str or bytes are accepted for map (dict) keys.
243243
244-
:param callable object_hook:
244+
:param object_hook:
245245
When specified, it should be callable.
246246
Unpacker calls it with a dict argument after unpacking msgpack map.
247247
(See also simplejson)
248248
249-
:param callable object_pairs_hook:
249+
:param object_pairs_hook:
250250
When specified, it should be callable.
251251
Unpacker calls it with a list of key-value pairs after unpacking msgpack map.
252252
(See also simplejson)

msgpack/ext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def from_unix(unix_sec):
120120
"""Create a Timestamp from posix timestamp in seconds.
121121
122122
:param unix_float: Posix timestamp in seconds.
123-
:type unix_float: int or float.
123+
:type unix_float: int or float
124124
"""
125125
seconds = int(unix_sec // 1)
126126
nanoseconds = int((unix_sec % 1) * 10**9)
@@ -154,7 +154,7 @@ def to_unix_nano(self):
154154
def to_datetime(self):
155155
"""Get the timestamp as a UTC datetime.
156156
157-
:rtype: datetime.
157+
:rtype: `datetime.datetime`
158158
"""
159159
utc = datetime.timezone.utc
160160
return datetime.datetime.fromtimestamp(0, utc) + datetime.timedelta(seconds=self.to_unix())

msgpack/fallback.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class Unpacker:
139139
140140
:param file_like:
141141
File-like object having `.read(n)` method.
142-
If specified, unpacker reads serialized data from it and :meth:`feed()` is not usable.
142+
If specified, unpacker reads serialized data from it and `.feed()` is not usable.
143143
144144
:param int read_size:
145145
Used as `file_like.read(read_size)`. (default: `min(16*1024, max_buffer_size)`)
@@ -163,12 +163,12 @@ class Unpacker:
163163
:param bool strict_map_key:
164164
If true (default), only str or bytes are accepted for map (dict) keys.
165165
166-
:param callable object_hook:
166+
:param object_hook:
167167
When specified, it should be callable.
168168
Unpacker calls it with a dict argument after unpacking msgpack map.
169169
(See also simplejson)
170170
171-
:param callable object_pairs_hook:
171+
:param object_pairs_hook:
172172
When specified, it should be callable.
173173
Unpacker calls it with a list of key-value pairs after unpacking msgpack map.
174174
(See also simplejson)
@@ -616,7 +616,8 @@ class Packer:
616616
617617
Packer's constructor has some keyword arguments:
618618
619-
:param callable default:
619+
:param default:
620+
When specified, it should be callable.
620621
Convert user type to builtin type that Packer supports.
621622
See also simplejson's document.
622623

tox.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ envlist =
33
{py35,py36,py37,py38}-{c,pure},
44
{pypy,pypy3}-pure,
55
py34-x86,
6+
sphinx,
67
isolated_build = true
78

89
[testenv]
@@ -27,3 +28,11 @@ commands=
2728
python -c 'import sys; print(hex(sys.maxsize))'
2829
python -c 'from msgpack import _cmsgpack'
2930
py.test
31+
32+
33+
[testenv:sphinx]
34+
changedir = docs
35+
deps =
36+
sphinx
37+
commands =
38+
sphinx-build -n -v -W --keep-going -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

0 commit comments

Comments
 (0)