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

chore: use annotations from the __future__ #203

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tonyandrewmeyer
Copy link
Collaborator

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 than scenario.State() style.

@tonyandrewmeyer
Copy link
Collaborator Author

Huh, but then it fails in CI. Weird. I'll move to draft and look into this more later.

@tonyandrewmeyer tonyandrewmeyer marked this pull request as draft September 24, 2024 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant