-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cc generated projects without auth
- Loading branch information
1 parent
71a307b
commit e54c58e
Showing
123 changed files
with
2,991 additions
and
5 deletions.
There are no files selected for viewing
14 changes: 13 additions & 1 deletion
14
...rc/getting_started/fastapi/my_fastagency_app/my_fastagency_app/deployment/main_2_mesop.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
from fastagency.adapters.fastapi import FastAPIAdapter | ||
from fastagency.app import FastAgency | ||
from fastagency.ui.mesop import MesopUI | ||
from fastagency.ui.mesop.auth.basic_auth import BasicAuth | ||
|
||
fastapi_url = "http://localhost:8008" | ||
|
||
provider = FastAPIAdapter.create_provider( | ||
fastapi_url=fastapi_url, | ||
) | ||
ui = MesopUI() | ||
auth = BasicAuth( | ||
# TODO: Replace `allowed_users` with the desired usernames and their | ||
# bcrypt-hashed passwords. One way to generate bcrypt-hashed passwords | ||
# is by using online tools such as https://bcrypt.online | ||
# Default password for all users is `password` | ||
allowed_users={ | ||
"admin": "$2y$10$ZgcGQlsvMoMRmmW4Y.nUVuVHc.vOJsOA7iXAPXWPFy9DX2S7oeTDa", # nosemgrep: generic.secrets.security.detected-bcrypt-hash.detected-bcrypt-hash | ||
"[email protected]": "$2y$10$ZgcGQlsvMoMRmmW4Y.nUVuVHc.vOJsOA7iXAPXWPFy9DX2S7oeTDa", # nosemgrep: generic.secrets.security.detected-bcrypt-hash.detected-bcrypt-hash | ||
}, | ||
) | ||
|
||
ui = MesopUI(auth=auth) | ||
|
||
|
||
app = FastAgency( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
7 changes: 7 additions & 0 deletions
7
...src/getting_started/fastapi/my_fastagency_app_without_auth/.devcontainer/devcontainer.env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CONTAINER_PREFIX=${USER} | ||
|
||
# LLM keys | ||
# Set atleast one of the following keys | ||
OPENAI_API_KEY=${OPENAI_API_KEY} | ||
TOGETHER_API_KEY=${TOGETHER_API_KEY} | ||
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} |
66 changes: 66 additions & 0 deletions
66
...rc/getting_started/fastapi/my_fastagency_app_without_auth/.devcontainer/devcontainer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"name": "python-3.12", | ||
"dockerComposeFile": [ | ||
"./docker-compose.yml" | ||
], | ||
"service": "python-3.12-my_fastagency_app_without_auth", | ||
|
||
"secrets": { | ||
"OPENAI_API_KEY": { | ||
"description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." | ||
}, | ||
"TOGETHER_API_KEY": { | ||
"description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." | ||
}, | ||
"ANTHROPIC_API_KEY": { | ||
"description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." | ||
} | ||
}, | ||
"shutdownAction": "stopCompose", | ||
"workspaceFolder": "/workspaces/my_fastagency_app_without_auth", | ||
// "runArgs": [], | ||
"remoteEnv": {}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"installOhMyZsh": true, | ||
"configureZshAsDefaultShell": true, | ||
"username": "vscode", | ||
"userUid": "1000", | ||
"userGid": "1000" | ||
// "upgradePackages": "true" | ||
}, | ||
"ghcr.io/devcontainers/features/git:1": {}, | ||
"ghcr.io/devcontainers/features/git-lfs:1": {}, | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {} | ||
}, | ||
"updateContentCommand": "bash .devcontainer/setup.sh", | ||
"postCreateCommand": [], | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"python.linting.enabled": true, | ||
"python.testing.pytestEnabled": true, | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "always" | ||
}, | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.vscode-pylance" | ||
}, | ||
"editor.rulers": [ | ||
80 | ||
] | ||
}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-toolsai.jupyter", | ||
"ms-toolsai.vscode-jupyter-cell-tags", | ||
"ms-toolsai.jupyter-keymap", | ||
"ms-toolsai.jupyter-renderers", | ||
"ms-toolsai.vscode-jupyter-slideshow", | ||
"ms-python.vscode-pylance" | ||
] | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...c/getting_started/fastapi/my_fastagency_app_without_auth/.devcontainer/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: '3' | ||
|
||
services: | ||
# nosemgrep: yaml.docker-compose.security.writable-filesystem-service.writable-filesystem-service | ||
python-3.12-my_fastagency_app_without_auth: | ||
image: mcr.microsoft.com/devcontainers/python:3.12 | ||
container_name: my_fastagency_app_without_auth-${USER}-python-3.12 | ||
volumes: | ||
- ../:/workspaces/my_fastagency_app_without_auth:cached | ||
command: sleep infinity | ||
|
||
env_file: | ||
- ./devcontainer.env | ||
security_opt: | ||
- no-new-privileges:true | ||
networks: | ||
- my_fastagency_app_without_auth-network | ||
|
||
networks: | ||
my_fastagency_app_without_auth-network: | ||
name: my_fastagency_app_without_auth-${USER}-network |
17 changes: 17 additions & 0 deletions
17
docs/docs_src/getting_started/fastapi/my_fastagency_app_without_auth/.devcontainer/setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# update pip | ||
pip install --upgrade pip | ||
|
||
# install dev packages | ||
pip install -e ".[dev]" | ||
|
||
# install fly.io CLI and set fly.io CLI PATH in bashrc and zshrc | ||
curl -L https://fly.io/install.sh | sh | ||
echo 'export FLYCTL_INSTALL="/home/vscode/.fly"' | tee -a ~/.bashrc ~/.zshrc | ||
echo 'export PATH="$FLYCTL_INSTALL/bin:$PATH"' | tee -a ~/.bashrc ~/.zshrc | ||
|
||
# check OPENAI_API_KEY environment variable is set | ||
if [ -z "$OPENAI_API_KEY" ]; then | ||
echo | ||
echo -e "\033[33mWarning: OPENAI_API_KEY environment variable is not set.\033[0m" | ||
echo | ||
fi |
Empty file.
17 changes: 17 additions & 0 deletions
17
docs/docs_src/getting_started/fastapi/my_fastagency_app_without_auth/.github/dependabot.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
# Python | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
49 changes: 49 additions & 0 deletions
49
...ocs_src/getting_started/fastapi/my_fastagency_app_without_auth/.github/workflows/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
name: Test | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
fail-fast: false | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
cache-dependency-path: pyproject.toml | ||
- uses: actions/cache@v4 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v03 | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: pip install .[testing] | ||
- name: Check for OPENAI_API_KEY | ||
run: | | ||
if [ -z "${{ secrets.OPENAI_API_KEY }}" ]; then | ||
echo "Error: OPENAI_API_KEY is not set in GitHub secrets." | ||
echo "Please set the OPENAI_API_KEY secret in your repository settings." | ||
echo "Follow the instructions here:" | ||
echo "https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository" | ||
exit 1 | ||
fi | ||
- name: Run tests | ||
run: pytest | ||
env: | ||
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} |
18 changes: 18 additions & 0 deletions
18
docs/docs_src/getting_started/fastapi/my_fastagency_app_without_auth/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
__pycache__ | ||
dist | ||
.idea | ||
venv* | ||
.venv* | ||
.env | ||
.env* | ||
*.lock | ||
.vscode | ||
.pypirc | ||
.pytest_cache | ||
.ruff_cache | ||
.mypy_cache | ||
.coverage* | ||
.cache | ||
htmlcov | ||
token | ||
.DS_Store |
38 changes: 38 additions & 0 deletions
38
docs/docs_src/getting_started/fastapi/my_fastagency_app_without_auth/.pre-commit-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
|
||
- repo: local | ||
hooks: | ||
- id: lint | ||
name: Linter | ||
entry: "scripts/lint-pre-commit.sh" | ||
language: python | ||
# language_version: python3.12 | ||
types: [python] | ||
require_serial: true | ||
verbose: true | ||
|
||
- repo: local | ||
hooks: | ||
- id: static-analysis | ||
name: Static analysis | ||
entry: "scripts/static-pre-commit.sh" | ||
language: python | ||
# language_version: python3.12 | ||
types: [python] | ||
require_serial: true | ||
verbose: true | ||
|
||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.5.0 | ||
hooks: | ||
- id: detect-secrets | ||
args: ["--baseline", ".secrets.baseline"] |
Oops, something went wrong.