Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7ce487c
chore(example): add exampel project
Apr 5, 2024
99ad679
chore: start of an agent
Apr 5, 2024
5e69dea
chore: add all routes
May 3, 2024
1e83175
chore: update example project
May 3, 2024
7ee8def
fix: update request and response transsformation
May 20, 2024
de459bb
chore(csv): csv now use internally file response
May 20, 2024
38f2b3e
chore(fastapi_agent): remove unused eventloop
May 20, 2024
81ccefc
fix(route): fix various little issues on routes
May 20, 2024
c335db3
chore: few more logs on param parsing
May 20, 2024
b5111ae
chore: add tests
May 20, 2024
19a664d
chore: update example project
May 20, 2024
8d8e7e6
chore: csv http doesn't use FileResponse anymore
May 31, 2024
dc658a1
fix: tests related to csv
May 31, 2024
1dc00c0
fix: typing, some keys can be null because default value
May 31, 2024
7f9db2f
feat: handle settings and prefix correctly
May 31, 2024
f39e347
chore: update example project
May 31, 2024
8630196
fix: fix tests after changing settings
May 31, 2024
c1f818a
chore: remove wrong typing
May 31, 2024
e96e884
refactor: split route creation
May 31, 2024
81db1c7
chore: little typing improvement
May 31, 2024
9a26456
chore: add CI for fastapi
May 31, 2024
baee668
chore: remove bad typing
May 31, 2024
3ef88e8
chore: update schema according to latest main
Jun 3, 2024
eeb99f2
chore: run tasks with poetry
Jul 12, 2024
26fc0ff
chore: little refactoring of example project
Jul 12, 2024
c526e20
chore: update example project model
Jul 12, 2024
b780164
chore: add agent customization to example project
Jul 12, 2024
933f7cb
chore: prevent schema to be always updated
Jul 12, 2024
6e28a7f
chore: remove useless comment
Jul 12, 2024
7f2e05b
fix: update dependencies version
Jul 12, 2024
228542a
chore: fix linting
Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/update_pyproject_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
"src/datasource_toolkit/pyproject.toml",
"src/django_agent/pyproject.toml",
"src/flask_agent/pyproject.toml",
"src/fastapi_agent/pyproject.toml",
]

PACKAGE_NAMES = [
"forestadmin-agent-toolkit",
"forestadmin-datasource-django",
"forestadmin-datasource-sqlalchemy",
"forestadmin-datasource-toolkit",
"forestadmin-django-agent",
"forestadmin-flask-agent",
"forestadmin-agent-django",
"forestadmin-agent-flask",
"forestadmin-agent-fastapi",
]


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
GenericPackage:
uses: ./.github/workflows/generic.yml
with:
packages: '["./src/datasource_toolkit/", "./src/datasource_django/", "./src/datasource_sqlalchemy/", "./src/agent_toolkit/", "./src/flask_agent/", "./src/django_agent/"]'
packages: '["./src/datasource_toolkit/", "./src/datasource_django/", "./src/datasource_sqlalchemy/", "./src/agent_toolkit/", "./src/flask_agent/", "./src/django_agent/", "./src/fastapi_agent/"]'
secrets:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
Expand Down
9 changes: 9 additions & 0 deletions src/_example/fastapi/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# forest settings
FOREST_ENV_SECRET=0000794b8b0d0776c18853c6a259af0ef74eb5a76472c257b8e1d36c7912ff04
FOREST_AUTH_SECRET=f48186505a3c5d62c27743126d6a76c1dd8b3e2d8897de19
# FOREST_SERVER_URL=https://api.development.forestadmin.com
# FOREST_VERIFY_SSL=True
# FOREST_IS_PRODUCTION=False

# fastapi settings
FASTAPI_DEBUG=True
68 changes: 68 additions & 0 deletions src/_example/fastapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Flask / SQLAlchemy

## Requirements

To manage your demo's dependencies you should install [poetry](https://python-poetry.org/docs/).

```bash
curl -sSL https://install.python-poetry.org | python3 -
```

### Already met problems

- If you're having SSL issue with Python while installing poetry, visit this link: <https://matduggan.com/til-python-3-6-and-up-is-broken-on-mac/>
- Make sure poetry is in your $PATH, sometimes on mac there is conflict between python installed graphically and installed with brew. You can use these commands to help you to find the problems

```bash
which python
which python3
which python3.10
echo "PATH=$PATH;~/Library/Application Support/pypoetry/venv/bin" >> ~/.zshrc # this is default installation path for poetry on mac
```

## (Optional) Auto-load .env files with poetry

```bash
poetry self add poetry-dotenv-plugin
```

## create a virtual env

```bash
python -m venv venv # the last 'venv' is the relative path where you want your virtual env
```

## activate it

```bash
source venv/bin/activate # adapt venv with the path previously used
```

## Install the dependencies

```bash
poetry install
```

## Init your database

```bash
poetry run poe init-db
```

## Populate your database with fake data

```bash
poetry run poe populate-db

```

## Run the server

```bash
poetry run poe runserver
```

## Next step

The last needed step is to onboard the project on [forestadmin](https://www.forestadmin.com/)
2,933 changes: 2,933 additions & 0 deletions src/_example/fastapi/poetry.lock

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions src/_example/fastapi/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[tool.poetry]
name = "forestadmin-fastapi-demo"
version = "0.1.0-beta.15"
description = ""
authors = ["Julien Barreau <julien.barreau@forestadmin.com>",]
readme = "README.md"
packages = [{include = "src"}]

[tool.poetry.dependencies]
python = ">=3.8,<3.13"
sqlalchemy = ">=1.4.0"
aiosqlite = ">=0.20.0"
greenlet = ">=3.0.3"
fastapi = ">=0.110.0"
uvicorn = ">=0.11.5"
typer = ">=0.12.1"
# SQLModel =
python-dotenv = ">= 1.0.0"
forestadmin-datasource-toolkit = {path = "../../datasource_toolkit", develop = true}
forestadmin-agent-toolkit = {path = "../../agent_toolkit", develop = true}
forestadmin-datasource-sqlalchemy = {path = "../../datasource_sqlalchemy", develop = true}
forestadmin-agent-fastapi = {path = "../../fastapi_agent", develop = true}

[tool.poetry.group.test]
optional = true

[tool.poetry.group.linter]
optional = true

[tool.poetry.group.formatter]
optional = true

[tool.poetry.group.sorter]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "~=7.1"
pytest-asyncio = "~=0.18"
coverage = "~=6.5"
freezegun = "~=1.2.0"

[[tool.poetry.group.test.dependencies.mock]]
version = "4.0"
python = "3.8"

[tool.poetry.group.linter.dependencies]
[[tool.poetry.group.linter.dependencies.flake8]]
version = "~=5.0"
python = "<3.8.1"

[[tool.poetry.group.linter.dependencies.flake8]]
version = "~=6.0"
python = ">=3.8.1"

[tool.poetry.group.formatter.dependencies]
black = ">=24.3.0"

[tool.poetry.group.sorter.dependencies]
isort = "~=3.6"

[tool.poe.executor]
type = "simple"

[tool.poe.tasks]
init-db = { shell = "python src/bin/db.py create" }
populate-db = { shell = "python src/bin/db.py seed" }
runserver = { shell = "python src/main.py" }

[tool.poetry.group.dev.dependencies]
poethepoet = "^0.16.5"
faker = "^15.3.4"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading