Skip to content

Commit e9e1ea1

Browse files
authored
Merge pull request #911 from cderici/backward-port-sphinx-doc-fix-to-2.9
#911 #### Description This backports the changes from #899 into the `2.9` branch to have the docs be built successfully for the `2.9` PRs and releases. #### QA Steps The `docs` step down in the github actions from the readthedocs should be successfully building.
2 parents 9ef5a3e + 148c0cf commit e9e1ea1

12 files changed

Lines changed: 77 additions & 54 deletions

File tree

.readthedocs.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
python:
4+
install:
5+
- requirements: docs/requirements.txt
6+
7+
build:
8+
os: ubuntu-22.04
9+
tools:
10+
python: "3.10"
11+
12+
sphinx:
13+
configuration: docs/conf.py

CONTRIBUTORS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@ Benjamin Saller
22
Tim Van Steenburgh
33
Cory Johns
44
Pete VanderGiessen
5+
Pen Gale
6+
Juan Tirado Martin
7+
Caner Derici
8+
Simon Richardson
9+
Jack Shaw
10+
Leon Mintz
11+
Adam Dyess

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ test: lint
2424
tox -e py3
2525
tox -e integration
2626

27-
2827
.PHONY: lint
2928
lint:
3029
tox -e lint
3130

3231
.PHONY: docs
33-
docs: .tox
34-
$(PIP) install -r docs/requirements.txt
35-
rm -rf docs/_build/
36-
$(BIN)/sphinx-build -b html docs/ docs/_build/
37-
cd docs/_build/ && zip -r docs.zip *
32+
docs:
33+
tox -e docs
3834

3935
.PHONY: release
4036
release:

docs/_extensions/automembersummary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import textwrap
1919

2020
from docutils import nodes
21+
from docutils.parsers.rst import Directive
2122
from docutils.statemachine import ViewList
2223
from sphinx.errors import SphinxError
23-
from sphinx.util.compat import Directive
2424
from sphinx.util.nodes import nested_parse_with_titles
2525

2626

docs/api/juju.cloud.rst

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
#
7878
# This is also used if you do content translation via gettext catalogs.
7979
# Usually you set "language" from the command line for these cases.
80-
language = None
80+
language = "en"
8181

8282
# There are two options for replacing |today|: either, you set today to some
8383
# non-false value, then it is used:
@@ -300,4 +300,4 @@
300300
#texinfo_no_detailmenu = False
301301

302302
def setup(app):
303-
app.add_stylesheet('custom.css')
303+
app.add_css_file('custom.css')

