Skip to content
Open
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.12
rev: v0.16.10
hooks:
- id: ruff-format
- id: ruff
Expand Down
24 changes: 23 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
project = "amazon-braket-sdk"
version = version(project)
release = version
copyright = f"{datetime.datetime.now().year}, Amazon.com"
copyright = f"{datetime.datetime.now(tz=datetime.UTC).year}, Amazon.com"

extensions = [
"sphinxcontrib.apidoc",
Expand Down Expand Up @@ -142,6 +142,28 @@ def _write_llms_txt(app: Sphinx, exception: Exception | None) -> None:
print(f"--> Wrote {out.name}")


def _document_private_bases(
app: Sphinx, what: str, name: str, obj: object, skip: bool, options: dict
) -> bool | None:
"""Document private classes that public classes in the same module inherit from.

Without this, a public class's "Bases" line links to an undocumented private class,
and the members it inherits from that class appear nowhere in the API reference.
"""
if (
skip
and isinstance(obj, type)
and name.startswith("_")
and any(
sub.__module__ == obj.__module__ and not sub.__name__.startswith("_")
for sub in obj.__subclasses__()
)
):
return False
return None


def setup(app: Sphinx) -> None:
"""Register build hooks."""
app.connect("autodoc-skip-member", _document_private_bases)
app.connect("build-finished", _write_llms_txt)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ lint.ignore = [
"TRY003", # Longer messages are fine.
]
lint.per-file-ignores."test/**/*.py" = [
"ANN", # don't care about type annotations in tests
"D", # don't care about documentation in tests
"FBT", # don't care about booleans as positional arguments in tests
"INP001", # no implicit namespace
Expand Down
Loading
Loading