Skip to content
Closed
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
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@
"polling_and_dir.ipynb",
"storage_and_executors.ipynb",
"hpc.ipynb",
"*",
]

nitpicky = True
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "examples/**/.venv/**"]


suppress_warnings = ["ref.python", "ref.class"]
# suppress_warnings = ["ref.python", "ref.class"]
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"typing_extensions": ("https://typing-extensions.readthedocs.io/en/latest/", None),
"pydantic": ("https://docs.pydantic.dev/latest/", None),
"pydantic_core": ("https://docs.pydantic.dev/latest/api/pydantic_core/", None),
"pytket": ("https://docs.quantinuum.com/tket/api-docs/", None),
"pytket.extensions.qiskit": (
"https://docs.quantinuum.com/tket/extensions/pytket-qiskit/",
Expand Down
17 changes: 17 additions & 0 deletions docs/source/examples/api/stubs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Code generated from hello_world_worker namespace. Please do not edit."""

from typing import NamedTuple
from tierkreis.controller.data.models import TKR


class greet(NamedTuple):
greeting: TKR[str] # noqa: F821 # fmt: skip
subject: TKR[str] # noqa: F821 # fmt: skip

@staticmethod
def out() -> type[TKR[str]]: # noqa: F821 # fmt: skip
return TKR[str] # noqa: F821 # fmt: skip

@property
def namespace(self) -> str:
return "hello_world_worker"
2 changes: 1 addition & 1 deletion docs/source/examples/scipy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
},
"outputs": [],
"source": [
"cd ~/.tierkreis/checkpoints/00000000-0000-0000-0000-0000000000cf`\n",
"cd ~/.tierkreis/checkpoints/00000000-0000-0000-0000-0000000000cf\n",
"cat ./-.N2/outputs/value"
]
},
Expand Down
2 changes: 1 addition & 1 deletion tierkreis/tierkreis/logger_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def set_tkr_logger(
Adds a filehandler for use in the controller.

:param file_name: The file to use for the logging.
:type file_name: Path
:type file_name: pathlib.Path
:param level: The log level, defaults to logging.INFO
:type level: int | str, optional
"""
Expand Down
4 changes: 2 additions & 2 deletions tierkreis/tierkreis/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def from_spec_file(cls, path: Path) -> "Namespace":
"""Generate a Namespace from a tsp spec file.

:param path: The path to the spec file.
:type path: Path
:type path: pathlib.Path
:return: The generated namespace.
:rtype: Namespace
"""
Expand Down Expand Up @@ -146,7 +146,7 @@ def write_stubs(self, stubs_path: Path) -> None:
"""Write the type stubs to stubs_path.

:param stubs_path: The location to write to.
:type stubs_path: Path
:type stubs_path: pathlib.Path
"""
if not stubs_path.parent.exists():
stubs_path.parent.mkdir(parents=True, exist_ok=True)
Expand Down
6 changes: 3 additions & 3 deletions tierkreis/tierkreis/pkg/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tierkreis.consts import WORKER_CACHE


class TKRDependency(ABC, BaseModel):
class TKRDependency(BaseModel, ABC):
"""A worker dependency for a Tierkreis project.

:fields:
Expand All @@ -32,8 +32,8 @@ def install(
:param worker_name: The name of the worker.
:type worker_name: str
:param target_dir: The target directory to install the worker into.
:type target_dir: Path
:type target_dir: pathlib.Path
:param worker_cache: The worker cache directory, defaults to WORKER_CACHE
:type worker_cache: Path, optional
:type worker_cache: pathlib.Path, optional
"""
...
4 changes: 2 additions & 2 deletions tierkreis/tierkreis/pkg/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def cache_subdir(self, worker_cache: Path) -> Path:
"""Get the worker cache subdirectory.

:param worker_cache: The base directory for worker caches.
:type worker_cache: Path
:type worker_cache: pathlib.Path
:return: The subdirectory path within the worker cache.
:rtype: Path
:rtype: pathlib.Path
"""
return worker_cache / "github" / self.account / self.repo / self.branch

Expand Down
12 changes: 6 additions & 6 deletions tierkreis/tierkreis/worker/storage/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def resolve(self, path: Path | str) -> Path:
E.g. for a file storage, relative paths are resolved against a base directory.

:param path: The path to resolve.
:type path: Path | str
:type path: pathlib.Path | str
:return: The resolved path according to the storage.
:rtype: Path
"""
Expand All @@ -32,7 +32,7 @@ def read_call_args(self, path: Path) -> WorkerCallArgs:
determine which function to call.

:param path: The path to read from.
:type path: Path
:type path: pathlib.Path
:return: The call args of the worker function.
:rtype: WorkerCallArgs
"""
Expand All @@ -44,7 +44,7 @@ def read_input(self, path: Path) -> bytes:
Input locations are defined in the call args.

:param path: The path to read from.
:type path: Path
:type path: pathlib.Path
:return: The bytes read from the input location.
:rtype: bytes
"""
Expand All @@ -56,7 +56,7 @@ def write_output(self, path: Path, value: bytes) -> None:
Output locations are defined in the call args.

:param path: The path to write to.
:type path: Path
:type path: pathlib.Path
:param value: The bytes to write.
:type value: bytes
"""
Expand All @@ -80,7 +80,7 @@ def mark_done(self, path: Path) -> None:
Done paths are defined in the call args.

:param path: The path to mark as done.
:type path: Path
:type path: pathlib.Path
"""
...

Expand All @@ -90,7 +90,7 @@ def write_error(self, path: Path, error_logs: str) -> None:
Logs are stored in a location defined in the call args.

:param path: The path to write the error logs to.
:type path: Path
:type path: pathlib.Path
:param error_logs: The message to write.
:type error_logs: str
"""
Expand Down
2 changes: 1 addition & 1 deletion tierkreis/tierkreis/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def run(self, worker_definition_path: Path) -> None:
"""Run a function with the parameters defined in worker_definition_path.

:param worker_definition_path: The worker call args written by the controller.
:type worker_definition_path: Path
:type worker_definition_path: pathlib.Path
:raises TierkreisError: When the function execution results in an error.
"""
node_definition = self.storage.read_call_args(worker_definition_path)
Expand Down