Update in the devcontainer
This commit is contained in:
parent
c1511d7773
commit
5cba006a54
2 changed files with 159 additions and 156 deletions
|
|
@ -1,40 +1,38 @@
|
||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
|
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
|
||||||
{
|
{
|
||||||
"name": "LangChain Dev Container",
|
"name": "LangChain Dev Container",
|
||||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
|
"image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye",
|
||||||
"features": {
|
|
||||||
"ghcr.io/devcontainers/features/aws-cli:1": {},
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
"ghcr.io/devcontainers/features/docker-in-docker": {},
|
"features": {
|
||||||
"ghcr.io/devcontainers-contrib/features/poetry": {}
|
"ghcr.io/devcontainers/features/node": {},
|
||||||
},
|
"ghcr.io/devcontainers-contrib/features/poetry": {}
|
||||||
"customizations": {
|
},
|
||||||
"vscode": {"extensions": [
|
|
||||||
"actboy168.tasks",
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
"GitHub.copilot",
|
// "forwardPorts": [],
|
||||||
"ms-python.python",
|
|
||||||
"sourcery.sourcery",
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
"eamodio.gitlens"
|
"postCreateCommand": "make setup_devcontainer",
|
||||||
]}
|
|
||||||
},
|
"containerEnv": {
|
||||||
|
"POETRY_VIRTUALENVS_IN_PROJECT": "true"
|
||||||
"containerEnv": {
|
},
|
||||||
"POETRY_VIRTUALENVS_IN_PROJECT": "true"
|
|
||||||
},
|
// Configure tool-specific properties.
|
||||||
|
"customizations": {
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
"vscode": {"extensions": [
|
||||||
// "features": {},
|
"actboy168.tasks",
|
||||||
|
"GitHub.copilot",
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
"ms-python.python",
|
||||||
// "forwardPorts": [],
|
"sourcery.sourcery",
|
||||||
|
"eamodio.gitlens",
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
"ms-vscode.makefile-tools"
|
||||||
"postCreateCommand": "poetry install"
|
]}
|
||||||
|
}
|
||||||
// Configure tool-specific properties.
|
|
||||||
// "customizations": {},
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
}
|
||||||
// "remoteUser": "root"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
237
Makefile
237
Makefile
|
|
@ -1,116 +1,121 @@
|
||||||
.PHONY: all init format lint build build_frontend install_frontend run_frontend run_backend dev help tests coverage
|
.PHONY: all init format lint build build_frontend install_frontend run_frontend run_backend dev help tests coverage
|
||||||
|
|
||||||
all: help
|
all: help
|
||||||
|
|
||||||
init:
|
init:
|
||||||
@echo 'Installing pre-commit hooks'
|
@echo 'Installing pre-commit hooks'
|
||||||
git config core.hooksPath .githooks
|
git config core.hooksPath .githooks
|
||||||
@echo 'Making pre-commit hook executable'
|
@echo 'Making pre-commit hook executable'
|
||||||
chmod +x .githooks/pre-commit
|
chmod +x .githooks/pre-commit
|
||||||
@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:
|
||||||
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
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
poetry run pytest tests
|
poetry run pytest tests
|
||||||
|
|
||||||
format:
|
format:
|
||||||
poetry run black .
|
poetry run black .
|
||||||
poetry run ruff . --fix
|
poetry run ruff . --fix
|
||||||
cd src/frontend && npm run format
|
cd src/frontend && npm run format
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
poetry run mypy .
|
poetry run mypy .
|
||||||
poetry run black . --check
|
poetry run black . --check
|
||||||
poetry run ruff . --fix
|
poetry run ruff . --fix
|
||||||
|
|
||||||
install_frontend:
|
install_frontend:
|
||||||
cd src/frontend && npm install;
|
cd src/frontend && npm install;
|
||||||
|
|
||||||
install_frontendc:
|
install_frontendc:
|
||||||
cd src/frontend && npm ci;
|
cd src/frontend && npm ci;
|
||||||
|
|
||||||
run_frontend:
|
run_frontend:
|
||||||
cd src/frontend && npm start
|
cd src/frontend && npm start
|
||||||
|
|
||||||
frontend:
|
setup_devcontainer:
|
||||||
make install_frontend
|
make init
|
||||||
make run_frontend
|
make build_frontend
|
||||||
|
poetry run langflow --path src/frontend/build
|
||||||
frontendc:
|
|
||||||
make install_frontendc
|
frontend:
|
||||||
make run_frontend
|
make install_frontend
|
||||||
|
make run_frontend
|
||||||
install_backend:
|
|
||||||
poetry install
|
frontendc:
|
||||||
|
make install_frontendc
|
||||||
backend:
|
make run_frontend
|
||||||
make install_backend
|
|
||||||
poetry run uvicorn --factory src.backend.langflow.main:create_app --port 7860 --reload --log-level debug
|
install_backend:
|
||||||
|
poetry install
|
||||||
build_and_run:
|
|
||||||
echo 'Removing dist folder'
|
backend:
|
||||||
rm -rf dist
|
make install_backend
|
||||||
make build && poetry run pip install dist/*.tar.gz && poetry run langflow
|
poetry run uvicorn --factory src.backend.langflow.main:create_app --port 7860 --reload --log-level debug
|
||||||
|
|
||||||
build_and_install:
|
build_and_run:
|
||||||
echo 'Removing dist folder'
|
echo 'Removing dist folder'
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
make build && poetry run pip install dist/*.tar.gz
|
make build && poetry run pip install dist/*.tar.gz && poetry run langflow
|
||||||
|
|
||||||
build_frontend:
|
build_and_install:
|
||||||
cd src/frontend && CI='' npm run build
|
echo 'Removing dist folder'
|
||||||
cp -r src/frontend/build src/backend/langflow/frontend
|
rm -rf dist
|
||||||
|
make build && poetry run pip install dist/*.tar.gz
|
||||||
build:
|
|
||||||
make install_frontend
|
build_frontend:
|
||||||
make build_frontend
|
cd src/frontend && CI='' npm run build
|
||||||
poetry build --format sdist
|
cp -r src/frontend/build src/backend/langflow/frontend
|
||||||
rm -rf src/backend/langflow/frontend
|
|
||||||
|
build:
|
||||||
lcserve_push:
|
make install_frontend
|
||||||
make build_frontend
|
make build_frontend
|
||||||
@version=$$(poetry version --short); \
|
poetry build --format sdist
|
||||||
lc-serve push --app langflow.lcserve:app --app-dir . \
|
rm -rf src/backend/langflow/frontend
|
||||||
--image-name langflow --image-tag $${version} --verbose --public
|
|
||||||
|
lcserve_push:
|
||||||
lcserve_deploy:
|
make build_frontend
|
||||||
@:$(if $(uses),,$(error `uses` is not set. Please run `make uses=... lcserve_deploy`))
|
@version=$$(poetry version --short); \
|
||||||
lc-serve deploy jcloud --app langflow.lcserve:app --app-dir . \
|
lc-serve push --app langflow.lcserve:app --app-dir . \
|
||||||
--uses $(uses) --config src/backend/langflow/jcloud.yml --verbose
|
--image-name langflow --image-tag $${version} --verbose --public
|
||||||
|
|
||||||
dev:
|
lcserve_deploy:
|
||||||
make install_frontend
|
@:$(if $(uses),,$(error `uses` is not set. Please run `make uses=... lcserve_deploy`))
|
||||||
ifeq ($(build),1)
|
lc-serve deploy jcloud --app langflow.lcserve:app --app-dir . \
|
||||||
@echo 'Running docker compose up with build'
|
--uses $(uses) --config src/backend/langflow/jcloud.yml --verbose
|
||||||
docker compose $(if $(debug),-f docker-compose.debug.yml) up --build
|
|
||||||
else
|
dev:
|
||||||
@echo 'Running docker compose up without build'
|
make install_frontend
|
||||||
docker compose $(if $(debug),-f docker-compose.debug.yml) up
|
ifeq ($(build),1)
|
||||||
endif
|
@echo 'Running docker compose up with build'
|
||||||
|
docker compose $(if $(debug),-f docker-compose.debug.yml) up --build
|
||||||
publish:
|
else
|
||||||
make build
|
@echo 'Running docker compose up without build'
|
||||||
poetry publish
|
docker compose $(if $(debug),-f docker-compose.debug.yml) up
|
||||||
|
endif
|
||||||
help:
|
|
||||||
@echo '----'
|
publish:
|
||||||
@echo 'format - run code formatters'
|
make build
|
||||||
@echo 'lint - run linters'
|
poetry publish
|
||||||
@echo 'install_frontend - install the frontend dependencies'
|
|
||||||
@echo 'build_frontend - build the frontend static files'
|
help:
|
||||||
@echo 'run_frontend - run the frontend in development mode'
|
@echo '----'
|
||||||
@echo 'run_backend - run the backend in development mode'
|
@echo 'format - run code formatters'
|
||||||
@echo 'build - build the frontend static files and package the project'
|
@echo 'lint - run linters'
|
||||||
@echo 'publish - build the frontend static files and package the project and publish it to PyPI'
|
@echo 'install_frontend - install the frontend dependencies'
|
||||||
@echo 'dev - run the project in development mode with docker compose'
|
@echo 'build_frontend - build the frontend static files'
|
||||||
@echo 'tests - run the tests'
|
@echo 'run_frontend - run the frontend in development mode'
|
||||||
@echo 'coverage - run the tests and generate a coverage report'
|
@echo 'run_backend - run the backend in development mode'
|
||||||
@echo '----'
|
@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 '----'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue