[PR #2642] [MERGED] chore(ml): updated dockerfile, added typing, packaging #9648

Closed
opened 2026-02-05 14:08:25 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/2642
Author: @mertalev
Created: 6/2/2023
Status: Merged
Merged: 6/5/2023
Merged by: @alextran1502

Base: mainHead: chore/ml-packaging


📝 Commits (7)

  • 6f484f9 updated dockerfile, added typing, packaging
  • f98bd2b added arm64 support
  • fcc49d8 added ml version pump, second try for arm64
  • 0c89377 added linting config to pyproject.toml
  • 0a0c592 renamed ml input field
  • 5c8317a fixed linter config
  • 8d6ee94 fixed dev docker compose

📊 Changes

13 files changed (+2647 additions, -67 deletions)

View changed files

📝 docker/docker-compose.dev.yml (+1 -1)
📝 machine-learning/Dockerfile (+16 -19)
📝 machine-learning/README.md (+11 -3)
📝 machine-learning/app/main.py (+47 -37)
machine-learning/app/schemas.py (+64 -0)
machine-learning/poetry.lock (+2444 -0)
machine-learning/pyproject.toml (+56 -0)
📝 misc/release/pump-version.sh (+1 -0)
📝 server/libs/domain/src/facial-recognition/facial-recognition.service.spec.ts (+1 -1)
📝 server/libs/domain/src/facial-recognition/facial-recognition.services.ts (+1 -1)
📝 server/libs/domain/src/smart-info/machine-learning.interface.ts (+1 -1)
📝 server/libs/domain/src/smart-info/smart-info.service.spec.ts (+2 -2)
📝 server/libs/domain/src/smart-info/smart-info.service.ts (+2 -2)

📄 Description

This PR does several things:

  • Added packaging using Poetry. This codifies the current ML dependencies with pyproject.toml and poetry.lock for reproducible and faster builds.
  • Added typing for FastAPI endpoints. This allows for runtime validation of requests and responses and codifies the ML server's API.
    • I actually wrote an OpenAPI spec for this and used it to partially generate the schemas.py file with datamodel-code-generator. However, I didn't include it since I'm unsure if it's a useful addition at the moment without deeper integration. On the one hand, Pydantic data models are already a pythonic approach to API modeling without the need for an explicit spec. On the other hand, this could be used to integrate the ML server's API with remote $ref's in the future.
  • Updated the Dockerfile to benefit from the poetry.lock file.
  • Updated the README to reflect the addition of Poetry.

The actual behavior of the server once launched should be unchanged.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/2642 **Author:** [@mertalev](https://github.com/mertalev) **Created:** 6/2/2023 **Status:** ✅ Merged **Merged:** 6/5/2023 **Merged by:** [@alextran1502](https://github.com/alextran1502) **Base:** `main` ← **Head:** `chore/ml-packaging` --- ### 📝 Commits (7) - [`6f484f9`](https://github.com/immich-app/immich/commit/6f484f97cdbb1307ce9967e857a3c67e515f24e3) updated dockerfile, added typing, packaging - [`f98bd2b`](https://github.com/immich-app/immich/commit/f98bd2b4521dd84642048ec13ee12c1d331afde5) added arm64 support - [`fcc49d8`](https://github.com/immich-app/immich/commit/fcc49d86b9c668b198832f8460cddb071a11b660) added ml version pump, second try for arm64 - [`0c89377`](https://github.com/immich-app/immich/commit/0c89377e0a7437502df2aa7e80128b386707d6cd) added linting config to pyproject.toml - [`0a0c592`](https://github.com/immich-app/immich/commit/0a0c59273080681b6b76b4677aa162da6d58d0d6) renamed ml input field - [`5c8317a`](https://github.com/immich-app/immich/commit/5c8317a37e9c4f39abf1388ccadac57cb27ac97c) fixed linter config - [`8d6ee94`](https://github.com/immich-app/immich/commit/8d6ee94afe2df6accfc6d65fdb7aa29ed27898e9) fixed dev docker compose ### 📊 Changes **13 files changed** (+2647 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `docker/docker-compose.dev.yml` (+1 -1) 📝 `machine-learning/Dockerfile` (+16 -19) 📝 `machine-learning/README.md` (+11 -3) 📝 `machine-learning/app/main.py` (+47 -37) ➕ `machine-learning/app/schemas.py` (+64 -0) ➕ `machine-learning/poetry.lock` (+2444 -0) ➕ `machine-learning/pyproject.toml` (+56 -0) 📝 `misc/release/pump-version.sh` (+1 -0) 📝 `server/libs/domain/src/facial-recognition/facial-recognition.service.spec.ts` (+1 -1) 📝 `server/libs/domain/src/facial-recognition/facial-recognition.services.ts` (+1 -1) 📝 `server/libs/domain/src/smart-info/machine-learning.interface.ts` (+1 -1) 📝 `server/libs/domain/src/smart-info/smart-info.service.spec.ts` (+2 -2) 📝 `server/libs/domain/src/smart-info/smart-info.service.ts` (+2 -2) </details> ### 📄 Description This PR does several things: - Added packaging using Poetry. This codifies the current ML dependencies with `pyproject.toml` and `poetry.lock` for reproducible and faster builds. - Added typing for FastAPI endpoints. This allows for runtime validation of requests and responses and codifies the ML server's API. - I actually wrote an OpenAPI spec for this and used it to partially generate the `schemas.py` file with [datamodel-code-generator](https://pypi.org/project/datamodel-code-generator/). However, I didn't include it since I'm unsure if it's a useful addition at the moment without deeper integration. On the one hand, Pydantic data models are already a pythonic approach to API modeling without the need for an explicit spec. On the other hand, this could be used to integrate the ML server's API with remote `$ref`'s in the future. - Updated the Dockerfile to benefit from the `poetry.lock` file. - Updated the README to reflect the addition of Poetry. The actual behavior of the server once launched should be unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 14:08:25 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#9648