Skip to content

Commit

Permalink
Merge pull request #16 from BCG-X-Official/fix/dependencies
Browse files Browse the repository at this point in the history
fix: dependency upgrades and linting docs
  • Loading branch information
kaikun213 authored Feb 7, 2024
2 parents fa0f78b + a470a63 commit fc6d253
Show file tree
Hide file tree
Showing 9 changed files with 421 additions and 268 deletions.
530 changes: 287 additions & 243 deletions backend/app/poetry.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions backend/app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ packages = [
version = "1.0.0"

[tool.poetry.dependencies]
Pillow = "^9.4.0"
SQLAlchemy = "^2.0.23"
SQLAlchemy-Utils = "^0.41.1"
alembic = "^1.13.0"
asyncpg = "^0.27.0"
case-converter = "^1.1.0"
celery = "^5.2.7"
celery-sqlalchemy-scheduler = "^0.3.0"
cryptography = "^38.0.3"
fastapi = "^0.109.1"
fastapi-async-sqlalchemy = "^0.6.0"
fastapi-cache2 = {extras = ["redis"], version = "^0.2.1"}
Expand Down
69 changes: 69 additions & 0 deletions docs/docusaurus/docs/advanced/linting_and_tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# AgentKit Application Development Guide

This document serves as an overview for linting and testing the AgentKit application, which consists of both frontend and backend components. It includes instructions for individual and integrated execution of tests using various tools.

This guide outlines the steps needed to maintain high code quality and ensure the correctness of functionalities in the AgentKit project. Utilize the provided commands and make adjustments based on project specifics or personal development workflow preferences.

## Table of Contents

- [Frontend Development](#frontend-development)
- [Linting](#linting)
- [Testing with Cypress](#testing-with-cypress)
- [Backend Development](#backend-development)
- [Linting and Formatting](#linting-and-formatting)
- [Testing with Pytest](#testing-with-pytest)
- [Using the Makefile](#using-the-makefile)
- [Optional Tools](#optional-tools)
- [Pre-commit Hooks](#pre-commit-hooks)
- [Pytest](#pytest-1)

## Frontend Development

Navigate to the `/frontend` folder to begin with frontend development tasks.

### Linting

To ensure code quality and consistency, this project utilizes ESLint and Prettier.

- **Linting**: Run `pnpm lint` to identify coding standard issues.
- **Auto-fix Linting Issues**: Execute `pnpm lint:fix` to automatically resolve fixable issues.
- **Prettier Check**: Use `pnpm prettier` to check for formatting inconsistencies.
- **Prettier Fix**: Apply `pnpm prettier:fix` to automatically format the code according to project standards.

### Testing with Cypress

Cypress is used for end-to-end testing of the frontend.

- **Open Cypress**: Use `pnpm cypress:open` for interactive testing.
- **Run Cypress Tests**: Execute `pnpm cypress:run` to run tests in headless mode.

Refer to the provided Cypress Guide documentation above for detailed usage and test structure.
We have further instructions on cypress in the [acceptance tests guidelines](docs/advanced/aat_guidelines.md).

## Backend Development

Switch to the `/backend/app` directory for backend tasks or to execute only backend specific linting and tests. E.g. For a direct approach to run pytest without Makefile:

```shell
cd backend/app
poetry run python3.10 -m pytest -c tests/pytest.ini
```

However, we mostly use the makefile for simplicity. The Makefile offers a simplified way to run common tasks for both frontend and backend parts of the project.

### Linting and Formatting

The backend leverages tools like Black, Pycodestyle, and isort for linting and formatting.

- **Format Code**: Run `make reformat` to apply Black and isort formatters.
- **Linting**: Execute `make lint` to perform a comprehensive linting check using various tools.

### Testing with Pytest

Pytest is used for running automated Python tests.

- Run `make test` to execute the backend test suite. It handles preconditions and uses the configured settings.

## Pre-commit Hooks

- **Installation**: Use `make install-pre-commit` or follow the optional steps to set up pre-commit hooks locally to automatically run lint and tests on commit.
1 change: 1 addition & 0 deletions docs/docusaurus/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ For a quick start to test some of the functionality, you can use the dummy Chino
## Advanced users: Prepare your app for production
- [Tech stack and code structure](docs/advanced/overview_codebase.md)
- [Set up evaluation with LangSmith](docs/advanced/evaluation.md)
- [Run linting and tests for the application](docs/advanced/linting_and_tests.md)
- [Set up and run acceptance tests with cypress](docs/advanced/aat_guidelines.md)
- [Add additional features, such as auth, feedback and user settings](docs/advanced/optional_features.md)
- [Deploy your app] TODO: deployment documentation link
1 change: 1 addition & 0 deletions docs/docusaurus/docs/setup/setup_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Before you begin, make sure you have the following installed on your machine:
If needed, change the following variable (not required for a succesfull demo installation):
- `NEXT_PUBLIC_USE_AUTH`: Set to `true` if you would like to add an identity layer using Next Auth.
- `NEXTAUTH_SECRET`: Generate a secret key and replace `# TODO: Generate a secret and add it here` with the secret key.
- `NEXTAUTH_URL` and `NEXTAUTH_URL_INTERNAL`: Set to `http://localhost:3000`
- `GITHUB_ID` and `GITHUB_SECRET`: If you want to enable GitHub authentication, replace the corresponding values with your GitHub app credentials.
- `DB_USER`, `DB_PASSWORD`, `DB_HOST`,`DB_USER`,`DB_PORT` and `DB_NAME`: If you want to customize the database connection settings, update these values accordingly.

Expand Down
2 changes: 1 addition & 1 deletion docs/docusaurus/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const sidebars = {
{
type: 'category',
label: 'Advanced',
items: ['advanced/memory', 'advanced/optional_features', 'advanced/evaluation', 'advanced/aat_guidelines'],
items: ['advanced/memory', 'advanced/optional_features', 'advanced/evaluation', 'advanced/linting_and_tests', 'advanced/aat_guidelines'],
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ NEXT_PUBLIC_ENABLE_MESSAGE_FEEDBACK=false # Enables Langsmith feedback prompting
# https://next-auth.js.org/configuration/options#secret
NEXT_PUBLIC_USE_AUTH=false # Set to true to enable authentication
NEXTAUTH_SECRET= # TODO: Generate a secret and add it here (see above)
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_URL_INTERNAL="http://localhost:3000"
NEXTAUTH_URL="http://localhost" # Change to http://localhost:3000 if run locally
NEXTAUTH_URL_INTERNAL="http://nextjs_server:3000" # Change to http://localhost:3000 if run locally
GITHUB_ENTERPRISE_URL="https://github.your.enterprise.com/"

# Next Auth Provider (Github as standard, but can be changed to others e.g. Google)
Expand Down
6 changes: 4 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@
"cypress:run": "cypress run --e2e"
},
"dependencies": {
"@datadog/browser-rum": "^5.9.0",
"@headlessui/react": "^1.7.17",
"@next-auth/prisma-adapter": "^1.0.6",
"@prisma/client": "^4.14.1",
"@radix-ui/react-dropdown-menu": "^2.0.4",
"@react-hookz/web": "^24.0.2",
"@t3-oss/env-nextjs": "^0.7.1",
"@tailwindcss/typography": "^0.5.10",
"axios": "^1.4.0",
"axios": "^1.6.7",
"can-ndjson-stream": "^1.0.2",
"clsx": "^2.1.0",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.7",
"file-saver": "^2.0.5",
"follow-redirects": "^1.15.5",
"framer-motion": "^10.15.1",
"lodash-es": "^4.17.21",
"next": "14.0.4",
Expand All @@ -66,7 +68,7 @@
"remark-gfm": "^3.0.1",
"styled-components": "5",
"uuid": "^9.0.0",
"zod": "^3.21.4",
"zod": "^3.22.4",
"zustand": "^4.3.8"
},
"devDependencies": {
Expand Down
74 changes: 56 additions & 18 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fc6d253

Please sign in to comment.