docs/narrative/application.rst

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ To deploy a new application, connect a model and then call its
1717
await model.connect_current()
1818
1919
mysql_app = await model.deploy(
20-
# If a revision number is not included in the charm url,
21-
# the latest revision from the Charm Store will be used.
22-
'cs:mysql-55',
23-
application_name='mysql',
24-
series='trusty',
25-
channel='stable',
20+
'mysql',
21+
application_name='my-mysql',
22+
series='jammy',
23+
channel='8.0/stable',
2624
config={
2725
'tuning-level': 'safest',
2826
},
@@ -46,9 +44,9 @@ To deploy a local charm, pass the charm directory path to
4644
4745
# Deploy a local charm using a path to the charm directory
4846
await model.deploy(
49-
'/home/tvansteenburgh/src/charms/ubuntu',
47+
'./charms/ubuntu',
5048
application_name='ubuntu',
51-
series='trusty',
49+
series='jammy',
5250
)
5351
5452
@@ -63,7 +61,6 @@ added units (:class:`~juju.unit.Unit` objects) is returned.
6361
ubuntu_app = await model.deploy(
6462
'ubuntu',
6563
application_name='ubuntu',
66-
series='trusty',
6764
channel='stable',
6865
)
6966
@@ -107,18 +104,18 @@ The :meth:`juju.application.Application.relate` method returns a
107104
108105
# Deploy mysql-master application
109106
mysql_master = await model.deploy(
110-
'cs:mysql-55',
107+
'mysql',
111108
application_name='mysql-master',
112-
series='trusty',
113-
channel='stable',
109+
series='jammy',
110+
channel='8.0/stable',
114111
)
115112
116113
# Deploy mysql-slave application
117114
mysql_slave = await model.deploy(
118-
'cs:mysql-55',
115+
'mysql',
119116
application_name='mysql-slave',
120-
series='trusty',
121-
channel='stable',
117+
series='jammy',
118+
channel='8.0/stable',
122119
)
123120
124121
# Add the master-slave relation

docs/narrative/controller.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ these endpoints.
66

77
Connecting to the controller endpoint is useful if you want to programmatically
88
create a new model. If the model you want to use already exists, you can
9-
connect directly to it (see py:doc:`model`).
9+
connect directly to it (see :doc:`model`).
1010

11-
For API docs, see py:class:`juju.controller.Controller`.
11+
For API docs, see :class:`juju.controller.Controller`.
1212

1313

1414
Connecting to the Current Controller

docs/narrative/model.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A Juju controller provides websocket endpoints for each of its
44
models. In order to do anything useful with a model, the juju lib must
55
connect to one of these endpoints. There are several ways to do this.
66

7-
For api docs, see py:class:`juju.model.Model`.
7+
For api docs, see :class:`juju.model.Model`.
88

99

1010
Connecting to the Current Model
@@ -92,8 +92,8 @@ require the Juju CLI client to be installed.
9292
Creating and Destroying a Model
9393
-------------------------------
9494
Example of creating a new model and then destroying it. See
95-
py:method:`juju.controller.Controller.add_model` and
96-
py:method:`juju.controller.Controller.destroy_model` for more info.
95+
:method:`juju.controller.Controller.add_model` and
96+
:method:`juju.controller.Controller.destroy_model` for more info.
9797

9898
.. code:: python
9999
@@ -119,8 +119,8 @@ py:method:`juju.controller.Controller.destroy_model` for more info.
119119
Adding Machines and Containers
120120
------------------------------
121121
To add a machine or container, connect to a model and then call its
122-
py:method:`~juju.model.Model.add_machine` method. A
123-
py:class:`~juju.machine.Machine` instance is returned. The machine id
122+
:method:`~juju.model.Model.add_machine` method. A
123+
:class:`~juju.machine.Machine` instance is returned. The machine id
124124
can be used to deploy a charm to a specific machine or container.
125125

126126
.. code:: python
@@ -177,7 +177,7 @@ Reacting to Changes in a Model
177177
------------------------------
178178
To watch for and respond to changes in a model, register an observer with the
179179
model. The easiest way to do this is by creating a
180-
py:class:`juju.model.ModelObserver` subclass.
180+
:class:`juju.model.ModelObserver` subclass.
181181

182182
.. code:: python
183183
@@ -268,7 +268,7 @@ to the entity and type of change that you wish to handle.
268268
# specific handler method is not defined.
269269
270270
271-
Any py:class:`juju.model.ModelEntity` object can be observed directly by
271+
Any :class:`juju.model.ModelEntity` object can be observed directly by
272272
registering callbacks on the object itself.
273273

274274
.. code:: python

docs/readme.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ Here's a simple example that shows basic usage of the library. The example
4343
connects to the currently active Juju model, deploys a single unit of the
4444
ubuntu charm, then exits:
4545

46+
.. note::
47+
48+
Pylibjuju requires an already bootstrapped Juju controller to connect to.
4649

4750
.. code:: python
4851
@@ -68,9 +71,7 @@ ubuntu charm, then exits:
6871
# from the stable channel of the Charm Store.
6972
ubuntu_app = await model.deploy(
7073
'ubuntu',
71-
application_name='ubuntu',
72-
series='xenial',
73-
channel='stable',
74+
application_name='my-ubuntu',
7475
)
7576
7677
if '--wait' in sys.argv:
@@ -128,5 +129,7 @@ and then, to connect to the current model and fetch status:
128129
Versioning
129130
----------
130131

131-
Pylibjuju releases now track the Juju release cadence. New generated schemas
132+
The current Pylibjuju release policy tracks the Juju release cadence.
133+
In particular, whenever Juju makes a latest/stable release, pylibjuju pushes out
134+
a release with the same version in the following week. Newly generated schemas
132135
will be updated per Juju releases.

0 commit comments

Comments
 (0)