From 34057f223d097b1e02c7f31460d67fbac427424d Mon Sep 17 00:00:00 2001 From: samfreund Date: Sat, 12 Apr 2025 22:29:41 -0500 Subject: [PATCH] autogen files --- .gitignore | 3 +++ photon-lib/py/docs/SUMMARY.md | 32 +++++++++++++++++++++++ photon-lib/py/docs/estimatedRobotPose.md | 3 --- photon-lib/py/docs/packet.md | 3 --- photon-lib/py/docs/photonCamera.md | 3 --- photon-lib/py/docs/photonPoseEstimator.md | 3 --- photon-lib/py/gen_api_docs.py | 29 ++++++++++++++++++++ photon-lib/py/mkdocs.yml | 22 ++++++++++------ 8 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 photon-lib/py/docs/SUMMARY.md delete mode 100644 photon-lib/py/docs/estimatedRobotPose.md delete mode 100644 photon-lib/py/docs/packet.md delete mode 100644 photon-lib/py/docs/photonCamera.md delete mode 100644 photon-lib/py/docs/photonPoseEstimator.md create mode 100644 photon-lib/py/gen_api_docs.py diff --git a/.gitignore b/.gitignore index eaa45f922..1ac8577cd 100644 --- a/.gitignore +++ b/.gitignore @@ -154,3 +154,6 @@ networktables.json website/node_modules website/dist + +photon-lib/py/site +photon-lib/py/docs/reference diff --git a/photon-lib/py/docs/SUMMARY.md b/photon-lib/py/docs/SUMMARY.md new file mode 100644 index 000000000..101cd07c9 --- /dev/null +++ b/photon-lib/py/docs/SUMMARY.md @@ -0,0 +1,32 @@ +* [estimatedRobotPose](reference/estimatedRobotPose.md) +* estimation + * [cameraTargetRelation](reference/estimation/cameraTargetRelation.md) + * [openCVHelp](reference/estimation/openCVHelp.md) + * [rotTrlTransform3d](reference/estimation/rotTrlTransform3d.md) + * [targetModel](reference/estimation/targetModel.md) + * [visionEstimation](reference/estimation/visionEstimation.md) +* generated + * [MultiTargetPNPResultSerde](reference/generated/MultiTargetPNPResultSerde.md) + * [PhotonPipelineMetadataSerde](reference/generated/PhotonPipelineMetadataSerde.md) + * [PhotonPipelineResultSerde](reference/generated/PhotonPipelineResultSerde.md) + * [PhotonTrackedTargetSerde](reference/generated/PhotonTrackedTargetSerde.md) + * [PnpResultSerde](reference/generated/PnpResultSerde.md) + * [TargetCornerSerde](reference/generated/TargetCornerSerde.md) +* networktables + * [NTTopicSet](reference/networktables/NTTopicSet.md) +* [packet](reference/packet.md) +* [photonCamera](reference/photonCamera.md) +* [photonPoseEstimator](reference/photonPoseEstimator.md) +* simulation + * [photonCameraSim](reference/simulation/photonCameraSim.md) + * [simCameraProperties](reference/simulation/simCameraProperties.md) + * [videoSimUtil](reference/simulation/videoSimUtil.md) + * [visionSystemSim](reference/simulation/visionSystemSim.md) + * [visionTargetSim](reference/simulation/visionTargetSim.md) +* targeting + * [TargetCorner](reference/targeting/TargetCorner.md) + * [multiTargetPNPResult](reference/targeting/multiTargetPNPResult.md) + * [photonPipelineResult](reference/targeting/photonPipelineResult.md) + * [photonTrackedTarget](reference/targeting/photonTrackedTarget.md) +* timesync + * [timeSyncServer](reference/timesync/timeSyncServer.md) diff --git a/photon-lib/py/docs/estimatedRobotPose.md b/photon-lib/py/docs/estimatedRobotPose.md deleted file mode 100644 index 506e8adf8..000000000 --- a/photon-lib/py/docs/estimatedRobotPose.md +++ /dev/null @@ -1,3 +0,0 @@ -# EstimatedRobotPose API - -::: photonlibpy.estimatedRobotPose diff --git a/photon-lib/py/docs/packet.md b/photon-lib/py/docs/packet.md deleted file mode 100644 index 50602fc62..000000000 --- a/photon-lib/py/docs/packet.md +++ /dev/null @@ -1,3 +0,0 @@ -# Packet API - -::: photonlibpy.packet diff --git a/photon-lib/py/docs/photonCamera.md b/photon-lib/py/docs/photonCamera.md deleted file mode 100644 index 2c1fcdd88..000000000 --- a/photon-lib/py/docs/photonCamera.md +++ /dev/null @@ -1,3 +0,0 @@ -# PhotonCamera API - -::: photonlibpy.photonCamera diff --git a/photon-lib/py/docs/photonPoseEstimator.md b/photon-lib/py/docs/photonPoseEstimator.md deleted file mode 100644 index 5075a84c0..000000000 --- a/photon-lib/py/docs/photonPoseEstimator.md +++ /dev/null @@ -1,3 +0,0 @@ -# Photon Pose Estimator API - -::: photonlibpy.photonPoseEstimator diff --git a/photon-lib/py/gen_api_docs.py b/photon-lib/py/gen_api_docs.py new file mode 100644 index 000000000..61b751773 --- /dev/null +++ b/photon-lib/py/gen_api_docs.py @@ -0,0 +1,29 @@ +# gen_api_docs.py + +from pathlib import Path +import mkdocs_gen_files + +nav = mkdocs_gen_files.Nav() + +for path in sorted(Path("photonlibpy").rglob("*.py")): + if path.name == "py.typed": + continue + + module_path = path.with_suffix("").as_posix().replace("/", ".") + parts = tuple(path.relative_to("photonlibpy").with_suffix("").parts) + + if path.name == "__init__.py": + continue + else: + doc_path = Path("reference", *parts).with_suffix(".md") + + nav[parts] = doc_path.as_posix() + + with mkdocs_gen_files.open(doc_path, "w") as f: + f.write(f"# `{module_path}`\n\n::: {module_path}") + + mkdocs_gen_files.set_edit_path(doc_path, path) + +with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file: + nav_file.writelines(nav.build_literate_nav()) + diff --git a/photon-lib/py/mkdocs.yml b/photon-lib/py/mkdocs.yml index 80626c158..e31618aff 100644 --- a/photon-lib/py/mkdocs.yml +++ b/photon-lib/py/mkdocs.yml @@ -1,18 +1,24 @@ -site_name: PhotonVision Python API Docs - +site_name: PhotonLibPy Docs theme: name: material + favicon: images/favicon.ico # If you want a favicon + logo: images/logo.png # Optional logo plugins: - search - mkdocstrings: - default_handler: python + handlers: + python: + paths: ["."] + setup_commands: + - import sys; sys.path.append(".") + - gen-files: + scripts: + - gen_api_docs.py + - literate-nav + - section-index nav: - Home: index.md - - API Reference: - - PhotonCamera: photonCamera.md - - EstimatedRobotPose: estimatedRobotPose.md - - Packet: packet.md - - PhotonPoseEstimator: photonPoseEstimator.md + - Reference: reference/SUMMARY.md