Improve makefile [edited] (#2141)
* ignore sqlite tmp files * update many dependencies to be optional * improve makefile help messagem * chore: Update langflow-base dependency to use local path for development * change postgres to mandatory dependency * improve makefile readability * Revert update many dependencies to be optional This reverts commit 80780565df5bc63632e6971054670cee467542f9. --------- Co-authored-by: ogabrielluiz <gabriel@langflow.org>
This commit is contained in:
parent
b72ee8fab6
commit
5ce1192a1b
3 changed files with 53 additions and 25 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -180,6 +180,8 @@ coverage.xml
|
||||||
local_settings.py
|
local_settings.py
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
db.sqlite3-journal
|
db.sqlite3-journal
|
||||||
|
*.db-shm
|
||||||
|
*.db-wal
|
||||||
|
|
||||||
# Flask stuff:
|
# Flask stuff:
|
||||||
instance/
|
instance/
|
||||||
|
|
|
||||||
75
Makefile
75
Makefile
|
|
@ -9,17 +9,21 @@ open_browser ?= true
|
||||||
path = src/backend/base/langflow/frontend
|
path = src/backend/base/langflow/frontend
|
||||||
workers ?= 1
|
workers ?= 1
|
||||||
|
|
||||||
|
|
||||||
codespell:
|
codespell:
|
||||||
@poetry install --with spelling
|
@poetry install --with spelling
|
||||||
poetry run codespell --toml pyproject.toml
|
poetry run codespell --toml pyproject.toml
|
||||||
|
|
||||||
|
|
||||||
fix_codespell:
|
fix_codespell:
|
||||||
@poetry install --with spelling
|
@poetry install --with spelling
|
||||||
poetry run codespell --toml pyproject.toml --write
|
poetry run codespell --toml pyproject.toml --write
|
||||||
|
|
||||||
|
|
||||||
setup_poetry:
|
setup_poetry:
|
||||||
pipx install poetry
|
pipx install poetry
|
||||||
|
|
||||||
|
|
||||||
add:
|
add:
|
||||||
@echo 'Adding dependencies'
|
@echo 'Adding dependencies'
|
||||||
ifdef devel
|
ifdef devel
|
||||||
|
|
@ -34,45 +38,54 @@ ifdef base
|
||||||
cd src/backend/base && poetry add $(base)
|
cd src/backend/base && poetry add $(base)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
init:
|
init:
|
||||||
@echo 'Installing backend dependencies'
|
@echo 'Installing backend dependencies'
|
||||||
make install_backend
|
make install_backend
|
||||||
@echo 'Installing frontend dependencies'
|
@echo 'Installing frontend dependencies'
|
||||||
make install_frontend
|
make install_frontend
|
||||||
|
|
||||||
coverage:
|
|
||||||
|
coverage: ## run the tests and generate a coverage report
|
||||||
poetry run pytest --cov \
|
poetry run pytest --cov \
|
||||||
--cov-config=.coveragerc \
|
--cov-config=.coveragerc \
|
||||||
--cov-report xml \
|
--cov-report xml \
|
||||||
--cov-report term-missing:skip-covered \
|
--cov-report term-missing:skip-covered \
|
||||||
--cov-report lcov:coverage/lcov-pytest.info
|
--cov-report lcov:coverage/lcov-pytest.info
|
||||||
|
|
||||||
|
|
||||||
# allow passing arguments to pytest
|
# allow passing arguments to pytest
|
||||||
tests:
|
tests: ## run the tests
|
||||||
poetry run pytest tests --instafail -ra -n auto -m "not api_key_required" $(args)
|
poetry run pytest tests --instafail -ra -n auto -m "not api_key_required" $(args)
|
||||||
|
|
||||||
|
|
||||||
format:
|
format: ## run code formatters
|
||||||
poetry run ruff check . --fix
|
poetry run ruff check . --fix
|
||||||
poetry run ruff format .
|
poetry run ruff format .
|
||||||
cd src/frontend && npm run format
|
cd src/frontend && npm run format
|
||||||
|
|
||||||
lint:
|
|
||||||
|
lint: ## run linters
|
||||||
poetry run mypy --namespace-packages -p "langflow"
|
poetry run mypy --namespace-packages -p "langflow"
|
||||||
|
|
||||||
install_frontend:
|
|
||||||
|
install_frontend: ## install the frontend dependencies
|
||||||
cd src/frontend && npm install
|
cd src/frontend && npm install
|
||||||
|
|
||||||
|
|
||||||
install_frontendci:
|
install_frontendci:
|
||||||
cd src/frontend && npm ci
|
cd src/frontend && npm ci
|
||||||
|
|
||||||
|
|
||||||
install_frontendc:
|
install_frontendc:
|
||||||
cd src/frontend && rm -rf node_modules package-lock.json && npm install
|
cd src/frontend && rm -rf node_modules package-lock.json && npm install
|
||||||
|
|
||||||
|
|
||||||
run_frontend:
|
run_frontend:
|
||||||
@-kill -9 `lsof -t -i:3000`
|
@-kill -9 `lsof -t -i:3000`
|
||||||
cd src/frontend && npm start
|
cd src/frontend && npm start
|
||||||
|
|
||||||
|
|
||||||
tests_frontend:
|
tests_frontend:
|
||||||
ifeq ($(UI), true)
|
ifeq ($(UI), true)
|
||||||
cd src/frontend && npx playwright test --ui --project=chromium
|
cd src/frontend && npx playwright test --ui --project=chromium
|
||||||
|
|
@ -80,6 +93,7 @@ else
|
||||||
cd src/frontend && npx playwright test --project=chromium
|
cd src/frontend && npx playwright test --project=chromium
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
run_cli:
|
run_cli:
|
||||||
@echo 'Running the CLI'
|
@echo 'Running the CLI'
|
||||||
@make install_frontend > /dev/null
|
@make install_frontend > /dev/null
|
||||||
|
|
@ -93,6 +107,7 @@ else
|
||||||
@make start host=$(host) port=$(port) log_level=$(log_level)
|
@make start host=$(host) port=$(port) log_level=$(log_level)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
run_cli_debug:
|
run_cli_debug:
|
||||||
@echo 'Running the CLI in debug mode'
|
@echo 'Running the CLI in debug mode'
|
||||||
@make install_frontend > /dev/null
|
@make install_frontend > /dev/null
|
||||||
|
|
@ -106,6 +121,7 @@ else
|
||||||
@make start host=$(host) port=$(port) log_level=debug
|
@make start host=$(host) port=$(port) log_level=debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
start:
|
start:
|
||||||
@echo 'Running the CLI'
|
@echo 'Running the CLI'
|
||||||
|
|
||||||
|
|
@ -116,30 +132,34 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setup_devcontainer:
|
setup_devcontainer:
|
||||||
make init
|
make init
|
||||||
make build_frontend
|
make build_frontend
|
||||||
poetry run langflow --path src/frontend/build
|
poetry run langflow --path src/frontend/build
|
||||||
|
|
||||||
|
|
||||||
setup_env:
|
setup_env:
|
||||||
@sh ./scripts/setup/update_poetry.sh 1.8.2
|
@sh ./scripts/setup/update_poetry.sh 1.8.2
|
||||||
@sh ./scripts/setup/setup_env.sh
|
@sh ./scripts/setup/setup_env.sh
|
||||||
|
|
||||||
frontend:
|
|
||||||
|
frontend: ## run the frontend in development mode
|
||||||
make install_frontend
|
make install_frontend
|
||||||
make run_frontend
|
make run_frontend
|
||||||
|
|
||||||
|
|
||||||
frontendc:
|
frontendc:
|
||||||
make install_frontendc
|
make install_frontendc
|
||||||
make run_frontend
|
make run_frontend
|
||||||
|
|
||||||
|
|
||||||
install_backend:
|
install_backend:
|
||||||
@echo 'Installing backend dependencies'
|
@echo 'Installing backend dependencies'
|
||||||
@poetry install
|
@poetry install
|
||||||
@poetry run pre-commit install
|
@poetry run pre-commit install
|
||||||
|
|
||||||
backend:
|
|
||||||
|
backend: ## run the backend in development mode
|
||||||
@echo 'Setting up the environment'
|
@echo 'Setting up the environment'
|
||||||
@make setup_env
|
@make setup_env
|
||||||
make install_backend
|
make install_backend
|
||||||
|
|
@ -152,6 +172,7 @@ else
|
||||||
poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio --workers $(workers)
|
poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio --workers $(workers)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
build_and_run:
|
build_and_run:
|
||||||
@echo 'Removing dist folder'
|
@echo 'Removing dist folder'
|
||||||
@make setup_env
|
@make setup_env
|
||||||
|
|
@ -161,18 +182,21 @@ build_and_run:
|
||||||
poetry run pip install dist/*.tar.gz
|
poetry run pip install dist/*.tar.gz
|
||||||
poetry run langflow run
|
poetry run langflow run
|
||||||
|
|
||||||
|
|
||||||
build_and_install:
|
build_and_install:
|
||||||
@echo 'Removing dist folder'
|
@echo 'Removing dist folder'
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
rm -rf src/backend/base/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 && poetry run pip install dist/*.whl && pip install src/backend/base/dist/*.whl --force-reinstall
|
||||||
|
|
||||||
build_frontend:
|
|
||||||
|
build_frontend: ## build the frontend static files
|
||||||
cd src/frontend && CI='' npm run build
|
cd src/frontend && CI='' npm run build
|
||||||
rm -rf src/backend/base/langflow/frontend
|
rm -rf src/backend/base/langflow/frontend
|
||||||
cp -r src/frontend/build src/backend/base/langflow/frontend
|
cp -r src/frontend/build src/backend/base/langflow/frontend
|
||||||
|
|
||||||
build:
|
|
||||||
|
build: ## build the frontend static files and package the project
|
||||||
@echo 'Building the project'
|
@echo 'Building the project'
|
||||||
@make setup_env
|
@make setup_env
|
||||||
ifdef base
|
ifdef base
|
||||||
|
|
@ -185,13 +209,16 @@ ifdef main
|
||||||
make build_langflow
|
make build_langflow
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
build_langflow_base:
|
build_langflow_base:
|
||||||
cd src/backend/base && poetry build
|
cd src/backend/base && poetry build
|
||||||
rm -rf src/backend/base/langflow/frontend
|
rm -rf src/backend/base/langflow/frontend
|
||||||
|
|
||||||
|
|
||||||
build_langflow_backup:
|
build_langflow_backup:
|
||||||
poetry lock && poetry build
|
poetry lock && poetry build
|
||||||
|
|
||||||
|
|
||||||
build_langflow:
|
build_langflow:
|
||||||
cd ./scripts && poetry run python update_dependencies.py
|
cd ./scripts && poetry run python update_dependencies.py
|
||||||
poetry lock
|
poetry lock
|
||||||
|
|
@ -201,7 +228,8 @@ ifdef restore
|
||||||
mv poetry.lock.bak poetry.lock
|
mv poetry.lock.bak poetry.lock
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dev:
|
|
||||||
|
dev: ## run the project in development mode with docker compose
|
||||||
make install_frontend
|
make install_frontend
|
||||||
ifeq ($(build),1)
|
ifeq ($(build),1)
|
||||||
@echo 'Running docker compose up with build'
|
@echo 'Running docker compose up with build'
|
||||||
|
|
@ -211,25 +239,30 @@ else
|
||||||
docker compose $(if $(debug),-f docker-compose.debug.yml) up
|
docker compose $(if $(debug),-f docker-compose.debug.yml) up
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
lock_base:
|
lock_base:
|
||||||
cd src/backend/base && poetry lock
|
cd src/backend/base && poetry lock
|
||||||
|
|
||||||
lock_langflow:
|
lock_langflow:
|
||||||
poetry lock
|
poetry lock
|
||||||
|
|
||||||
|
|
||||||
lock:
|
lock:
|
||||||
# Run both in parallel
|
# Run both in parallel
|
||||||
@echo 'Locking dependencies'
|
@echo 'Locking dependencies'
|
||||||
cd src/backend/base && poetry lock
|
cd src/backend/base && poetry lock
|
||||||
poetry lock
|
poetry lock
|
||||||
|
|
||||||
|
|
||||||
publish_base:
|
publish_base:
|
||||||
cd src/backend/base && poetry publish
|
cd src/backend/base && poetry publish
|
||||||
|
|
||||||
|
|
||||||
publish_langflow:
|
publish_langflow:
|
||||||
poetry publish
|
poetry publish
|
||||||
|
|
||||||
publish:
|
|
||||||
|
publish: ## build the frontend static files and package the project and publish it to PyPI
|
||||||
@echo 'Publishing the project'
|
@echo 'Publishing the project'
|
||||||
ifdef base
|
ifdef base
|
||||||
make publish_base
|
make publish_base
|
||||||
|
|
@ -239,17 +272,11 @@ ifdef main
|
||||||
make publish_langflow
|
make publish_langflow
|
||||||
endif
|
endif
|
||||||
|
|
||||||
help:
|
|
||||||
|
help: ## show this help message
|
||||||
@echo '----'
|
@echo '----'
|
||||||
@echo 'format - run code formatters'
|
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | \
|
||||||
@echo 'lint - run linters'
|
sed -e 's/:.*##\s*/:/' \
|
||||||
@echo 'install_frontend - install the frontend dependencies'
|
-e 's/^\(.\+\):\(.*\)/\\x1b[36mmake \1\\x1b[m:\2/' | \
|
||||||
@echo 'build_frontend - build the frontend static files'
|
column -c2 -t -s :']]')"
|
||||||
@echo 'run_frontend - run the frontend in development mode'
|
|
||||||
@echo 'run_backend - run the backend in development mode'
|
|
||||||
@echo 'build - build the frontend static files and package the project'
|
|
||||||
@echo 'publish - build the frontend static files and package the project and publish it to PyPI'
|
|
||||||
@echo 'dev - run the project in development mode with docker compose'
|
|
||||||
@echo 'tests - run the tests'
|
|
||||||
@echo 'coverage - run the tests and generate a coverage report'
|
|
||||||
@echo '----'
|
@echo '----'
|
||||||
|
|
|
||||||
1
poetry.lock
generated
1
poetry.lock
generated
|
|
@ -7498,7 +7498,6 @@ files = [
|
||||||
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
|
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
|
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
|
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"},
|
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
|
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
|
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
|
||||||
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
|
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue