Skip to content

Commit

Permalink
Add kr8s.asyncio to api docs (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson authored Jul 2, 2024
1 parent fad5440 commit b047854
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 14 deletions.
25 changes: 15 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"sphinx.ext.autodoc",
"autoapi.extension",
]
suppress_warnings = ["autoapi"]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
Expand All @@ -50,7 +51,7 @@
"show-module-summary",
"imported-members",
]
autoapi_ignore = ["*tests*", "*conftest*", "*asyncio*"]
autoapi_ignore = ["*tests*", "*conftest*"]
# autoapi_python_use_implicit_namespaces = True
autoapi_keep_files = True
# autoapi_generate_api_docs = False
Expand Down Expand Up @@ -91,15 +92,19 @@ def remove_async_property(app, what, name, obj, skip, options):
# See https://github.com/readthedocs/sphinx-autoapi/issues/459
):
for child in obj.children:
if child.type == "method":
if child.name.startswith("async_"):
child.properties.append("private-async-only")
continue
if not child.name.startswith("_"):
if "async" in child.properties:
child.properties.remove("async")

if what == "method" and "private-async-only" in obj.properties:
if (
child.type == "method"
and not child.name.startswith("async_")
and not child.name.startswith("_")
and "async" in child.properties
):
child.properties.remove("async")

if (
what == "method"
and ("kr8s.objects" in name or "kr8s.asyncio.objects" in name)
and obj.name.startswith("async_")
):
skip = True
return skip

Expand Down
50 changes: 47 additions & 3 deletions kr8s/asyncio/objects.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2024, Kr8s Developers (See LICENSE for list)
# SPDX-License-Identifier: BSD 3-Clause License
from kr8s._objects import ( # noqa
from kr8s._objects import (
APIObject,
Binding,
ClusterRole,
Expand Down Expand Up @@ -37,9 +37,53 @@
ServiceAccount,
StatefulSet,
Table,
object_from_name_type,
objects_from_files,
get_class,
new_class,
object_from_name_type,
object_from_spec,
objects_from_files,
)

__all__ = [
"APIObject",
"Binding",
"ClusterRole",
"ClusterRoleBinding",
"ComponentStatus",
"ConfigMap",
"ControllerRevision",
"CronJob",
"CustomResourceDefinition",
"DaemonSet",
"Deployment",
"Endpoints",
"Event",
"HorizontalPodAutoscaler",
"Ingress",
"IngressClass",
"Job",
"LimitRange",
"Namespace",
"NetworkPolicy",
"Node",
"PersistentVolume",
"PersistentVolumeClaim",
"Pod",
"PodDisruptionBudget",
"PodTemplate",
"ReplicaSet",
"ReplicationController",
"ResourceQuota",
"Role",
"RoleBinding",
"Secret",
"Service",
"ServiceAccount",
"StatefulSet",
"Table",
"object_from_name_type",
"objects_from_files",
"get_class",
"new_class",
"object_from_spec",
]
4 changes: 3 additions & 1 deletion kr8s/asyncio/portforward.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2024, Kr8s Developers (See LICENSE for list)
# SPDX-License-Identifier: BSD 3-Clause License
from kr8s._portforward import PortForward # noqa
from kr8s._portforward import PortForward

__all__ = ["PortForward"]

0 comments on commit b047854

Please sign in to comment.