Skip to content

Docs improvements #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 13, 2025
Merged

Docs improvements #95

merged 6 commits into from
Mar 13, 2025

Conversation

rwb27
Copy link
Collaborator

@rwb27 rwb27 commented Mar 5, 2025

This PR addresses some of the issues in #94 by updating the quick-start page, and adding a unit test for the example code there. It doesn't test installation of the package from pypi, but does test that the example code runs.

I have also updated the page on dependencies, and added a unit test for the example code there.

The need for a server means example code is often not entirely straightforward to test - for the quickstart example, I use a subprocess, and monitor its output to check a FastAPI server starts. This is not particularly quick or elegant, but it seems fairly robust. The test for the dependency example uses a TestClient, which is an efficient mechanism provided by FastAPI to allow the server to be used without actually serving over the network. It's much faster, but results in some boilerplate code that's best not included in the examples viewable in the docs. This suggests that it might be quite hard to get something like doctest to work nicely.

I think properly testing the quickstart example would be really useful - but might require a bit of a rethink of the CI pipelines to work nicely.

@rwb27 rwb27 force-pushed the docs_improvements branch 2 times, most recently from 8228b9a to 4b3a8fd Compare March 6, 2025 00:23
Copy link

barecheck bot commented Mar 6, 2025

Barecheck - Code coverage report

Total: 81.6%

Your code coverage diff: 0.05% ▴

✅ All code changes are covered

rwb27 added 4 commits March 7, 2025 23:34
The quickstart page was badly out of date. I've updated it to reflect
changes in the package, and in how the labthings server is started.
This checks that the server code in the quickstart page
actually runs. It tests for successful server start-up,
using the same code as test_server_cli.py.

This does not verify that the HTTP server actually works -
but it should catch obvious errors in the example.
I've also added a test for the example in here.
@rwb27 rwb27 force-pushed the docs_improvements branch from 4b3a8fd to dd6e92c Compare March 7, 2025 23:34
This is not yet run in CI, but should check the example.
@rwb27 rwb27 force-pushed the docs_improvements branch from 2510577 to 963cd23 Compare March 13, 2025 00:08
I fixed a few path gotchas and added the test so it runs with unpinned dependencies.
@rwb27 rwb27 force-pushed the docs_improvements branch from 963cd23 to eba356c Compare March 13, 2025 00:12
@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 13, 2025

I've only added the installation script test to the unpinned dependency test job. This is because the example script doesn't pin dependencies either - so it's vulnerable to things changing. As with the unpinned test job, I think it's best to allow merging PRs where it fails because of changes to dependencies, but to ensure it's passing before releases.

@rwb27 rwb27 merged commit 721b352 into main Mar 13, 2025
13 checks passed
@rwb27 rwb27 deleted the docs_improvements branch March 13, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant