Skip to content

Commit 06aee07

Browse files
authored
Create linkcheck.yml (viamrobotics#655)
1 parent ac3183c commit 06aee07

File tree

8 files changed

+80
-14
lines changed

8 files changed

+80
-14
lines changed

.github/workflows/linkcheck.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# .github/workflows/run-htmltest.yml
2+
# (c) 2021 Robb Romans
3+
#
4+
# Run htmltest link checker on generated HTML output in dist/
5+
# https://github.com/wjdp/htmltest
6+
#
7+
name: run-htmltest-external
8+
concurrency:
9+
group: pullrequest-untrusted-htmltest-${{ github.event.number }}
10+
cancel-in-progress: true
11+
on: pull_request
12+
jobs:
13+
htmltest:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Install Poetry
25+
uses: snok/install-poetry@v1
26+
27+
- name: Install package
28+
run: make install
29+
30+
- name: Generate docs
31+
run: |
32+
make documentation
33+
34+
- name: Test HTML
35+
# https://github.com/wjdp/htmltest-action/
36+
# Don't fail the build on broken links
37+
continue-on-error: false
38+
uses: wjdp/htmltest-action@master
39+
with:
40+
config: .htmltest.yml
41+
- name: Archive htmltest results
42+
uses: actions/upload-artifact@v3
43+
# Note: Set ACTIONS_RUNTIME_TOKEN env variable to test with nektos/act
44+
with:
45+
name: htmltest-report
46+
path: tmp/.htmltest/htmltest.log
47+
retention-days: 7 # Default is 90 days

.htmltest.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
DirectoryPath: "docs/_build/html"
2+
EnforceHTTPS: true
3+
IgnoreEmptyHref: true
4+
IgnoreInternalEmptyHash: true
5+
IgnoreDirectoryMissingTrailingSlash: false
6+
IgnoreURLs:
7+
- "app.viam.com"
8+
- "fonts.gstatic.com"
9+
- "contributor-covenant.org"
10+
IgnoreDirs:
11+
- "lib"
12+
CacheExpires: "6h"
13+
# IgnoreDirs: - if we need to ever ignore files
14+
CheckInternal: false
15+
CheckDoctype: false
16+
CheckScripts: false
17+
FileExtension: ".html"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Sessions are a safety feature that automatically cancel operations made by the p
100100
Read the [Example Usage](https://python.viam.dev/examples/example.html) page, to learn how to access a component, build a custom component, and expose
101101
custom components as a remote to existing robots.
102102
103-
More examples can be found in the [`examples`](/examples) directory.
103+
More examples can be found in the [`examples`](https://github.com/viamrobotics/viam-python-sdk/tree/main/examples) directory.
104104
105105
## Documentation
106106

docs/examples/example.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
"### 2. Register the new modular resource\n",
318318
"Now that we've created the modular resource model, we must register it to the registry.\n",
319319
"\n",
320-
"Define a [`Model`](https://docs.viam.com/extend/modular-resources/#models) name and a creator function in the resource. A creator function is a function that can create a resource given a config and map of dependencies.\n",
320+
"Define a [`Model`](https://docs.viam.com/appendix/glossary/#term-model) name and a creator function in the resource. A creator function is a function that can create a resource given a config and map of dependencies.\n",
321321
"\n",
322322
"To define a creator function and `Model` in `wifi_sensor_module.py`, import `ComponentConfig`, `ResourceName`, `ResourceBase`, `Model`, and `ModelFamily` from the relative viam packages. Please note that the import packages also have to be changed to include `Mapping` and `ClassVar` from `typing` and `Self` from `typing_extensions`. The changes can be seen in the example below.\n",
323323
"\n",
@@ -533,7 +533,7 @@
533533
"\n",
534534
"[Configure your new module](https://docs.viam.com/extend/modular-resources/#configure-your-module) on your robot by navigating to the **Config** tab of the robot's page on the Viam app, then click on the **Modules** subtab. Add the name of your module and the executable path. For our example, the path would be `<path-on-your-filesystem>/linux-wifi/run.sh`.\n",
535535
"\n",
536-
"Once you have configured a module as part of your robot configuration, [configure your modular resource](https://docs.viam.com/extend/modular-resources/#configure-your-modular-resource) made available by that module by adding new components or services configured with your modular resources' new type or model. To instantiate a new resource from your module, specify the `type`, `model`, and `name` of your modular resource. The aforementioned `type`, `model`, and `name` should be the same as those in the `MODEL` class attribute defined in your [component class](#2-register-the-custom-component). This is a JSON example:\n",
536+
"Once you have configured a module as part of your robot configuration, [configure your modular resource](https://docs.viam.com/extend/modular-resources/#configure-your-modular-resource) made available by that module by adding new components or services configured with your modular resources' new type or model. To instantiate a new resource from your module, specify the `type`, `model`, and `name` of your modular resource. The aforementioned `type`, `model`, and `name` should be the same as those in the `MODEL` class attribute defined in your [component class](#register-the-custom-component). This is a JSON example:\n",
537537
"\n",
538538
"```json\n",
539539
"{\n",
@@ -555,7 +555,7 @@
555555
"}\n",
556556
"```\n",
557557
"\n",
558-
"Note the nomenclature of the above `model` field, `viam:sensor:linux-wifi`. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#models).\n",
558+
"Note the nomenclature of the above `model` field, `viam:sensor:linux-wifi`. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/registry/create/#name-your-new-resource-model).\n",
559559
"\n",
560560
"Viam also provides many built-in models that implement API capabilities, each using `rdk` as the `namespace`, and `builtin` as the `family`:\n",
561561
"- The `rdk:builtin:gpio` model of the `rdk:component:motor` API provides RDK support for [GPIO-controlled DC motors](https://docs.viam.com/components/motor/gpio/).\n",
@@ -570,7 +570,7 @@
570570
"### Custom Modular Arm Example\n",
571571
"The following is an example of how to implement a custom modular arm. For further instructions, read the detailed `Sensor` example above. Our custom Arm will be extremely simple. Please note that the minimum set of endpoints you need to implement for an arm are `GetKinematics`, `GetJointPositions`, and `MoveToJointPositions`.\n",
572572
"\n",
573-
"This arm example contains a minimal kinematics model. For a full model, take a look [here](https://github.com/viamrobotics/viam-python-sdk/blob/main/complex_module/src/arm/my_arm_kinematics.json).\n",
573+
"This arm example contains a minimal kinematics model. For a full model, take a look [here](https://github.com/viamrobotics/viam-python-sdk/blob/main/examples/complex_module/src/arm/my_arm_kinematics.json).\n",
574574
"\n",
575575
"Subclassing the `Arm` component and implementing the required functions:\n",
576576
"```python\n",
@@ -908,7 +908,7 @@
908908
"source": [
909909
"You can view more component implementations in the [examples](https://github.com/viamrobotics/python-sdk/blob/main/examples/server/v1/components.py).\n",
910910
"\n",
911-
"This arm example contains a minimal kinematics model. For a full model, take a look [here](https://github.com/viamrobotics/viam-python-sdk/blob/main/complex_module/src/arm/my_arm_kinematics.json)."
911+
"This arm example contains a minimal kinematics model. For a full model, take a look [here](https://github.com/viamrobotics/viam-python-sdk/blob/main/examples/complex_module/src/arm/my_arm_kinematics.json)."
912912
]
913913
},
914914
{

examples/complex_module/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The `run.sh` script is the entrypoint for this module. To connect this module wi
3838

3939
Once the module has been added to your robot, add a `Gizmo` component that uses the `MyGizmo` model. See the [documentation](https://docs.viam.com/extend/modular-resources/configure/) for more details. You can also add an `Arm` component that uses the `MyArm` model and a `Summation` service that uses the `MySum` model in a similar manner.
4040

41-
Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#models).
41+
Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/registry/create/#name-your-new-resource-model).
4242

4343
An example configuration for an Arm component, a Gizmo component, and a Summation service could look like this:
4444

examples/simple_module/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The `run.sh` script is the entrypoint for this module. To connect this module wi
2828

2929
Once the module has been added to your robot, add a new component that uses the `MySensor` model. See the [documentation](https://docs.viam.com/program/extend/modular-resources/#configure-a-component-instance-for-a-modular-resource) for more details.
3030

31-
Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#models).
31+
Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/registry/create/#name-your-new-resource-model).
3232

3333
An example configuration for a Sensor component could look like this:
3434
```json

src/viam/app/data_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ async def binary_data_capture_upload(
10181018
or .png extension will be saved to the images tab.
10191019
method_parameters (Optional[Mapping[str, Any]]): Optional dictionary of method parameters. No longer in active use.
10201020
tags (Optional[List[str]]): Optional list of tags to allow for tag-based data filtering when retrieving data.
1021-
data_request_times (Optional[Tuple[datetime.datetime, datetime.datetime]]): Optional tuple containing `datetime`s objects
1021+
data_request_times (Optional[Tuple[datetime.datetime, datetime.datetime]]): Optional tuple containing datetime objects
10221022
denoting the times this data was requested[0] by the robot and received[1] from the appropriate sensor.
10231023
10241024
Raises:
@@ -1184,7 +1184,7 @@ async def streaming_data_capture_upload(
11841184
component_name (Optional[str]): Optional name of the component associated with the file.
11851185
method_name (Optional[str]): Optional name of the method associated with the file.
11861186
method_parameters (Optional[str]): Optional dictionary of the method parameters. No longer in active use.
1187-
data_request_times (Optional[Tuple[datetime.datetime, datetime.datetime]]): Optional tuple containing `datetime`s objects
1187+
data_request_times (Optional[Tuple[datetime.datetime, datetime.datetime]]): Optional tuple containing datetime objects
11881188
denoting the times this data was requested[0] by the robot and received[1] from the appropriate sensor.
11891189
tags (Optional[List[str]]): Optional list of tags to allow for tag-based filtering when retrieving data.
11901190

src/viam/resource/easy_resource.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ class EasyResource:
3232
3333
Basic usage:
3434
35-
class MyModel(Sensor, EasyResource):
36-
MODEL = "my-org:sensor:my-sensor"
35+
::
3736
38-
async def get_readings(self, **kwargs):
39-
return {"ok": True}
37+
class MyModel(Sensor, EasyResource):
38+
MODEL = "my-org:sensor:my-sensor"
39+
40+
async def get_readings(self, **kwargs):
41+
return {"ok": True}
4042
4143
See examples/easy_resource/main.py for extended usage.
4244
"""

0 commit comments

Comments
 (0)