From 47eb32b113b843b43ca77b17ebce3d1c02c6dd89 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Sat, 28 Jun 2025 11:26:42 +0100 Subject: [PATCH 1/3] Make server dependencies non-optional This will fix some confusion, and stop client-only installs from being broken now that `Thing` can be imported at top level. Closes #120 --- pyproject.toml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 97e23577..0505259c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,8 @@ dependencies = [ "typing_extensions", "anyio ~=4.0", "httpx", + "fastapi[all]>=0.115.0", + "zeroconf >=0.28.0", ] [project.optional-dependencies] @@ -29,10 +31,6 @@ dev = [ "ruff>=0.1.3", "types-jsonschema", ] -server = [ - "fastapi[all]>=0.115.0", - "zeroconf >=0.28.0", -] [project.urls] "Homepage" = "https://github.com/rwb27/labthings-fastapi" From 162d6c9ec9de01c03affbfa02906f81c7bdc15d9 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Sat, 28 Jun 2025 15:35:24 +0100 Subject: [PATCH 2/3] Update documentation --- docs/source/index.rst | 2 +- docs/source/quickstart/quickstart_example.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 35c3d4c9..65daae39 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -44,7 +44,7 @@ Compared to `python-labthings`_, this framework updates dependencies, shrinks th Installation ------------ -``pip install labthings-fastapi[server]`` +``pip install labthings-fastapi`` Indices and tables ================== diff --git a/docs/source/quickstart/quickstart_example.sh b/docs/source/quickstart/quickstart_example.sh index 10abe7a4..53b84cc9 100644 --- a/docs/source/quickstart/quickstart_example.sh +++ b/docs/source/quickstart/quickstart_example.sh @@ -5,7 +5,7 @@ source .venv/bin/activate # or .venv/Scripts/activate on Windows # END venv echo "Installing labthings-fastapi" # BEGIN install -pip install labthings-fastapi[server] +pip install labthings-fastapi # END install echo "running example" # BEGIN serve From 7298f52b55226cee72ad41360c3bca99c098934e Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Tue, 1 Jul 2025 09:15:58 +0100 Subject: [PATCH 3/3] Eliminate last few mentions of `[server]` extra dependencies --- .github/workflows/test.yml | 2 +- README.md | 9 +++++---- dev-requirements.txt | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00f96e92..a7da552b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -81,7 +81,7 @@ jobs: python-version: ${{ matrix.python }} - name: Install Dependencies - run: pip install -e .[dev,server] + run: pip install -e .[dev] - name: Lint with Ruff run: ruff check . diff --git a/README.md b/README.md index d4f5e241..58b56399 100644 --- a/README.md +++ b/README.md @@ -28,17 +28,17 @@ Features include: ## Installation -You can install this repository with `pip`, either clone it and run `pip install -e .[dev]` to work on it, or just `pip install https://gitlab.com/rwb27/labthings-fastapi.git`. It will be published on PyPI in the near future, initially as `labthings-fastapi`. It may at some point be renamed to `labthings` v2. +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`. ## Developer notes -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. +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. Dependencies are defined in `pyproject.toml` and can be compiled to `dev-requirements.txt` with: ``` -uv pip compile --extra dev --extra server pyproject.toml --output-file dev-requirements.txt +uv pip compile --extra dev pyproject.toml --output-file dev-requirements.txt ``` -If you're not using `uv`, just regular `pip-compile` from `pip-tools` will do the same thing. +If you're not using `uv`, just regular `pip-compile` from `pip-tools` should do the same thing. All changes to the codebase should go via pull requests, and should only be merged once all the checks in the `test` job are passing. It is preferable to merge code where the `test-with-unpinned-dependencies` job fails, and deal with the dependency issues in another PR, particularly where the required changes are distinct from the code in the PR. @@ -49,3 +49,4 @@ See the [examples folder](./examples/) for a runnable demo. [Web of Things]: https://www.w3.org/WoT/ [python-labthings]: https://github.com/labthings/python-labthings/ [OpenFlexure Microscope software]: https://gitlab.com/openflexure/openflexure-microscope-server/ +[pre-commit hook]: https://openflexure.org/contribute#use-git-hooks-for-ci-checks diff --git a/dev-requirements.txt b/dev-requirements.txt index 10fd407a..efc24f80 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --extra dev --extra server pyproject.toml --output-file dev-requirements.txt +# uv pip compile --extra dev pyproject.toml --output-file dev-requirements.txt annotated-types==0.7.0 # via pydantic anyio==4.8.0