chore: use annotations from the __future__ #203
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal here is to reduce the use of the name "Scenario" in the docs, to control where it appears when the docs are included at ops.readthedocs.io.
Using
from __future__ import annotations
seems to make Sphinx much happier when doing the class signatures, avoiding odd text like~scenario.state.CloudCredential
instead of the expected link with text "CloudCredential" and destination that class.When adding those imports, pyupgrade transformed all the type annotations - I wasn't previously aware that the future import made this possible in 3.8, but it seems to be the case. I've run all the tests with 3.8, 3.9, 3.10, 3.11, and 3.12 and they all pass, and I've manually tested in 3.8 and everything seems to work without any problems. I like this much more, so it seems like a win-win.
The pyupgrade pre-commit hook seemed to be running twice, so I've removed the duplication, and bumped the version from 3.7 to 3.8, and removed what looks like an out-of-date exclusion. I've also changed pyright to target 3.8 compatibility.
A couple of docstrings are changed to use the
State()
style rather thanscenario.State()
style.