Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
[PLUGIN]: Initial FastAPI Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Mar 6, 2024
1 parent e852df4 commit bc91776
Show file tree
Hide file tree
Showing 34 changed files with 2,679 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
exclude = fixtures, __jac_gen__
plugins = flake8_import_order, flake8_docstrings, flake8_comprehensions, flake8_bugbear, flake8_annotations, pep8_naming, flake8_simplify
max-line-length = 120
ignore = E203, W503, ANN101, ANN102
25 changes: 25 additions & 0 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Linting and Pre-commit checks

on:
pull_request:
push:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit hooks
run: pre-commit run --all-files
45 changes: 45 additions & 0 deletions .github/workflows/run_plugin_pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Run Plugin Tests

on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-replica-set: test-rs

- name: Check out code
uses: actions/checkout@v2

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12.2

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .
- name: Run tests
run: |
jac run jaclang_jaseci/tests/fixtures/simple_walkerapi.jac &;
limit=5; count=0; while [ $(curl -s -o /dev/null -w "%{http_code}" http://0.0.0.0:8000/healthz) -ne 200 ] && [ $count -lt $limit ]; do sleep 1; ((count++)); done; if [ $count -ge 5 ]; then echo "Attempted $count times, exiting..."; exit 1; fi
pytest
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Django #
*.log
*.pot
*.pyc
__pycache__
db.sqlite3
media
migrations
venv
__jac_gen__/
*.jir

# Distribution / packaging
.Python
play/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Others #
.env
.coverage
.session
.DS_Store
build
.vscode
*Zone.Identifier
.DS_Store
parser.out
codegen_output*

*.rdb
node_modules
out.dot
out.txt

# Mypy files #
.mypy_cache*
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-json
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [pep8-naming, flake8_import_order, flake8_docstrings, flake8_comprehensions, flake8_bugbear, flake8_annotations, flake8_simplify]
exclude: "examples|vendor"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
exclude: 'venv|__jac_gen__|tests|stubs|support|vendor|examples/reference|setup.py'
args:
- --follow-imports=silent
- --ignore-missing-imports
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DEPENDENCIES

pip install jaclang black pre-commit pytest flake8 flake8_import_order flake8_docstrings flake8_comprehensions flake8_bugbear flake8_annotations pep8_naming flake8_simplify
pre-commit install
12 changes: 12 additions & 0 deletions jaclang_jaseci/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""JacLang FastAPI."""

from dotenv import load_dotenv

from .core import FastAPI


load_dotenv()

start = FastAPI.start

__all__ = ["FastAPI", "start"]
6 changes: 6 additions & 0 deletions jaclang_jaseci/collections/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Collection Integration References."""

from .base import BaseCollection
from .user import UserCollection

__all__ = ["BaseCollection", "UserCollection"]
Loading

0 comments on commit bc91776

Please sign in to comment.