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
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue