chore: uv to replace poetry (#3900)
* uv sync works * fist stab at Makefile * uv treatment for langflow-base * sqlmodel to 0.0.18 * add reinstall_backend to Makefile * makefile - reinstall_backend fix and unit_test dependency * fix dev dependencies * fix dev dependencies * fix dev dependencies * lock * Makefile * [autofix.ci] apply automated fixes * Update Makefile Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> * delete update_dependencies * fix lint * Remove Poetry lock check from GitHub Actions workflow * Switch to 'uv' for dependency management and caching in style-check workflow * Update style-check workflow to use '--only-dev' flag for Ruff check * Integrate 'uv' package setup and caching in GitHub Actions workflows * Update version check in GitHub Actions to use 'uv tree' for langflow-base * Remove redundant poetry environment setup in GitHub Actions workflow * Add step to minimize uv cache in GitHub Actions workflow * Update GitHub Actions workflow to use 'uv' for dependency management and caching * Remove redundant script execution from build_langflow target in Makefile * [autofix.ci] apply automated fixes * Switch build system from Poetry to Hatchling and update dependencies - Replace `poetry-core` with `hatchling` in build-system requirements - Update `langflow-base` dependency to version `0.0.96` - Add `tool.hatch.build.targets.wheel` configuration - Adjust `tool.uv.sources` paths for `langflow-frontend` and `langflow-base` * update lock * Switch build system from Poetry to Hatchling in pyproject.toml * Add langchain-unstructured dependency to pyproject.toml --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
17fc2482a0
commit
fbb097dc4c
10 changed files with 14382 additions and 199 deletions
31
.github/workflows/lint-py.yml
vendored
31
.github/workflows/lint-py.yml
vendored
|
|
@ -26,18 +26,29 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.branch || github.ref }}
|
||||
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
|
||||
uses: "./.github/actions/poetry_caching"
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
poetry-version: ${{ env.POETRY_VERSION }}
|
||||
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
poetry env use ${{ matrix.python-version }}
|
||||
poetry install
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
- name: Restore uv cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.uv-cache
|
||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
restore-keys: |
|
||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
uv-${{ runner.os }}
|
||||
- name: Install the project
|
||||
run: uv sync --dev
|
||||
- name: Run Mypy
|
||||
run: |
|
||||
poetry run mypy --namespace-packages -p "langflow"
|
||||
uv run mypy --namespace-packages -p "langflow"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.github_token }}
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
|
|
|||
25
.github/workflows/py_autofix.yml
vendored
25
.github/workflows/py_autofix.yml
vendored
|
|
@ -18,28 +18,3 @@ jobs:
|
|||
- run: ruff check --fix-only .
|
||||
- run: ruff format .
|
||||
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
|
||||
lock:
|
||||
name: Check Poetry lock
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.12
|
||||
uses: "./.github/actions/poetry_caching"
|
||||
with:
|
||||
python-version: "3.12"
|
||||
poetry-version: ${{ env.POETRY_VERSION }}
|
||||
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
||||
- name: Check poetry.lock
|
||||
id: check
|
||||
run: |
|
||||
poetry check --lock
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run lock
|
||||
if : steps.check.outcome == 'failure'
|
||||
run: |
|
||||
make lock
|
||||
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
|
||||
- name: Diff poetry.lock
|
||||
uses: nborrmann/diff-poetry-lock@main
|
||||
continue-on-error: true
|
||||
|
|
|
|||
89
.github/workflows/python_test.yml
vendored
89
.github/workflows/python_test.yml
vendored
|
|
@ -46,23 +46,33 @@ jobs:
|
|||
id: setup-node
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
|
||||
uses: "./.github/actions/poetry_caching"
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
poetry-version: ${{ env.POETRY_VERSION }}
|
||||
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
poetry env use ${{ matrix.python-version }}
|
||||
poetry lock --no-update
|
||||
poetry install
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
- name: Restore uv cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.uv-cache
|
||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
restore-keys: |
|
||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
uv-${{ runner.os }}
|
||||
- name: Install the project
|
||||
run: uv sync --dev
|
||||
- name: Run unit tests
|
||||
uses: nick-fields/retry@v3
|
||||
with:
|
||||
timeout_minutes: 12
|
||||
max_attempts: 2
|
||||
command: make unit_tests async=false args="--splits ${{ matrix.splitCount }} --group ${{ matrix.group }}"
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
integration-tests:
|
||||
name: Integration Tests - Python ${{ matrix.python-version }}
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -73,20 +83,29 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref || github.ref }}
|
||||
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
|
||||
uses: "./.github/actions/poetry_caching"
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
poetry-version: ${{ env.POETRY_VERSION }}
|
||||
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
poetry env use ${{ matrix.python-version }}
|
||||
poetry lock --no-update
|
||||
poetry install
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
- name: Restore uv cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.uv-cache
|
||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
restore-keys: |
|
||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
uv-${{ runner.os }}
|
||||
- name: Install the project
|
||||
run: uv sync --dev
|
||||
- name: Run integration tests
|
||||
run: make integration_tests_no_api_keys
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
test-cli:
|
||||
name: Test CLI - Python ${{ matrix.python-version }}
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -98,16 +117,29 @@ jobs:
|
|||
with:
|
||||
ref: ${{ inputs.ref || github.ref }}
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
|
||||
uses: "./.github/actions/poetry_caching"
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
poetry-version: ${{ env.POETRY_VERSION }}
|
||||
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
- name: Restore uv cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.uv-cache
|
||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
restore-keys: |
|
||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
uv-${{ runner.os }}
|
||||
- name: Check Version
|
||||
id: check-version
|
||||
# We need to print $3 because langflow-base is a dependency of langflow
|
||||
# For langlow we'd use print $2
|
||||
run: |
|
||||
version=$(cd src/backend/base && poetry version --short)
|
||||
version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//')
|
||||
url="https://pypi.org/pypi/langflow-base/json"
|
||||
if [ ${{ inputs.nightly }} == true ]; then
|
||||
url="https://pypi.org/pypi/langflow-base-nightly/json"
|
||||
|
|
@ -125,7 +157,6 @@ jobs:
|
|||
- name: Build wheel
|
||||
if: steps.check-version.outputs.skipped == 'false'
|
||||
run: |
|
||||
poetry env use ${{ matrix.python-version }}
|
||||
make build main=true
|
||||
- name: Install wheel
|
||||
if: steps.check-version.outputs.skipped == 'false'
|
||||
|
|
@ -148,3 +179,5 @@ jobs:
|
|||
else
|
||||
echo "Server terminated successfully"
|
||||
fi
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
|
|
|||
32
.github/workflows/style-check-py.yml
vendored
32
.github/workflows/style-check-py.yml
vendored
|
|
@ -6,8 +6,7 @@ on:
|
|||
|
||||
|
||||
|
||||
env:
|
||||
POETRY_VERSION: "1.8.2"
|
||||
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
|
|
@ -19,17 +18,26 @@ jobs:
|
|||
- "3.12"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
|
||||
uses: "./.github/actions/poetry_caching"
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
poetry-version: ${{ env.POETRY_VERSION }}
|
||||
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
poetry env use ${{ matrix.python-version }}
|
||||
poetry install
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
- name: Restore uv cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.uv-cache
|
||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
restore-keys: |
|
||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
uv-${{ runner.os }}
|
||||
- name: Register problem matcher
|
||||
run: echo "::add-matcher::.github/workflows/matchers/ruff.json"
|
||||
- name: Run Ruff Check
|
||||
run: poetry run ruff check --output-format=github .
|
||||
run: uv run --only-dev ruff check --output-format=github .
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
|
|
|||
88
Makefile
88
Makefile
|
|
@ -36,6 +36,7 @@ patch: ## bump the version in langflow and langflow-base
|
|||
# check for required tools
|
||||
check_tools:
|
||||
@command -v poetry >/dev/null 2>&1 || { echo >&2 "$(RED)Poetry is not installed. Aborting.$(NC)"; exit 1; }
|
||||
@command -v uv >/dev/null 2>&1 || { echo >&2 "$(RED)uv is not installed. Aborting.$(NC)"; exit 1; }
|
||||
@command -v npm >/dev/null 2>&1 || { echo >&2 "$(RED)NPM is not installed. Aborting.$(NC)"; exit 1; }
|
||||
@command -v docker >/dev/null 2>&1 || { echo >&2 "$(RED)Docker is not installed. Aborting.$(NC)"; exit 1; }
|
||||
@command -v pipx >/dev/null 2>&1 || { echo >&2 "$(RED)pipx is not installed. Aborting.$(NC)"; exit 1; }
|
||||
|
|
@ -61,9 +62,15 @@ help: ## show this help message
|
|||
# INSTALL PROJECT
|
||||
######################
|
||||
|
||||
reinstall_backend: ## forces reinstall all dependencies (no caching)
|
||||
@echo 'Installing backend dependencies'
|
||||
#@poetry install > /dev/null 2>&1
|
||||
@cd src/backend/base && uv sync -n --reinstall && cd ../../../ && uv sync -n --reinstall > /dev/null 2>&1
|
||||
|
||||
install_backend: ## install the backend dependencies
|
||||
@echo 'Installing backend dependencies'
|
||||
@poetry install > /dev/null 2>&1
|
||||
#@poetry install > /dev/null 2>&1
|
||||
@cd src/backend/base && uv sync && cd ../../../ && uv sync > /dev/null 2>&1
|
||||
|
||||
install_frontend: ## install the frontend dependencies
|
||||
@echo 'Installing frontend dependencies'
|
||||
|
|
@ -104,21 +111,21 @@ clean_npm_cache:
|
|||
clean_all: clean_python_cache clean_npm_cache # clean all caches and temporary directories
|
||||
@echo "$(GREEN)All caches and temporary directories cleaned.$(NC)"
|
||||
|
||||
setup_poetry: ## install poetry using pipx
|
||||
pipx install poetry
|
||||
setup_uv: ## install poetry using pipx
|
||||
pipx install uv
|
||||
|
||||
add:
|
||||
@echo 'Adding dependencies'
|
||||
ifdef devel
|
||||
@cd src/backend/base && poetry add --group dev $(devel)
|
||||
@cd src/backend/base && uv add --group dev $(devel)
|
||||
endif
|
||||
|
||||
ifdef main
|
||||
@poetry add $(main)
|
||||
@uv add $(main)
|
||||
endif
|
||||
|
||||
ifdef base
|
||||
@cd src/backend/base && poetry add $(base)
|
||||
@cd src/backend/base && uv add $(base)
|
||||
endif
|
||||
|
||||
|
||||
|
|
@ -128,19 +135,22 @@ endif
|
|||
######################
|
||||
|
||||
coverage: ## run the tests and generate a coverage report
|
||||
@poetry run coverage run
|
||||
@poetry run coverage erase
|
||||
@uv run coverage run
|
||||
@uv run coverage erase
|
||||
#@poetry run coverage run
|
||||
#@poetry run coverage erase
|
||||
|
||||
unit_tests: ## run unit tests
|
||||
cd src/backend/base && uv sync --extra dev && cd ../../../ && uv sync --extra dev > /dev/null 2>&1
|
||||
ifeq ($(async), true)
|
||||
poetry run pytest src/backend/tests \
|
||||
uv run pytest src/backend/tests \
|
||||
--ignore=src/backend/tests/integration \
|
||||
--instafail -n auto -ra -m "not api_key_required" \
|
||||
--durations-path src/backend/tests/.test_durations \
|
||||
--splitting-algorithm least_duration \
|
||||
$(args)
|
||||
else
|
||||
poetry run pytest src/backend/tests \
|
||||
uv run pytest src/backend/tests \
|
||||
--ignore=src/backend/tests/integration \
|
||||
--instafail -ra -m "not api_key_required" \
|
||||
--durations-path src/backend/tests/.test_durations \
|
||||
|
|
@ -152,17 +162,17 @@ unit_tests_looponfail:
|
|||
@make unit_tests args="-f"
|
||||
|
||||
integration_tests:
|
||||
poetry run pytest src/backend/tests/integration \
|
||||
uv run pytest src/backend/tests/integration \
|
||||
--instafail -ra \
|
||||
$(args)
|
||||
|
||||
integration_tests_no_api_keys:
|
||||
poetry run pytest src/backend/tests/integration \
|
||||
uv run pytest src/backend/tests/integration \
|
||||
--instafail -ra -m "not api_key_required" \
|
||||
$(args)
|
||||
|
||||
integration_tests_api_keys:
|
||||
poetry run pytest src/backend/tests/integration \
|
||||
uv run pytest src/backend/tests/integration \
|
||||
--instafail -ra -m "api_key_required" \
|
||||
$(args)
|
||||
|
||||
|
|
@ -187,12 +197,12 @@ fix_codespell: ## run codespell to fix spelling errors
|
|||
poetry run codespell --toml pyproject.toml --write
|
||||
|
||||
format: ## run code formatters
|
||||
@poetry run ruff check . --fix
|
||||
@poetry run ruff format .
|
||||
@uv run ruff check . --fix
|
||||
@uv run ruff format .
|
||||
@cd src/frontend && npm run format
|
||||
|
||||
lint: install_backend ## run linters
|
||||
@poetry run mypy --namespace-packages -p "langflow"
|
||||
@uv run mypy --namespace-packages -p "langflow"
|
||||
|
||||
install_frontendci:
|
||||
@cd src/frontend && npm ci > /dev/null 2>&1
|
||||
|
|
@ -236,7 +246,7 @@ start:
|
|||
@echo 'Running the CLI'
|
||||
|
||||
ifeq ($(open_browser),false)
|
||||
@make install_backend && poetry run langflow run \
|
||||
@make install_backend && uv run langflow run \
|
||||
--path $(path) \
|
||||
--log-level $(log_level) \
|
||||
--host $(host) \
|
||||
|
|
@ -244,7 +254,7 @@ ifeq ($(open_browser),false)
|
|||
--env-file $(env) \
|
||||
--no-open-browser
|
||||
else
|
||||
@make install_backend && poetry run langflow run \
|
||||
@make install_backend && uv run langflow run \
|
||||
--path $(path) \
|
||||
--log-level $(log_level) \
|
||||
--host $(host) \
|
||||
|
|
@ -256,7 +266,7 @@ setup_devcontainer: ## set up the development container
|
|||
make install_backend
|
||||
make install_frontend
|
||||
make build_frontend
|
||||
poetry run langflow --path src/frontend/build
|
||||
uv run langflow --path src/frontend/build
|
||||
|
||||
setup_env: ## set up the environment
|
||||
@sh ./scripts/setup/setup_env.sh
|
||||
|
|
@ -272,7 +282,7 @@ backend: setup_env install_backend ## run the backend in development mode
|
|||
@-kill -9 $$(lsof -t -i:7860) || true
|
||||
ifdef login
|
||||
@echo "Running backend autologin is $(login)";
|
||||
LANGFLOW_AUTO_LOGIN=$(login) poetry run uvicorn \
|
||||
LANGFLOW_AUTO_LOGIN=$(login) uv run uvicorn \
|
||||
--factory langflow.main:create_app \
|
||||
--host 0.0.0.0 \
|
||||
--port $(port) \
|
||||
|
|
@ -282,7 +292,7 @@ ifdef login
|
|||
$(if $(workers),--workers $(workers),)
|
||||
else
|
||||
@echo "Running backend respecting the $(env) file";
|
||||
poetry run uvicorn \
|
||||
uv run uvicorn \
|
||||
--factory langflow.main:create_app \
|
||||
--host 0.0.0.0 \
|
||||
--port $(port) \
|
||||
|
|
@ -296,14 +306,14 @@ build_and_run: setup_env ## build the project and run it
|
|||
rm -rf dist
|
||||
rm -rf src/backend/base/dist
|
||||
make build
|
||||
poetry run pip install dist/*.tar.gz
|
||||
poetry run langflow run
|
||||
uv run pip install dist/*.tar.gz
|
||||
uv run langflow run
|
||||
|
||||
build_and_install: ## build the project and install it
|
||||
@echo 'Removing dist folder'
|
||||
rm -rf dist
|
||||
rm -rf src/backend/base/dist
|
||||
make build && poetry run pip install dist/*.whl && pip install src/backend/base/dist/*.whl --force-reinstall
|
||||
make build && uv run pip install dist/*.whl && pip install src/backend/base/dist/*.whl --force-reinstall
|
||||
|
||||
build: setup_env ## build the frontend static files and package the project
|
||||
ifdef base
|
||||
|
|
@ -320,19 +330,18 @@ ifdef main
|
|||
endif
|
||||
|
||||
build_langflow_base:
|
||||
cd src/backend/base && poetry build
|
||||
cd src/backend/base && uv build
|
||||
rm -rf src/backend/base/langflow/frontend
|
||||
|
||||
build_langflow_backup:
|
||||
poetry lock && poetry build
|
||||
uv lock && uv build
|
||||
|
||||
build_langflow:
|
||||
cd ./scripts && poetry run python update_dependencies.py
|
||||
poetry lock --no-update
|
||||
poetry build
|
||||
uv lock --no-upgrade
|
||||
uv build
|
||||
ifdef restore
|
||||
mv pyproject.toml.bak pyproject.toml
|
||||
mv poetry.lock.bak poetry.lock
|
||||
mv uv.lock.bak uv.lock
|
||||
endif
|
||||
|
||||
dev: ## run the project in development mode with docker compose
|
||||
|
|
@ -391,31 +400,35 @@ dcdev_up:
|
|||
docker compose -f docker/dev.docker-compose.yml up --remove-orphans
|
||||
|
||||
lock_base:
|
||||
cd src/backend/base && poetry lock
|
||||
cd src/backend/base && uv lock
|
||||
|
||||
lock_langflow:
|
||||
poetry lock
|
||||
uv lock
|
||||
|
||||
lock: ## lock dependencies
|
||||
@echo 'Locking dependencies'
|
||||
cd src/backend/base && poetry lock --no-update
|
||||
poetry lock --no-update
|
||||
cd src/backend/base && uv lock --no-update
|
||||
uv lock --no-update
|
||||
|
||||
update: ## update dependencies
|
||||
@echo 'Updating dependencies'
|
||||
cd src/backend/base && poetry update
|
||||
poetry update
|
||||
cd src/backend/base && uv sync --upgrade
|
||||
uv sync --upgrade
|
||||
|
||||
publish_base:
|
||||
#TODO: replace with uvx twine upload dist/*
|
||||
cd src/backend/base && poetry publish --skip-existing
|
||||
|
||||
publish_langflow:
|
||||
#TODO: replace with uvx twine upload dist/*
|
||||
poetry publish
|
||||
|
||||
publish_base_testpypi:
|
||||
#TODO: replace with uvx twine upload dist/*
|
||||
cd src/backend/base && poetry publish --skip-existing -r test-pypi
|
||||
|
||||
publish_langflow_testpypi:
|
||||
#TODO: replace with uvx twine upload dist/*
|
||||
poetry publish -r test-pypi
|
||||
|
||||
publish: ## build the frontend static files and package the project and publish it to PyPI
|
||||
|
|
@ -432,12 +445,13 @@ publish_testpypi: ## build the frontend static files and package the project and
|
|||
@echo 'Publishing the project'
|
||||
|
||||
ifdef base
|
||||
#TODO: replace with uvx twine upload dist/*
|
||||
poetry config repositories.test-pypi https://test.pypi.org/legacy/
|
||||
make publish_base_testpypi
|
||||
endif
|
||||
|
||||
ifdef main
|
||||
#TODO: replace with uvx twine upload dist/*
|
||||
poetry config repositories.test-pypi https://test.pypi.org/legacy/
|
||||
make publish_langflow_testpypi
|
||||
endif
|
||||
|
||||
|
|
|
|||
155
pyproject.toml
155
pyproject.toml
|
|
@ -21,6 +21,120 @@ packages = [{ include = "langflow", from = "src/backend" }]
|
|||
include = ["src/backend/langflow/*", "src/backend/langflow/**/*"]
|
||||
documentation = "https://docs.langflow.org"
|
||||
|
||||
[tool.uv.sources]
|
||||
langflow-base = {path = "src/backend/base"}
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/backend/langflow"]
|
||||
|
||||
[project]
|
||||
name = "langflow"
|
||||
version = "1.0.18"
|
||||
description = "A Python package with a built-in web application"
|
||||
requires-python = ">=3.10,<3.13"
|
||||
# Define your main dependencies here
|
||||
dependencies = [
|
||||
"langflow-base==0.0.96", # Local editable package
|
||||
"beautifulsoup4>=4.12.2",
|
||||
"google-search-results>=2.4.1",
|
||||
"google-api-python-client>=2.130.0",
|
||||
"huggingface-hub[inference]>=0.23.2",
|
||||
"networkx>=3.1",
|
||||
"fake-useragent>=1.5.0",
|
||||
"psycopg2-binary>=2.9.6",
|
||||
"pyarrow>=14.0.0",
|
||||
"wikipedia>=1.4.0",
|
||||
"qdrant-client>=1.9.0",
|
||||
"weaviate-client",
|
||||
"cohere>=5.5.3",
|
||||
"faiss-cpu>=1.8.0",
|
||||
"types-cachetools>=5.3.0.5",
|
||||
"pymongo>=4.6.0",
|
||||
"supabase>=2.3.0",
|
||||
"certifi>=2023.11.17,<2025.0.0",
|
||||
"psycopg>=3.1.9",
|
||||
"fastavro>=1.8.0",
|
||||
"redis>=5.0.1",
|
||||
"metaphor-python>=0.1.11",
|
||||
'pywin32>=306; sys_platform == "win32"',
|
||||
"langfuse>=2.33.0",
|
||||
"metal-sdk>=2.5.0",
|
||||
"markupsafe>=2.1.3",
|
||||
"boto3~=1.34.162",
|
||||
"numexpr>=2.8.6",
|
||||
"qianfan==0.3.5",
|
||||
"pgvector>=0.2.3",
|
||||
"pyautogen>=0.2.0",
|
||||
"langchain-google-genai>=1.0.8",
|
||||
"langchain-cohere>=0.1.5",
|
||||
"elasticsearch>=8.12.0",
|
||||
"pytube>=15.0.0",
|
||||
"dspy-ai>=2.4.0",
|
||||
"assemblyai>=0.26.0",
|
||||
"litellm>=1.44.0",
|
||||
"chromadb>=0.4",
|
||||
"langchain-anthropic>=0.1.23",
|
||||
"langchain-astradb>=0.3.5",
|
||||
"langchain-openai==0.1.22",
|
||||
"zep-python>=2.0.0rc5",
|
||||
"langchain-google-vertexai>=1.0.10",
|
||||
"langchain-groq>=0.1.9",
|
||||
"langchain-pinecone>=0.1.3",
|
||||
"langchain-mistralai==0.1.12",
|
||||
"youtube-transcript-api>=0.6.2",
|
||||
"markdown>=3.7",
|
||||
"langchain-chroma>=0.1.1",
|
||||
"upstash-vector>=0.5.0",
|
||||
"gitpython>=3.1.43",
|
||||
"langchain-aws>=0.1.16",
|
||||
"langchain-unstructured>=0.1.2",
|
||||
"langchain-mongodb>=0.1.6",
|
||||
"kubernetes>=30.1.0",
|
||||
"firecrawl-py>=0.0.16",
|
||||
"json-repair>=0.25.2",
|
||||
"langchain-nvidia-ai-endpoints==0.1.6",
|
||||
"langchain-google-calendar-tools>=0.0.1",
|
||||
"langchain-milvus>=0.1.1",
|
||||
"langwatch>=0.1.16",
|
||||
"langsmith>=0.1.86",
|
||||
"yfinance>=0.2.40",
|
||||
"langchain-google-community==1.0.7",
|
||||
"wolframalpha>=5.1.3",
|
||||
"astra-assistants>=2.1.2",
|
||||
"composio-langchain==0.5.9",
|
||||
"spider-client>=0.0.27",
|
||||
"nltk>=3.9.1",
|
||||
"bson>=0.5.10",
|
||||
"lark>=1.2.2",
|
||||
"jq>=1.8.0",
|
||||
"pydantic-settings==2.4.0",
|
||||
"ragstack-ai-knowledge-store>=0.2.1",
|
||||
"duckduckgo-search>=6.2.11",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
deploy = [
|
||||
"celery[redis]>=5.3.6",
|
||||
"flower>=2.0.0"
|
||||
]
|
||||
couchbase = [
|
||||
"couchbase>=4.2.1"
|
||||
]
|
||||
cassio = [
|
||||
"cassio>=0.1.7"
|
||||
]
|
||||
local = [
|
||||
"llama-cpp-python~=0.2.0",
|
||||
"sentence-transformers>=2.3.1",
|
||||
"ctransformers>=0.2.10"
|
||||
]
|
||||
clickhouse-connect = [
|
||||
"clickhouse-connect[clickhouse-connect]==0.7.19"
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
langflow = "langflow.__main__:main"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
langflow = "langflow.__main__:main"
|
||||
|
||||
|
|
@ -39,7 +153,7 @@ psycopg2-binary = "^2.9.6"
|
|||
pyarrow = "^14.0.0"
|
||||
wikipedia = "^1.4.0"
|
||||
qdrant-client = "^1.9.0"
|
||||
weaviate-client = "*"
|
||||
weaviate-client = "^4.6.5"
|
||||
sentence-transformers = { version = "^2.3.1", optional = true }
|
||||
ctransformers = { version = "^0.2.10", optional = true }
|
||||
cohere = "^5.5.3"
|
||||
|
|
@ -153,6 +267,41 @@ couchbase = ["couchbase"]
|
|||
cassio = ["cassio"]
|
||||
local = ["llama-cpp-python", "sentence-transformers", "ctransformers"]
|
||||
|
||||
[tool.uv]
|
||||
dev-dependencies = [
|
||||
"pytest-instafail>=0.5.0",
|
||||
"types-redis>=4.6.0.5",
|
||||
"ipykernel>=6.29.0",
|
||||
"mypy>=1.11.0",
|
||||
"ruff>=0.6.2,<0.7.0",
|
||||
"httpx",
|
||||
"pytest>=8.2.0",
|
||||
"types-requests>=2.32.0",
|
||||
"requests>=2.32.0",
|
||||
"pytest-cov>=5.0.0",
|
||||
"pandas-stubs>=2.1.4.231227",
|
||||
"types-pillow>=10.2.0.20240213",
|
||||
"types-pyyaml>=6.0.12.8",
|
||||
"types-python-jose>=3.3.4.8",
|
||||
"types-passlib>=1.7.7.13",
|
||||
"pytest-mock>=3.14.0",
|
||||
"pytest-xdist>=3.6.0",
|
||||
"types-pywin32>=306.0.0.4",
|
||||
"types-google-cloud-ndb>=2.2.0.0",
|
||||
"pytest-sugar>=1.0.0",
|
||||
"respx>=0.21.1",
|
||||
"pytest-asyncio>=0.23.0",
|
||||
"pytest-profiling>=1.7.0",
|
||||
"pre-commit>=3.7.0",
|
||||
"vulture>=2.11",
|
||||
"dictdiffer>=0.9.0",
|
||||
"pytest-split>=0.9.0",
|
||||
"pytest-flakefinder>=1.1.0",
|
||||
"types-markdown>=3.7.0.20240822",
|
||||
"packaging>=23.2,<24.0"
|
||||
|
||||
]
|
||||
|
||||
|
||||
[tool.poetry.group.spelling]
|
||||
optional = true
|
||||
|
|
@ -212,5 +361,5 @@ mypy_path = "langflow"
|
|||
ignore_missing_imports = true
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def read_version_from_pyproject(file_path):
|
||||
with open(file_path, "r") as file:
|
||||
for line in file:
|
||||
match = re.search(r'version = "(.*)"', line)
|
||||
if match:
|
||||
return match.group(1)
|
||||
return None
|
||||
|
||||
|
||||
# def get_version_from_pypi(package_name):
|
||||
# import requests
|
||||
|
||||
# response = requests.get(f"https://pypi.org/pypi/{package_name}/json")
|
||||
# if response.ok:
|
||||
# return response.json()["info"]["version"]
|
||||
# return None
|
||||
|
||||
|
||||
def get_version_from_pypi(package_name):
|
||||
# Use default python lib to make the GET for this because it runs in github actions
|
||||
import json
|
||||
import urllib.request
|
||||
|
||||
response = urllib.request.urlopen(f"https://pypi.org/pypi/{package_name}/json")
|
||||
if response.getcode() == 200:
|
||||
return json.loads(response.read())["info"]["version"]
|
||||
return None
|
||||
|
||||
|
||||
def is_development_release(version):
|
||||
"""
|
||||
Determines if the version is a development version based on PEP 440.
|
||||
|
||||
We consider a development version (.devN) as our nightly versions
|
||||
"""
|
||||
return "dev" in version
|
||||
|
||||
|
||||
def update_pyproject_dependency(pyproject_path, version, is_nightly):
|
||||
# Strip "v" prefix from version if present
|
||||
if version.startswith("v"):
|
||||
version = version[1:]
|
||||
|
||||
pattern = re.compile(r'langflow-base = \{ path = "\./src/backend/base", develop = true \}')
|
||||
if is_nightly:
|
||||
# NOTE: This process can be simplified; see the note in update_lf_base_dependency.py
|
||||
replacement = f'langflow-base-nightly = "{version}"'
|
||||
else:
|
||||
replacement = f'langflow-base = "^{version}"'
|
||||
with open(pyproject_path, "r") as file:
|
||||
content = file.read()
|
||||
content = pattern.sub(replacement, content)
|
||||
with open(pyproject_path, "w") as file:
|
||||
file.write(content)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Backing up files
|
||||
pyproject_path = Path(__file__).resolve().parent / "../pyproject.toml"
|
||||
pyproject_path = pyproject_path.resolve()
|
||||
with open(pyproject_path, "r") as original, open(pyproject_path.with_name("pyproject.toml.bak"), "w") as backup:
|
||||
backup.write(original.read())
|
||||
# Now backup poetry.lock
|
||||
with open(pyproject_path.with_name("poetry.lock"), "r") as original, open(
|
||||
pyproject_path.with_name("poetry.lock.bak"), "w"
|
||||
) as backup:
|
||||
backup.write(original.read())
|
||||
|
||||
# Reading version and updating pyproject.toml
|
||||
langflow_base_path = Path(__file__).resolve().parent / "../src/backend/base/pyproject.toml"
|
||||
version = read_version_from_pyproject(langflow_base_path)
|
||||
if version:
|
||||
# Nightly versions contain "dev"
|
||||
# WARNING: This will cause issues if we release `.dev` versions to `langflow` or `langflow-base`
|
||||
is_nightly = is_development_release(version)
|
||||
update_pyproject_dependency(pyproject_path, version, is_nightly)
|
||||
else:
|
||||
print("Error: Version not found.")
|
||||
|
|
@ -25,6 +25,9 @@ documentation = "https://docs.langflow.org"
|
|||
[tool.poetry.scripts]
|
||||
langflow-base = "langflow.__main__:main"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["langflow"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.10,<3.13"
|
||||
fastapi = "^0.111.0"
|
||||
|
|
@ -149,5 +152,130 @@ line-length = 120
|
|||
select = ["E4", "E7", "E9", "F", "I", "UP"]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
|
||||
[project]
|
||||
name = "langflow-base"
|
||||
version = "0.0.96"
|
||||
description = "A Python package with a built-in web application"
|
||||
requires-python = ">=3.10,<3.13"
|
||||
license = "MIT"
|
||||
keywords = ["nlp", "langchain", "openai", "gpt", "gui"]
|
||||
readme = "README.md"
|
||||
|
||||
dependencies = [
|
||||
"fastapi>=0.111.0",
|
||||
"httpx",
|
||||
"uvicorn>=0.30.0",
|
||||
"gunicorn>=22.0.0",
|
||||
"langchain~=0.2.0",
|
||||
"langchain-core>=0.2.32",
|
||||
"langchainhub~=0.1.15",
|
||||
"sqlmodel==0.0.18",
|
||||
"loguru>=0.7.1",
|
||||
"rich>=13.7.0",
|
||||
"langchain-experimental>=0.0.61",
|
||||
"pydantic>=2.7.0",
|
||||
"pydantic-settings>=2.2.0",
|
||||
"websockets",
|
||||
"typer>=0.12.0",
|
||||
"cachetools>=5.3.1",
|
||||
"platformdirs>=4.2.0",
|
||||
"python-multipart>=0.0.7",
|
||||
"orjson==3.10.0",
|
||||
"alembic>=1.13.0",
|
||||
"passlib>=1.7.4",
|
||||
"bcrypt==4.0.1",
|
||||
"pillow>=10.2.0",
|
||||
"docstring-parser>=0.16",
|
||||
"python-jose>=3.3.0",
|
||||
"pandas==2.2.2",
|
||||
"multiprocess>=0.70.14",
|
||||
"duckdb>=1.0.0",
|
||||
"python-docx>=1.1.0",
|
||||
"jq>=1.7.0; sys_platform != 'win32'",
|
||||
"pypdf>=4.2.0",
|
||||
"nest-asyncio>=1.6.0",
|
||||
"emoji>=2.12.0",
|
||||
"cryptography>=42.0.5,<44.0.0",
|
||||
"asyncer>=0.0.5",
|
||||
"pyperclip>=1.8.2",
|
||||
"uncurl>=0.0.11",
|
||||
"sentry-sdk[fastapi,loguru]>=2.5.1",
|
||||
"chardet>=5.2.0",
|
||||
"firecrawl-py>=0.0.16",
|
||||
"opentelemetry-api>=1.25.0",
|
||||
"opentelemetry-sdk>=1.25.0",
|
||||
"opentelemetry-exporter-prometheus>=0.46b0",
|
||||
"opentelemetry-instrumentation-fastapi>=0.46b0",
|
||||
"prometheus-client>=0.20.0",
|
||||
"aiofiles>=24.1.0",
|
||||
"setuptools>=70",
|
||||
"nanoid>=2.0.0",
|
||||
"filelock>=3.15.4",
|
||||
"grandalf>=0.8.0",
|
||||
"crewai>=0.36.0",
|
||||
"spider-client>=0.0.27",
|
||||
"diskcache>=5.6.3",
|
||||
"clickhouse-connect==0.7.19"
|
||||
]
|
||||
|
||||
# Optional dependencies for uv
|
||||
[project.optional-dependencies]
|
||||
deploy = [
|
||||
"celery",
|
||||
"redis",
|
||||
"flower"
|
||||
]
|
||||
local = [
|
||||
"llama-cpp-python",
|
||||
"sentence-transformers",
|
||||
"ctransformers"
|
||||
]
|
||||
all = [
|
||||
"celery",
|
||||
"redis",
|
||||
"flower",
|
||||
"llama-cpp-python",
|
||||
"sentence-transformers",
|
||||
"ctransformers"
|
||||
]
|
||||
|
||||
# Development dependencies
|
||||
dev = [
|
||||
"types-redis>=4.6.0.5",
|
||||
"ipykernel>=6.29.0",
|
||||
"mypy>=1.11.0",
|
||||
"ruff>=0.4.5",
|
||||
"httpx",
|
||||
"pytest>=8.2.0",
|
||||
"types-requests>=2.32.0",
|
||||
"requests>=2.32.0",
|
||||
"pytest-cov>=5.0.0",
|
||||
"pandas-stubs>=2.1.4.231227",
|
||||
"types-pillow>=10.2.0.20240213",
|
||||
"types-pyyaml>=6.0.12.8",
|
||||
"types-python-jose>=3.3.4.8",
|
||||
"types-passlib>=1.7.7.13",
|
||||
"pytest-mock>=3.14.0",
|
||||
"pytest-xdist>=3.6.0",
|
||||
"types-pywin32>=306.0.0.4",
|
||||
"types-google-cloud-ndb>=2.2.0.0",
|
||||
"pytest-sugar>=1.0.0",
|
||||
"respx>=0.21.1",
|
||||
"pytest-instafail>=0.5.0",
|
||||
"pytest-asyncio>=0.23.0",
|
||||
"pytest-profiling>=1.7.0",
|
||||
"pre-commit>=3.7.0",
|
||||
"vulture>=2.11",
|
||||
"dictdiffer>=0.9.0",
|
||||
"pytest-split>=0.9.0",
|
||||
"devtools>=0.12.2",
|
||||
"pytest-flakefinder>=1.1.0",
|
||||
"types-markdown>=3.7.0.20240822"
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
langflow-base = "langflow.__main__:main"
|
||||
|
|
|
|||
5699
src/backend/base/uv.lock
generated
Normal file
5699
src/backend/base/uv.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue