Skip to content

Commit 4c7bbce

Browse files
committed
Add auto-generated API docs
1 parent 55169bb commit 4c7bbce

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

docs/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
"sphinx.ext.autodoc",
3838
"sphinx.ext.autosectionlabel",
3939
"sphinx.ext.autosummary",
40+
"sphinx.ext.intersphinx",
4041
"sphinx_autodoc_typehints",
4142
"pytoolconfig.documentation",
4243
"sphinx_rtd_theme",
44+
"autoapi.extension",
4345
]
4446

4547
# Add any paths that contain templates here, relative to this directory.
@@ -66,3 +68,12 @@
6668

6769
# Make sure the target is unique
6870
autosectionlabel_prefix_document = True
71+
72+
# Automatically-generated API docs:
73+
autoapi_dirs = ["../rope"]
74+
75+
# Automatic role selection for cross-references without one specified:
76+
default_role = "any"
77+
78+
# Intersphinx (link to external projects' docs)
79+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}

docs/library.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The first approach uses the ``Project.get_resource()`` method.
8181
8282
myresource = myproject.get_resource('/path/to/resource')
8383
84-
However, it's preferable to use the ``libutils.path_to_resource()``
84+
However, it's preferable to use the `libutils.path_to_resource()`
8585
function, because it's more flexible and offers a unified way to create
8686
resources. It takes a ``project`` and ``path`` as parameters with an
8787
optional ``type``. The ``type`` parameter, with values ``file`` or
@@ -212,14 +212,14 @@ One of the greatest strengths of rope is its Static Object Analysis
212212
of objects passed to the function. Rope uses the collected data to infer
213213
the type of function parameters, return values, and the objects stored
214214
in built-in containers. The function
215-
``rope.base.libutils.analyze_modules()`` performs SOA on all modules in
215+
`rope.base.libutils.analyze_modules` performs SOA on all modules in
216216
the project. It is recommended that you call this function occasionally,
217217
and especially before performing large refactorings. Note that analyzing
218218
all modules of a project may take a long time.
219219

220220
If you have ``automatic_soa`` set, which instructs rope to analyze the
221221
changed scopes of modules, then you should report the changes by calling
222-
``rope.base.libutils.report_change()`` when saving files, as follows:
222+
`rope.base.libutils.report_change()` when saving files, as follows:
223223

224224
.. code-block:: python
225225
@@ -354,8 +354,8 @@ values for ``type`` are the strings ``'file'`` or ``'folder'``.
354354
new_folder = libutils.path_to_resource(myproject, '/path/to/folder', type='folder')
355355
356356
357-
``rope.base.project.Project``
358-
=============================
357+
`rope.base.project.Project`
358+
===========================
359359

360360
You can create a project by:
361361

@@ -365,9 +365,9 @@ You can create a project by:
365365
366366
Where the ``root_address`` is the root folder of your project.
367367

368-
A project has some useful attributes. ``Project.address`` is the
369-
address of the root folder of a project. ``Project.root`` is a
370-
``Folder`` object that points to that folder.
368+
A project has some useful attributes. `Project.address` is the
369+
address of the root folder of a project. `Project.root` is a
370+
`Folder` object that points to that folder.
371371

372372

373373
`Project.do()`
@@ -446,13 +446,13 @@ history.
446446

447447
Provides useful methods for managing python modules and packages. Each
448448
project has a ``PyCore`` that can be accessed using the
449-
``Project.pycore`` attribute.
449+
`Project.pycore` attribute.
450450

451-
``PyCore.run_module()`` runs a resource. When running, it collects type
451+
`PyCore.run_module()` runs a resource. When running, it collects type
452452
information to do dynamic object inference. For this reason modules
453453
run much slower.
454454

455-
Also ``Pycore.analyze_module()`` collects object information for a
455+
Also `Pycore.analyze_module()` collects object information for a
456456
module. The collected information can be used to enhance rope's
457457
static object inference.
458458

@@ -522,10 +522,10 @@ exception.
522522
Refactorings
523523
============
524524

525-
Have a look at ``rope.refactor`` package and its sub-modules. For
525+
Have a look at the `rope.refactor` package and its sub-modules. For
526526
example for performing a move refactoring you can create an object
527527
representing this operation (which will be an instance of e.g.
528-
`MoveMethod`, `MoveModule`, ...) like this:
528+
`MoveMethod`, `MoveModule`, ...) using `create_move`.
529529

530530
.. code-block:: python
531531

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ doc = [
4545
"sphinx>=4.5.0",
4646
"sphinx-autodoc-typehints>=1.18.1",
4747
"sphinx-rtd-theme>=1.0.0",
48+
"sphinx-autoapi>=3",
4849
]
4950
dev = [
5051
'pytest>=7.0.1',

0 commit comments

Comments
 (0)