Skip to content

Commit 109add1

Browse files
authored
Minor documentation fixes (#919)
* Added [`sphinx-autobuild`](https://github.com/sphinx-doc/sphinx-autobuild) to improve documentation development flow * Added [`sphinx-copybutton`](https://github.com/executablebooks/sphinx-copybutton) and [`sphinxext-opengraph`](https://github.com/wpilibsuite/sphinxext-opengraph) extension to the Read the Docs build * Updating tons of references across the entire codebase to the official Python documentation using [`intersphinx`](https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html) (added in #909)
1 parent 86b0878 commit 109add1

File tree

11 files changed

+215
-192
lines changed

11 files changed

+215
-192
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
* Added `:end-line` and `:end-col` metadata to forms during compilation (#903)
10+
* Added `basilisp.repl/source` to allow inspecting source code from the REPL (#205)
1011

1112
### Changed
1213
* Updated dozens of type annotations in the compiler to satisfy MyPy 1.11 (#910)
@@ -21,8 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2122
* Fix a bug where reader column offset numbering began at 1, rather than 0 (#905)
2223

2324
### Other
25+
* Add REPL documentation module (#205)
2426
* Update Sphinx documentation theme (#909)
25-
* Fix a few minor documentation issues (#907)
27+
* Update documentation to directly reference Python documentation and fix many other minor issues and misspellings (#907, #919)
2628

2729
## [v0.1.0b2]
2830
### Added

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
DOCSOURCEDIR = "./docs"
2+
DOCBUILDDIR = "./docs/_build"
3+
14
.PHONY: docs
25
docs:
3-
@poetry run sphinx-build -M html "./docs" "./docs/_build"
6+
@poetry run sphinx-build -M html "$(DOCSOURCEDIR)" "$(DOCBUILDDIR)"
7+
8+
9+
.PHONY: livedocs
10+
livedocs:
11+
@poetry run sphinx-autobuild "$(DOCSOURCEDIR)" "$(DOCBUILDDIR)" -b html
412

513

614
.PHONY: format

docs/cli.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Run Basilisp as an Application
9292

9393
Python applications don't have nearly as many constraints on their entrypoints as do Java applications.
9494
Nevertheless, developers may have a clear entrypoint in mind when designing their application code.
95-
In such cases, it may be desirable to take advantage of the computed Python ``sys.path`` to invoke your entrypoint.
95+
In such cases, it may be desirable to take advantage of the computed Python :external:py:data:`sys.path` to invoke your entrypoint.
9696
To do so, you can use the ``basilisp run -n`` flag to invoke an namespace directly:
9797

9898
.. code-block:: bash

docs/concepts.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ References and Refs
216216

217217
TBD
218218

219+
.. _volatiles:
220+
221+
Volatiles
222+
---------
223+
224+
TBD
225+
219226
.. _transducers:
220227

221228
Transducers

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
extensions = [
3131
"sphinx.ext.autodoc",
3232
"sphinx.ext.intersphinx",
33+
"sphinxext.opengraph",
34+
"sphinx_copybutton",
3335
"basilisp.contrib.sphinx",
3436
]
3537

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ sphinxcontrib-devhelp>=1.0.6,<2.0.0
88
sphinxcontrib-htmlhelp>=2.0.5,<3.0.0
99
sphinxcontrib-qthelp>=1.0.7,<2.0.0
1010
sphinxcontrib-serializinghtml>=1.1.10,<2.0.0
11+
sphinx-copybutton>=0.5.2,<1.0.0
12+
sphinxext-opengraph>=0.9.1,<1.0.0

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ pytest-pycharm = "*"
5757
# to maintain consistent output during both development and publishing on
5858
# Read The Docs.
5959
sphinx = "^7.1.0"
60+
sphinx-autobuild = { version = "^2024.04.16", python = ">=3.9" }
61+
sphinx-copybutton = "^0.5.2"
62+
sphinxext-opengraph = "^v0.9.1"
6063
furo = "^2023.08.19"
6164
tox = "*"
6265

src/basilisp/contrib/bencode.lpy

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
;; Decoding logic adapted from
22
;; https://github.com/babashka/nbb/blob/bca8b5017a06768eb35d02a2d6233ca9c6c2f692/src/nbb/impl/bencode.cljs
33
(ns basilisp.contrib.bencode
4+
"Support for bencode encoding and decoding."
45
(:require
56
[basilisp.string :as str]))
67

@@ -82,24 +83,24 @@
8283

8384
``encode`` supports encoding the following types:
8485

85-
- ``bytes``
86-
- ``int``
87-
- ``str``, which is first decided to UTF-8 ``bytes``
86+
- :external:py:class:`bytes`
87+
- :external:py:class:`int`
88+
- :external:py:class:`str` , which is first decoded to UTF-8 ``bytes``
8889
- keywords and symbols, which are first converted to strings (including namespace,
8990
separated by '/') and then converted using the rules for ``str`` s
90-
- Python ``list``
91-
- ``tuple``
92-
- Basilisp lists and vectors
93-
- ``dict``
94-
- maps
91+
- :external:py:class:`list`
92+
- :external:py:class:`tuple`
93+
- :external:py:class:`dict`
94+
- Basilisp lists, vectors, and maps
9595

9696
Mapping type keys must one of: keywords, symbols, or strings.
9797

9898
This function does not support ``float`` because the ``bencode`` specification does
9999
not support non-integer numerics.
100100

101-
Set types (including ``frozenset``, ``set``, or Basilisp's set types) are not
102-
supported due to the requirement that lists retain their original element ordering."
101+
Set types (including :external:py:class:`frozenset` , :external:py:class:`set`, or
102+
Basilisp's set types) are not supported due to the requirement that lists retain
103+
their original element ordering."
103104
[d]
104105
(to-bencode-encodeable* d))
105106

@@ -111,11 +112,10 @@
111112
`(.index ~b ~c))
112113

113114
(defn- slice
114-
"Returns the slice of the ``bytes`` from the ``start`` index to
115-
the end of the array or to the ``end`` index if provided. Returns
116-
`nil` if the slice is empty.
115+
"Returns the slice of the ``bytes`` from the ``start`` index to the end of the
116+
array or to the ``end`` index if provided. Returns ``nil`` if the slice is empty.
117117

118-
Throw a `python/EOFError` exception if any of the indices are out
118+
Throw a :external:py:exc:`python.EOFError` exception if any of the indices are out
119119
of bounds."
120120
([bytes start]
121121
(if (< (len bytes) start)
@@ -178,13 +178,13 @@
178178

179179
(defn decode
180180
"Decode the first value in the bencoded ``data`` bytes according to ``opts`` and
181-
return a [decoded* rest*] vector.
181+
return a ``[decoded* rest*]`` vector.
182182

183183
The decoded* item in the vector is the decoded value of the first item in ``data``
184184
while rest* is the remaining unencoded values.
185185

186186
If ``data`` cannot be decoded (e.g. is incomplete or an error occurred), it returns
187-
a [nil ``data``] vector.
187+
a ``[nil data]`` vector.
188188

189189
``opts`` is a map with the following optional supported keys.
190190

@@ -207,12 +207,12 @@
207207
[nil data]))))
208208

209209
(defn decode-all
210-
"Decode all values in the bencoded ``data`` bytes and return them as
211-
a [values* incomplete*] vector.
210+
"Decode all values in the bencoded ``data`` bytes and return them as a
211+
``[values* incomplete*]`` vector.
212212

213-
The values* item is a collection of the ``data`` decoded values,
214-
while incomplete* is the rest of the ``data`` bytes that could not
215-
be decoded or nil.
213+
The ``values*`` item is a collection of the ``data`` decoded values, while
214+
``incomplete*`` is the rest of the ``data`` bytes that could not be decoded
215+
or ``nil``.
216216

217217
``opts`` is a map supporting the same keys as :lpy:fn:`decode`."
218218
([data]

0 commit comments

Comments
 (0)