-
Notifications
You must be signed in to change notification settings - Fork 4
Installation instructions and contributing docs #367
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
bprobert97
merged 20 commits into
main
from
installation-instructions-and-contributing-docs
Jun 29, 2026
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ab85b42
Add Windows installation notes and information about Python versions …
bprobert97 1ef0e57
Add a contributing.md file
bprobert97 6e7179e
Enable sphinx to parse markdown files
bprobert97 b0d05a4
Add myst-parser to pyproject.toml
bprobert97 9e770b0
Update dev-requirements
bprobert97 657f42d
Cap myst-parser version
bprobert97 d835ef5
Fix pip audit issues
bprobert97 cce1d79
Create stub file
bprobert97 c24ae41
Fix file location
bprobert97 06eece7
Update contributing.md to tell users they need to fork the repo
bprobert97 95de937
Update Windows notes to be Windows with ARM specific
bprobert97 2dac89b
Update CONTRIBUTING.md
bprobert97 485e4d7
Make windows note a single source doc
bprobert97 2c60f98
Merge branch 'main' into installation-instructions-and-contributing-docs
bprobert97 a83ec60
Update CONTRIBUTING.md
bprobert97 2d7a21b
Add --cov=src to pyproject.toml
bprobert97 95a1a88
Merge branch 'installation-instructions-and-contributing-docs' of htt…
bprobert97 3a63ede
Update CONTRIBUTING.md
bprobert97 392d1de
Fix pip install command
bprobert97 8956110
Regenerate `dev-requirements.txt` so it matches `main`
rwb27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # Contributing to labthings-fastapi | ||
|
|
||
| First off, thank you for considering contributing to `labthings-fastapi`! We welcome contributions from everyone, whether it's reporting a bug, suggesting a feature, improving documentation, or writing code. | ||
|
|
||
| This document outlines the processes for getting help, reporting issues, and contributing to the codebase. | ||
|
|
||
| ## Seeking Support | ||
|
|
||
| If you have a question about how to use `labthings-fastapi`, or if you are running into trouble: | ||
|
|
||
| * **Check the Documentation:** Please review the official documentation on [readthedocs]. | ||
| * **GitHub Discussions / Issues:** If you cannot find the answer, feel free to open an issue on our [GitHub Issues page]. | ||
| * **OpenFlexure Community:** Because `labthings-fastapi` is the underlying framework for v3 of the [OpenFlexure Microscope software], you may also find support by engaging with the broader [OpenFlexure Forum]. | ||
|
|
||
| ## Reporting Issues or Bugs | ||
|
|
||
| If you find a bug or have a feature request, please report it by opening an issue on our [GitHub Issues page]. | ||
|
|
||
| When reporting an issue, please include as much detail as possible: | ||
|
|
||
| * **Description:** A clear and concise description of what the bug is. | ||
| * **Reproduction steps:** How can we reproduce the problem? (A minimal reproducible example is highly appreciated). | ||
| * **Expected behaviour:** What did you expect to happen? | ||
| * **Environment:** Include your OS, Python version, and `labthings-fastapi` version. Include full error tracebacks if applicable. | ||
|
|
||
| ## Contributing Code or Documentation | ||
|
|
||
| We welcome pull requests for bug fixes, new features, and documentation improvements. | ||
|
|
||
| ### 1. Local Development Setup | ||
|
|
||
| To work on the code, you will need to clone the repository and install the development dependencies. | ||
| Please see the [installation notes](./README.md#installation-notes) for more detail about compatible Python versions and Windows installation. | ||
|
|
||
| ```bash | ||
| # Clone the repository | ||
| git clone https://github.com/labthings/labthings-fastapi.git | ||
| cd labthings-fastapi | ||
|
|
||
| # Install the package in editable mode with development dependencies | ||
| pip install -r dev-requirements.txt | ||
| ``` | ||
|
|
||
| ### 2. Linting and Testing | ||
|
|
||
| We use several tools to maintain code quality. All of these run in CI with [GitHub Actions], but you should run them locally before submitting a Pull Request. Both `ruff` and `flake8` are configured from [`pyproject.toml`]. | ||
|
|
||
| * **Linting:** We use [`ruff`] for fast linting and formatting. We highly recommend setting up a pre-commit hook to ensure [`ruff`] passes on every commit. | ||
| ```bash | ||
| ruff format --check | ||
| ruff check . | ||
|
bprobert97 marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| * **Docstrings:** [`flake8`] is primarily used to enable stricter checks on docstrings. | ||
| ```bash | ||
| flake8 src | ||
| ``` | ||
|
|
||
| * **Spelling:** We use [`codespell`] to prevent common spelling mistakes in code and documentation. | ||
| ```bash | ||
| codespell . | ||
| ``` | ||
|
|
||
| * **Type Checking:** We use [`mypy`] for static type checking. It is configured in `pyproject.toml`. | ||
| ```bash | ||
| mypy | ||
| ``` | ||
|
|
||
| * **Testing:** We use [`pytest`] for our test suite and test coverage. Ensure all tests pass locally. | ||
| ```bash | ||
| pytest --cov=src | ||
| ``` | ||
|
bprobert97 marked this conversation as resolved.
|
||
|
|
||
| ### 3. Managing Dependencies | ||
|
|
||
| Dependencies are defined in [`pyproject.toml`]. If you need to compile a `dev-requirements.txt` file (e.g., for reproducible CI/CD or local isolated environments), you can do so using [`uv`]: | ||
|
|
||
| ```bash | ||
| uv pip compile --extra dev pyproject.toml --output-file dev-requirements.txt | ||
| ``` | ||
|
|
||
| *(If you're not using `uv`, regular `pip-compile` from `pip-tools` will achieve the same thing).* | ||
|
|
||
| ### 4. Submitting a Pull Request (PR) | ||
|
|
||
| All changes to the codebase must go via pull requests. Unless you are a core maintainer with write access, please use the standard fork-and-branch workflow: | ||
|
|
||
| 1. **Fork the repository** to your own GitHub account using the "Fork" button at the top of the repository page. | ||
| 2. **Clone your fork** locally and set up the upstream remote: | ||
| ```bash | ||
| git clone https://github.com/YOUR-USERNAME/labthings-fastapi.git | ||
| cd labthings-fastapi | ||
| git remote add upstream https://github.com/labthings/labthings-fastapi.git | ||
| ``` | ||
| 3. **Create a new branch** for your feature or bugfix: | ||
| ```bash | ||
| git checkout -b feature-name | ||
| ``` | ||
| 4. **Commit your changes** with clear, descriptive commit messages. | ||
| 5. **Push your branch** up to your fork: | ||
| ```bash | ||
| git push origin feature-name | ||
| ``` | ||
| 6. **Open a Pull Request** against the `main` branch of the `labthings/labthings-fastapi` repository. | ||
|
|
||
| **Pull Request Guidelines:** | ||
|
|
||
| * Code should only be merged once all the checks in the CI test job are passing. | ||
| * **Unpinned Dependencies:** Note that we have a specific CI job called `test-with-unpinned-dependencies`. It is acceptable to merge code if only this specific job fails, provided the failure is due to upstream dependency issues. We prefer to deal with upstream dependency issues in a separate PR, particularly when the required fixes are distinct from the code in your current PR. The same applies to the `pip-audit` job. | ||
| * Update documentation (`docs/` or docstrings) if your changes modify existing behavior or add new features. | ||
|
|
||
| [readthedocs]: https://labthings-fastapi.readthedocs.io/ | ||
| [GitHub Issues page]: https://github.com/labthings/labthings-fastapi/issues | ||
| [OpenFlexure Forum]: https://openflexure.discourse.group/ | ||
| [OpenFlexure Microscope software]: https://gitlab.com/openflexure/openflexure-microscope-server/ | ||
| [GitHub Actions]: https://github.com/labthings/labthings-fastapi/actions | ||
| [`ruff`]: https://docs.astral.sh/ruff/ | ||
| [`pyproject.toml`]: ./pyproject.toml | ||
| [`flake8`]: https://flake8.pycqa.org/en/latest/ | ||
| [`mypy`]: https://mypy-lang.org/ | ||
| [`pytest`]: https://docs.pytest.org/en/stable/ | ||
| [`uv`]: https://docs.astral.sh/uv/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
bprobert97 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
bprobert97 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .. note:: | ||
| **Windows Installations on devices with ARM Processors** | ||
|
|
||
| Installing on Windows devices with ARM processors requires `Visual Studio`_ with the **"Desktop development with C++"** workload enabled. This is necessary because ``pydantic`` relies on Rust_, which in turn requires C++ build tools to compile. | ||
|
|
||
| *If you are using a centrally managed machine, you will need administrator privileges to install these system-level dependencies.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
bprobert97 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ```{include} ../../CONTRIBUTING.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.