Skip to content

Commit d2d5fe6

Browse files
authored
Merge pull request #138 from labthings/docstring-review
Docstring review
2 parents 034ea9a + 0f47e7f commit d2d5fe6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3713
-1152
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ jobs:
5454
- name: Format with Ruff
5555
run: ruff format --check .
5656

57+
- name: Lint with Flake8 (for docstrings)
58+
if: ${{ contains('3.12,3.13', matrix.python) }}
59+
# Flake8 crashes on Python < 3.12, so we exclude those versions.
60+
# Flake8 is primarily here to lint the docstrings, which
61+
# does not need to happen under multiple versions.
62+
run: flake8 src
63+
5764
- name: Test with pytest
5865
run: pytest --cov=src --cov-report=lcov
5966

.readthedocs.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 2
88
build:
99
os: ubuntu-22.04
1010
tools:
11-
python: "3.11"
11+
python: "3.12"
1212

1313
# Build documentation in the "docs/" directory with Sphinx
1414
sphinx:
@@ -24,4 +24,5 @@ sphinx:
2424
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
2525
python:
2626
install:
27-
- requirements: docs/requirements.txt
27+
- requirements: dev-requirements.txt
28+
- path: .

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
# labthings-fastapi
55

6-
A FastAPI based library to implement a [Web of Things] interface for laboratory hardware using Python. This is a ground-up rewrite of [python-labthings], replacing Flask 1 and Marshmallow with FastAPI and Pydantic. It is the underlying framework for v3 of the [OpenFlexure Microscope software].
6+
A FastAPI based library to implement a [Web of Things] interface for laboratory hardware using Python. This is a ground-up rewrite of [python-labthings], based on FastAPI and Pydantic. It is the underlying framework for v3 of the [OpenFlexure Microscope software].
7+
8+
Documentation, including install instructions, is available on [readthedocs].
79

810
Features include:
911

@@ -18,7 +20,7 @@ Features include:
1820
- Dependency injection is used to manage relationships between Things and dependency on the server
1921
* Async HTTP handling
2022
- Starlette (used by FastAPI) can handle requests asynchronously - potential for websockets/events (not used much yet)
21-
- `Thing` code is still, for now, threaded. I intend to make it possible to write async things in the future, but don't intend it to become mandatory
23+
- `Thing` code is still, for now, threaded. It may become possible to write async things in the future, but won't become mandatory
2224
* Smaller codebase
2325
- FastAPI more or less completely eliminates OpenAPI generation code from our codebase
2426
- Thing Description generation is very much simplified by the new structure (multiple Things instead of one massive Thing with many extensions)
@@ -28,11 +30,11 @@ Features include:
2830

2931
## Installation
3032

31-
You can install this repository with `pip install labthings-fastapi`. It may at some point be renamed to `labthings` v2. For the latest development version, either clone it and run `pip install -e .[dev]` to work on it, or just `pip install https://gitlab.com/rwb27/labthings-fastapi.git`.
33+
See [readthedocs] for installation instructions that are automatically tested. You can install this package with `pip install labthings-fastapi`. It may at some point be renamed to `labthings` v2. For the latest development version, either clone it and run `pip install -e .[dev]` to work on it, or just `pip install https://gitlab.com/rwb27/labthings-fastapi.git`.
3234

3335
## Developer notes
3436

35-
The code is linted with `ruff .`, type checked with `mypy src`, and tested with `pytest`. These all run in CI with GitHub Actions. The codebase is not even `v0.1` yet so it's still subject to summary rearrangement. We recommend a [pre-commit hook] to ensure `ruff` passes on every commit.
37+
The code is linted with `ruff .`, type checked with `mypy src`, and tested with `pytest`. These all run in CI with GitHub Actions. The codebase is not even `v0.1` yet so it's still subject to summary rearrangement. We recommend a [pre-commit hook] to ensure `ruff` passes on every commit. `flake8` is also run in CI, primarily to enable stricter checks on docstrings. It is run as `flake8 src`. `ruff` and `flake8` are both configured from `pyproject.toml`.
3638

3739
Dependencies are defined in `pyproject.toml` and can be compiled to `dev-requirements.txt` with:
3840
```
@@ -44,9 +46,10 @@ All changes to the codebase should go via pull requests, and should only be merg
4446

4547
## Demo
4648

47-
See the [examples folder](./examples/) for a runnable demo.
49+
See [readthedocs] for a runnable demo.
4850

4951
[Web of Things]: https://www.w3.org/WoT/
5052
[python-labthings]: https://github.com/labthings/python-labthings/
5153
[OpenFlexure Microscope software]: https://gitlab.com/openflexure/openflexure-microscope-server/
5254
[pre-commit hook]: https://openflexure.org/contribute#use-git-hooks-for-ci-checks
55+
[readthedocs]: https://labthings-fastapi.readthedocs.io/

0 commit comments

Comments
 (0)