Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: use the right ops-scenario for building the docs #1470

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ version: 2

python:
install:
- method: pip
path: .
extra_requirements:
- docs
- requirements: docs/requirements.txt

build:
os: ubuntu-22.04
Expand Down
7 changes: 4 additions & 3 deletions docs/custom_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@
# pyspelling, sphinx, sphinx-autobuild, sphinx-copybutton, sphinx-design,
# sphinx-notfound-page, sphinx-reredirects, sphinx-tabs, sphinxcontrib-jquery,
# sphinxext-opengraph
custom_required_modules = [
'ops-scenario>=7.0.5,<8',
]
custom_required_modules = []

# Add files or directories that should be excluded from processing.
custom_excludes = [
Expand Down Expand Up @@ -318,6 +316,7 @@
('py:class', '_FileInfoDict'),
('py:class', '_NoticeDict'),
('py:class', '_ProgressDict'),
('py:class', '_RawPortProtocolLiteral'),
('py:class', '_Readable'),
('py:class', '_RelationMetaDict'),
('py:class', '_ResourceMetaDict'),
Expand Down Expand Up @@ -347,6 +346,8 @@
('py:class', 'ops.testing._ConfigOption'),
('py:class', 'ops.testing.CharmType'),
('py:obj', 'ops.testing.CharmType'),
('py:obj', 'scenario.state.CharmType'),
('py:class', 'scenario.state.CharmType'),
('py:class', 'scenario.state._EntityStatus'),
('py:class', 'scenario.state._Event'),
('py:class', 'scenario.state._max_posargs.<locals>._MaxPositionalArgs'),
Expand Down
11 changes: 2 additions & 9 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ mdurl==0.1.2
# via markdown-it-py
myst-parser==4.0.0
# via ops (pyproject.toml)
ops==2.16.1
# via ops-scenario
ops-scenario==7.0.5
# via ops (pyproject.toml)
packaging==24.1
# via sphinx
pygments==2.18.0
Expand All @@ -89,9 +85,7 @@ pyspelling==2.10
pyyaml==6.0.2
# via
# myst-parser
# ops
# ops (pyproject.toml)
# ops-scenario
# pyspelling
requests==2.32.3
# via
Expand Down Expand Up @@ -166,8 +160,7 @@ wcmatch==9.0
webencodings==0.5.1
# via html5lib
websocket-client==1.8.0
# via
# ops
# ops (pyproject.toml)
# via ops (pyproject.toml)
websockets==12.0
# via sphinx-autobuild
./testing/
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ docs = [
"sphinx-tabs",
"sphinxcontrib-jquery",
"sphinxext-opengraph",
"ops-scenario>=7.0.5,<8",
]
testing = [
"ops-scenario>=7.0.5,<8",
Expand Down
18 changes: 9 additions & 9 deletions testing/src/scenario/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import dataclasses
import datetime
import inspect
import pathlib
import random
import re
import string
from enum import Enum
from itertools import chain
from pathlib import Path, PurePosixPath
james-garner-canonical marked this conversation as resolved.
Show resolved Hide resolved
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -747,9 +747,9 @@ def _run(self) -> int:
class Mount(_max_posargs(0)):
"""Maps local files to a :class:`Container` filesystem."""

location: str | PurePosixPath
location: str | pathlib.PurePosixPath
"""The location inside of the container."""
james-garner-canonical marked this conversation as resolved.
Show resolved Hide resolved
source: str | Path
source: str | pathlib.Path
"""The content to provide when the charm does :meth:`ops.Container.pull`."""


Expand Down Expand Up @@ -1017,7 +1017,7 @@ def services(self) -> dict[str, pebble.ServiceInfo]:
infos[name] = info
return infos

def get_filesystem(self, ctx: Context) -> Path:
def get_filesystem(self, ctx: Context) -> pathlib.Path:
"""Simulated Pebble filesystem in this context.

Returns:
Expand Down Expand Up @@ -1314,7 +1314,7 @@ def __eq__(self, other: object) -> bool:
return (self.name, self.index) == (other.name, other.index)
return False

def get_filesystem(self, ctx: Context) -> Path:
def get_filesystem(self, ctx: Context) -> pathlib.Path:
"""Simulated filesystem root in this context."""
return ctx._get_storage_root(self.name, self.index)

Expand All @@ -1325,7 +1325,7 @@ class Resource(_max_posargs(0)):

name: str
"""The name of the resource, as found in the charm metadata."""
path: str | Path
path: str | pathlib.Path
"""A local path that will be provided to the charm as the content of the resource."""


Expand Down Expand Up @@ -1589,7 +1589,7 @@ class _CharmSpec(Generic[CharmType]):
is_autoloaded: bool = False

@staticmethod
def _load_metadata_legacy(charm_root: Path):
def _load_metadata_legacy(charm_root: pathlib.Path):
"""Load metadata from charm projects created with Charmcraft < 2.5."""
# back in the days, we used to have separate metadata.yaml, config.yaml and actions.yaml
# files for charm metadata.
Expand All @@ -1606,7 +1606,7 @@ def _load_metadata_legacy(charm_root: Path):
return meta, config, actions

@staticmethod
def _load_metadata(charm_root: Path):
def _load_metadata(charm_root: pathlib.Path):
"""Load metadata from charm projects created with Charmcraft >= 2.5."""
metadata_path = charm_root / "charmcraft.yaml"
meta: dict[str, Any] = (
Expand All @@ -1624,7 +1624,7 @@ def autoload(charm_type: type[CharmBase]) -> _CharmSpec[CharmType]:

Will attempt to load the metadata off the ``charmcraft.yaml`` file
"""
charm_source_path = Path(inspect.getfile(charm_type))
charm_source_path = pathlib.Path(inspect.getfile(charm_type))
charm_root = charm_source_path.parent.parent

# attempt to load metadata from unified charmcraft.yaml
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ description = Compile the requirements.txt file for docs
deps = pip-tools
commands =
pip-compile --extra=docs -o docs/requirements.txt pyproject.toml
python -c 'open("docs/requirements.txt", "a").write("./testing/\n")'
james-garner-canonical marked this conversation as resolved.
Show resolved Hide resolved

[testenv:docs]
description = Build the Sphinx docs
Expand Down