-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from MaskerPRC/main
Add code starter
- Loading branch information
Showing
38 changed files
with
840 additions
and
2 deletions.
There are no files selected for viewing
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,31 @@ | ||
root = true | ||
|
||
[*] | ||
tab_width = 4 | ||
end_of_line = lf | ||
max_line_length = 88 | ||
ij_visual_guides = 88 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{js,py,html}] | ||
charset = utf-8 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[.flake8] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
ij_python_from_import_parentheses_force_if_multiline = true |
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,5 @@ | ||
# create new with next to this one, with name .env | ||
|
||
RELOAD=True | ||
|
||
BASE_URL=http://localhost:8000 |
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,93 @@ | ||
[flake8] | ||
max-complexity = 6 | ||
inline-quotes = double | ||
max-line-length = 88 | ||
extend-ignore = E203 | ||
docstring_style=sphinx | ||
|
||
ignore = | ||
; Found `f` string | ||
WPS305, | ||
; Missing docstring in public module | ||
D100, | ||
; Missing docstring in magic method | ||
D105, | ||
; Missing docstring in __init__ | ||
D107, | ||
; Found `__init__.py` module with logic | ||
WPS412, | ||
; Found class without a base class | ||
WPS306, | ||
; Missing docstring in public nested class | ||
D106, | ||
; First line should be in imperative mood | ||
D401, | ||
; Found `__init__.py` module with logic | ||
WPS326, | ||
; Found string constant over-use | ||
WPS226, | ||
; Found upper-case constant in a class | ||
WPS115, | ||
; Found nested function | ||
WPS602, | ||
; Found method without arguments | ||
WPS605, | ||
; Found overused expression | ||
WPS204, | ||
; Found too many module members | ||
WPS202, | ||
; Found too high module cognitive complexity | ||
WPS232, | ||
; line break before binary operator | ||
W503, | ||
; Found module with too many imports | ||
WPS201, | ||
; Inline strong start-string without end-string. | ||
RST210, | ||
; Found nested class | ||
WPS431, | ||
; Found wrong module name | ||
WPS100, | ||
; Found too many methods | ||
WPS214, | ||
; Found too long ``try`` body | ||
WPS229, | ||
; Found unpythonic getter or setter | ||
WPS615, | ||
; Found a line that starts with a dot | ||
WPS348, | ||
; Found complex default value (for dependency injection) | ||
WPS404, | ||
; not perform function calls in argument defaults (for dependency injection) | ||
B008, | ||
; line to long | ||
E501, | ||
|
||
per-file-ignores = | ||
; all tests | ||
test_*.py,tests.py,tests_*.py,*/tests/*,conftest.py: | ||
; Use of assert detected | ||
S101, | ||
; Found outer scope names shadowing | ||
WPS442, | ||
; Found too many local variables | ||
WPS210, | ||
; Found magic number | ||
WPS432, | ||
; Missing parameter(s) in Docstring | ||
DAR101, | ||
|
||
; all init files | ||
__init__.py: | ||
; ignore not used imports | ||
F401, | ||
; ignore import with wildcard | ||
F403, | ||
; Found wrong metadata variable | ||
WPS410, | ||
|
||
exclude = | ||
./.git, | ||
./venv, | ||
migrations, | ||
./var, |
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,144 @@ | ||
### Python template | ||
|
||
.idea/ | ||
.vscode/ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
.python-version |
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,30 @@ | ||
# 注意事项 | ||
|
||
## 前置条件 | ||
- 需要安装qdrant本地服务 | ||
```shell | ||
# docker环境准备 | ||
sudo apt update | ||
sudo apt install docker.io | ||
sudo systemctl start docker | ||
sudo systemctl enable docker | ||
# 安装 | ||
sudo docker run -p 6333:6333 -d --name qdrant qdrant/qdrant | ||
# 测试 | ||
curl http://localhost:6333 | ||
``` | ||
|
||
## 本地启动 | ||
```shell | ||
# 安装依赖 | ||
cd infra_ai_service/ | ||
pip install -r requirements.txt | ||
# 测试 | ||
pytest . | ||
# 启动 | ||
python infra_ai_service/server.py | ||
``` | ||
|
||
|
||
## 本地访问 | ||
- 浏览器打开 http://localhost:8000/ 显示 {"Hello":"World"} |
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 +1,82 @@ | ||
# infraAIService | ||
# FastAPI Starter Project | ||
|
||
Project includes: | ||
|
||
- `fastapi` | ||
|
||
## | ||
|
||
## Models | ||
|
||
Check db/models and migrations, there is one example. | ||
|
||
## Using docker | ||
|
||
Setup env variables in `app/core/.env` using `app/core/.env-example` | ||
|
||
#### Install and run | ||
|
||
```bash | ||
docker-compose up -d web | ||
|
||
# you can track logs with: | ||
docker-compose logs -f --tail=100 web | ||
``` | ||
|
||
Go to: http://localhost:8000/api/docs/ | ||
|
||
#### Tests | ||
|
||
Run tests | ||
|
||
```bash | ||
docker-compose exec web pytest . | ||
``` | ||
|
||
## Without docker | ||
|
||
#### Install | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
Setup env variables in `app/core/.env`. | ||
|
||
#### Run | ||
|
||
```bash | ||
cd infra_ai_service/ | ||
python infra_ai_service/server.py | ||
``` | ||
|
||
Go to: http://localhost:8000/api/docs/ | ||
|
||
#### Tests | ||
|
||
Run tests | ||
|
||
```bash | ||
cd infra_ai_service | ||
pytest . | ||
``` | ||
|
||
## Environment Variables | ||
|
||
To run this project, you will need to add the following environment variables to your app/core/.env file | ||
|
||
`BASE_URL` - default: http://localhost:8000 | ||
|
||
`RELOAD` - default: false | ||
|
||
`DB_HOST` - default: localhost | ||
|
||
`DB_PORT` - default: 5432 | ||
|
||
`DB_USER` - default: postgres | ||
|
||
`DB_PASS` - default: postgres | ||
|
||
`DB_BASE` - default: db | ||
|
||
`DB_ECHO` - default: false |
Oops, something went wrong.