Skip to content

feat: package langflow service implementations#14021

Draft
HzaRashid wants to merge 4 commits into
refactor/orm-models-to-lfxfrom
service-pkg
Draft

feat: package langflow service implementations#14021
HzaRashid wants to merge 4 commits into
refactor/orm-models-to-lfxfrom
service-pkg

Conversation

@HzaRashid

@HzaRashid HzaRashid commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Extracts Langflow's service implementations into a standalone langflow-services distribution using the langflow_services.* namespace.

langflow-base will now depend on langflow-services which depends on lfx.

This PR is stacked on #14001, which moves canonical ORM models into LFX.

Changes

  • Added the langflow-services workspace package and packaging metadata.
  • Moved concrete service implementations, factories, provider backends, and deployment adapters into langflow_services.*.
  • Kept service contracts, ServiceType, ServiceManager, registries, and canonical ORM models in LFX.
  • Converted existing langflow.services.* modules into one-way compatibility shims so public imports and monkeypatch targets retain object identity.
  • Added explicit host-injected hooks for CRUD, Alembic paths, auth defaults, audit cleanup, and knowledge-base helpers.
  • Registered concrete factories through the lfx.service-packages entry point while preserving lazy initialization for jobs, flow events, and MemoryBase.
  • Split optional dependencies into service and backend extras, including PostgreSQL, Redis, S3, Celery, Kubernetes, tracing providers, and Watsonx Orchestrate.
  • Updated workspace, Docker, CI, nightly, release, and versioning workflows to build and publish the new package.

Package boundaries

  • lfx: service contracts, lifecycle, registries, settings, and ORM models.
  • langflow-services: concrete implementations and implementation-owned helpers.
  • langflow-base: FastAPI host lifecycle, CRUD, Alembic, API helpers, and compatibility shims.

The standalone package is prohibited from statically or dynamically importing langflow.*.

Compatibility

Existing langflow.services.* imports remain supported through thin re-export modules. Leaf shims alias the implementation modules directly, preserving class identity and existing monkeypatch paths.

Database CRUD, model shims, migrations, and application startup remain in langflow-base.

Validation

Added coverage for:

  • standalone package boundaries and namespace layout
  • LFX contract conformance
  • compatibility-shim identity
  • factory registration and host hooks
  • eager and lazy service initialization
  • service extraction parity
  • optional dependency and extras coverage
  • isolated wheel installation without langflow-base
  • recursive langflow_services.* imports with no langflow leakage

The isolated-wheel CI gate builds langflow-sdk, lfx, and langflow-services, installs them into a clean environment, and recursively imports the standalone package.

Reviewer notes

Most of the diff is the mechanical relocation of implementations and replacement of the original modules with compatibility shims. The primary review areas are package ownership, dependency direction, host-injected seams, optional dependency mapping, and release wiring.

Introduce a standalone `langflow-services` distribution (`services` import
path) so concrete backends sit between `langflow-base` and `lfx`:
- Dependency direction: langflow-base → langflow-services → lfx
- One subpackage per Langflow-owned ServiceType under services/<name>/
- Host CRUD/Alembic/lifecycle stays in langflow-base; LFX keeps contracts
- Public langflow.services.* preserved via one-way shim re-exports
- Discover factories via lfx.service-packages entry point after host hooks
Packaging follows the lfx-bundles pattern (one wheel + optional extras):
- Service-shell extras mark ownership; empty when defaults need no extra deps
- Backend extras only where selectable: database-sqlite/postgresql,
  cache-redis, job-queue-redis, storage-s3, task-celery, variable-kubernetes,
  tracing-*, deployment-watsonx-orchestrate
- [production] prefers prod backends (Postgres/Redis/S3/Celery) and otherwise
  the default impl (including DB-backed variable; K8s stays opt-in)
- [all] aggregates shells + backends; does not nest [production]
- langflow-base re-exports compatibility aliases and depends on
  langflow-services[database-sqlite,memory-base] by default
CI / release / docs:
- Isolated-wheel gate (make check_services_isolated_wheel)
- Boundary tests for layout, extras, and no static langflow imports
- Nightly/release/Docker/Makefile wiring for the new workspace package
- OWNERSHIP.md documents package invariants and backend naming
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cafed37b-718d-4624-ad4b-d17706a120f8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch service-pkg

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the enhancement New feature or request label Jul 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Migration Validation Passed

All migrations follow the Expand-Contract pattern correctly.

Align langflow-services with the bundle/stepflow naming convention:
distribution stays langflow-services, implementation imports use
langflow_services.*, and langflow.services.* remains the public shim.
Also drop runtime langflow discovery fallbacks from the standalone
package and tighten boundary tests to cover dynamic imports.
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 13, 2026
Move langflow-services onto the public 1.x axis (with langflow/lfx) while
keeping langflow-base on 0.x, and replace OWNERSHIP.md with a package README.
- Set langflow-services to 1.11.0; pin langflow-base → langflow-services~=1.11.0
- Update make patch so services version/pin track LANGFLOW_VERSION (not base)
- Decouple nightly/release scripts: services sourced from root/main tag
- Add determine-services-version; rebuild services for base even if already on PyPI
- Skip publish-services when already_published; preserve extras in pre-release pins
- Point Docker/pyproject/sdist at README.md; document stable vs nightly axes
- Extend patch-regex, dependency-pin, and nightly-tag regression tests
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 13, 2026
Drop unused core deps from langflow-services, move email-validator under
the telemetry extra, and make langflow-base depend on langflow-services[all]
by default so [complete] only adds host-owned extras.
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant