Skip to content

Commit 46421ca

Browse files
committed
config and run pre-commit
1 parent 726b012 commit 46421ca

21 files changed

+1257
-319
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ CORS_ORIGINS=localhost
2020
DETA_PROJECT_KEY=
2121

2222
# OpenAI
23-
OPENAI_API_KEY=
23+
OPENAI_API_KEY=

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ repos:
5151
- "--no-warn-return-any"
5252

5353
- repo: https://github.com/PyCQA/autoflake
54-
rev: 'v2.0.0'
54+
rev: 'v2.2.1'
5555
hooks:
5656
- id: autoflake
5757
args:
@@ -62,8 +62,8 @@ repos:
6262
- "--remove-all-unused-imports"
6363
- "--remove-unused-variables"
6464
- "--ignore-init-module-imports"
65-
66-
- repo: https://github.com/PyCQA/pylint
67-
rev: 'v3.0.0-a5'
68-
hooks:
69-
- id: pylint
65+
# TODO
66+
# - repo: https://github.com/PyCQA/pylint
67+
# rev: 'v3.0.0-a5'
68+
# hooks:
69+
# - id: pylint

app.json

Lines changed: 39 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,42 @@
11
{
2-
"buildpacks": [
3-
{
4-
"url": "heroku/python"
5-
}
6-
],
7-
"description": "A Fully Async-based backend for Code Inbox built using FastAPI, ODMantic, MongoDB, Deta, and friends.",
8-
"env": {
9-
"DEBUG": {
10-
"description": "This environment variable defines the debug level.`` means production. `info` to access the docs.",
11-
"required": false,
12-
"value": ""
2+
"buildpacks": [{"url": "heroku/python"}],
3+
"description": "A Fully Async-based backend for Code Inbox built using FastAPI, ODMantic, MongoDB, Deta, and friends.",
4+
"env": {
5+
"DEBUG": {
6+
"description": "This environment variable defines the debug level.`` means production. `info` to access the docs.",
7+
"required": false,
8+
"value": "",
9+
},
10+
"CORS_ORIGINS": {
11+
"description": "Comma separated urls of the deployed client.",
12+
"required": true,
13+
},
14+
"DETA_PROJECT_KEY": {
15+
"description": "The project key of your Deta account.",
16+
"required": true,
17+
},
18+
"MONGODB_USERNAME": {
19+
"description": "This is the user name you'll be creating for remote accesses.",
20+
"required": true,
21+
},
22+
"MONGODB_PASSWORD": {
23+
"description": "The corresponding password for that user.",
24+
"required": true,
25+
},
26+
"MONGODB_HOST": {
27+
"description": "Your remote MongoDB server's domain name.",
28+
"required": true,
29+
},
30+
"MONGODB_DATABASE": {
31+
"description": "The name of the database you want to access, in our case, the `shop` database.",
32+
"required": false,
33+
"value": "shop",
34+
},
1335
},
14-
"CORS_ORIGINS": {
15-
"description": "Comma separated urls of the deployed client.",
16-
"required": true
17-
},
18-
"DETA_PROJECT_KEY": {
19-
"description": "The project key of your Deta account.",
20-
"required": true
21-
},
22-
"MONGODB_USERNAME": {
23-
"description": "This is the user name you'll be creating for remote accesses.",
24-
"required": true
25-
},
26-
"MONGODB_PASSWORD": {
27-
"description": "The corresponding password for that user.",
28-
"required": true
29-
},
30-
"MONGODB_HOST": {
31-
"description": "Your remote MongoDB server's domain name.",
32-
"required": true
33-
},
34-
"MONGODB_DATABASE": {
35-
"description": "The name of the database you want to access, in our case, the `shop` database.",
36-
"required": false,
37-
"value": "shop"
38-
}
39-
},
40-
"formation": {
41-
"web": {
42-
"quantity": 1,
43-
"size": "free"
44-
}
45-
},
46-
"image": "heroku/python",
47-
"keywords": [
48-
"fastapi",
49-
"mongodb",
50-
"deta",
51-
"api"
52-
],
53-
"name": "code-inbox-server",
54-
"repository": "https://github.com/wiseaidev/code-inbox-server",
55-
"success_url": "/docs"
36+
"formation": {"web": {"quantity": 1, "size": "free"}},
37+
"image": "heroku/python",
38+
"keywords": ["fastapi", "mongodb", "deta", "api"],
39+
"name": "code-inbox-server",
40+
"repository": "https://github.com/wiseaidev/code-inbox-server",
41+
"success_url": "/docs",
5642
}

poetry.lock

Lines changed: 729 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ apscheduler = "^3.10.4"
3737

3838
[tool.poetry.group.dev.dependencies]
3939
pytest = "^7.2.0"
40+
flake8 = "^6.1.0"
41+
coverage = "^7.3.1"
42+
mypy = "^1.5.1"
43+
pytest-cov = "^4.1.0"
44+
tox = "^4.11.3"
45+
isort = "^5.12.0"
46+
black = "^23.9.1"
47+
pre-commit = "^3.4.0"
48+
httpx = "^0.25.0"
49+
pylint = "^2.17.6"
50+
autoflake = "^2.2.1"
4051

4152
[build-system]
4253
requires = ["poetry-core"]

src/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
users,
99
utils,
1010
)
11-
1211
from src.main import (
1312
get_app,
14-
serve
13+
serve,
1514
)
15+
1616
__author__ = """Mahmoud Harmouch"""
1717
__email__ = "oss@wiseai.com"
1818
__version__ = "0.1.0"

src/config.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ class Settings(BaseSettings):
4949
DEBUG: str = os.getenv("DEBUG") # type: ignore
5050
CORS_ORIGINS: str = os.getenv("CORS_ORIGINS") # type: ignore
5151
DETA_PROJECT_KEY: str = os.getenv("DETA_PROJECT_KEY") # type: ignore
52-
NYLAS_CLIENT_ID: str = os.getenv("NYLAS_CLIENT_ID")
53-
NYLAS_CLIENT_SECRET: str = os.getenv("NYLAS_CLIENT_SECRET")
54-
NYLAS_API_SERVER: str = os.getenv("NYLAS_API_SERVER")
55-
CLIENT_URI: str = os.getenv("CLIENT_URI")
56-
NYLAS_SYSTEM_TOKEN: str = os.getenv("NYLAS_SYSTEM_TOKEN")
57-
OPENAI_API_KEY: str = os.getenv("OPENAI_API_KEY")
58-
52+
NYLAS_CLIENT_ID: str = os.getenv("NYLAS_CLIENT_ID") # type: ignore
53+
NYLAS_CLIENT_SECRET: str = os.getenv("NYLAS_CLIENT_SECRET") # type: ignore
54+
NYLAS_API_SERVER: str = os.getenv("NYLAS_API_SERVER") # type: ignore
55+
CLIENT_URI: str = os.getenv("CLIENT_URI") # type: ignore
56+
NYLAS_SYSTEM_TOKEN: str = os.getenv("NYLAS_SYSTEM_TOKEN") # type: ignore
57+
OPENAI_API_KEY: str = os.getenv("OPENAI_API_KEY") # type: ignore
58+
5959
class Config: # pylint: disable=R0903
6060
"""
6161
A class used to set Pydantic configuration for env vars.

src/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
)
1212
import logging
1313
from typing import (
14-
Any,
1514
Dict,
1615
)
1716
import uvicorn
18-
from src.nylas import (
19-
router as nylas_router,
20-
)
17+
2118
from src.config import (
2219
settings,
2320
)
21+
from src.nylas import (
22+
router as nylas_router,
23+
)
2424
from src.users import (
2525
router as users_router,
2626
)
@@ -108,8 +108,10 @@ async def root() -> Dict[str, str]:
108108

109109
return app
110110

111+
111112
code_app = get_app()
112113

114+
113115
def serve() -> None:
114116
"""
115117
A method that run a uvicorn command.
@@ -125,6 +127,7 @@ def serve() -> None:
125127
except Exception as err:
126128
logger.error(repr(err))
127129

130+
128131
__all__ = [
129132
"serve",
130133
"code_app",

src/nylas/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"""
44

55
from src.nylas import (
6+
crud,
7+
models,
68
router,
79
schemas,
8-
crud,
9-
models
1010
)
1111

1212
__all__ = ["crud", "models", "router", "schemas"]

0 commit comments

Comments
 (0)