Skip to content

Commit

Permalink
Merge branch 'main' into loadtest
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelafox authored Aug 9, 2023
2 parents 05b4145 + 9da71ef commit d6dab39
Show file tree
Hide file tree
Showing 29 changed files with 570 additions and 340 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,28 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
python_version: ["3.8", "3.9", "3.10", "3.11"]
python_version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
architecture: x64
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Build frontend
run: |
cd ./app/frontend
npm install
npm run build
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint with ruff
run: ruff .
- name: Run Python tests
run: python3 -m pytest
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.282
hooks:
- id: ruff
17 changes: 8 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"name": "Python: Quart",
"type": "python",
"request": "launch",
"module": "flask",
"module": "quart",
"cwd": "${workspaceFolder}/app/backend",
"env": {
"FLASK_APP": "app.py",
"FLASK_ENV": "development",
"FLASK_DEBUG": "0"
"QUART_APP": "main:app",
"QUART_ENV": "development",
"QUART_DEBUG": "0"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"-p 5000"
"-p 50505"
],
"console": "integratedTerminal",
"justMyCode": true,
"justMyCode": false,
"envFile": "${input:dotEnvFilePath}",
},
{
Expand Down Expand Up @@ -57,4 +56,4 @@
"command": "azure-dev.commands.getDotEnvFilePath"
}
]
}
}
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ Install the development dependencies:
python3 -m pip install -r requirements-dev.txt
```

Install the pre-commit hooks:

```
pre-commit install
```

Run the tests:

```
Expand Down Expand Up @@ -105,4 +111,4 @@ Run `black` to format a file:

```
python3 -m black <path-to-file>
```
```
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ The repo includes sample data so it's ready to try end to end. In this sample ap
#### To Run Locally

* [Azure Developer CLI](https://aka.ms/azure-dev/install)
* [Python 3+](https://www.python.org/downloads/)
* [Python 3.9+](https://www.python.org/downloads/)
* **Important**: Python and the pip package manager must be in the path in Windows for the setup scripts to work.
* **Important**: Ensure you can run `python --version` from console. On Ubuntu, you might need to run `sudo apt install python-is-python3` to link `python` to `python3`.
* [Node.js 14+](https://nodejs.org/en/download/)
* [Git](https://git-scm.com/downloads)
* [Powershell 7+ (pwsh)](https://github.com/powershell/powershell) - For Windows users only.
* **Important**: Ensure you can run `pwsh.exe` from a PowerShell command. If this fails, you likely need to upgrade PowerShell.

>NOTE: Your Azure Account must have `Microsoft.Authorization/roleAssignments/write` permissions, such as [User Access Administrator](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#user-access-administrator) or [Owner](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#owner).
>NOTE: Your Azure Account must have `Microsoft.Authorization/roleAssignments/write` permissions, such as [User Access Administrator](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#user-access-administrator) or [Owner](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#owner).
#### To Run in GitHub Codespaces or VS Code Remote Containers

Expand All @@ -61,7 +61,7 @@ Execute the following command, if you don't have any pre-existing Azure services

1. Run `azd up` - This will provision Azure resources and deploy this sample to those resources, including building the search index based on the files found in the `./data` folder.
* For the target location, the regions that currently support the models used in this sample are **East US**, **South Central US**, and **West Europe**. For an up-to-date list of regions and models, check [here](https://learn.microsoft.com/azure/cognitive-services/openai/concepts/models#model-summary-table-and-region-availability).
1. After the application has been successfully deployed you will see a URL printed to the console. Click that URL to interact with the application in your browser.
1. After the application has been successfully deployed you will see a URL printed to the console. Click that URL to interact with the application in your browser.

It will look like the following:

Expand Down Expand Up @@ -157,5 +157,5 @@ Here are the most common failure scenarios and solutions:

1. You see `CERTIFICATE_VERIFY_FAILED` when the `prepdocs.py` script runs. That's typically due to incorrect SSL certificates setup on your machine. Try the suggestions in this [StackOverflow answer](https://stackoverflow.com/questions/35569042/ssl-certificate-verify-failed-with-python3/43855394#43855394).

1. After running `azd up` and visiting the website, you see a '404 Not Found' in the browser. Wait 10 minutes and try again, as it might be still starting up. Then try running `azd deploy` and wait again. If you still encounter errors with the deployed app, consult these [tips for debugging Flask app deployments](http://blog.pamelafox.org/2023/06/tips-for-debugging-flask-deployments-to.html)
1. After running `azd up` and visiting the website, you see a '404 Not Found' in the browser. Wait 10 minutes and try again, as it might be still starting up. Then try running `azd deploy` and wait again. If you still encounter errors with the deployed app, consult these [tips for debugging App Service app deployments](http://blog.pamelafox.org/2023/06/tips-for-debugging-flask-deployments-to.html)
and file an issue if the error logs don't help you resolve the issue.
Loading

0 comments on commit d6dab39

Please sign in to comment.