Skip to content

Commit 3e84c56

Browse files
Eugene ShershenEugene Shershen
Eugene Shershen
authored and
Eugene Shershen
committed
refactoring, pre-commit added
1 parent 5b16d47 commit 3e84c56

File tree

8 files changed

+66
-17
lines changed

8 files changed

+66
-17
lines changed

.flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
22
exclude = .venv
33
max-line-length = 100
4-
extend-ignore = E203
4+
extend-ignore = E203

.github/workflows/ci.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
push:
77
branches:
88
- main
9-
9+
1010
jobs:
1111
test:
1212
name: test
@@ -35,35 +35,35 @@ jobs:
3535
uses: actions/setup-python@v1
3636
with:
3737
python-version: ${{ matrix.python }}
38-
38+
3939
- name: Install dependencies
4040
run: |
4141
python -m pip install --upgrade pip wheel
4242
pip install -r requirements.txt
43-
43+
4444
# test all the builds apart from linux_3.8...
4545
- name: Test with pytest
4646
if: matrix.build != 'linux_3.8'
4747
run: pytest
48-
48+
4949
# only do the test coverage for linux_3.8
5050
- name: Produce coverage report
5151
if: matrix.build == 'linux_3.8'
5252
run: pytest --cov=fastapi_async_sqlalchemy --cov-report=xml
53-
53+
5454
- name: Upload coverage report
5555
if: matrix.build == 'linux_3.8'
5656
uses: codecov/codecov-action@v1
5757
with:
5858
file: ./coverage.xml
59-
59+
6060
lint:
6161
name: lint
6262
runs-on: ubuntu-latest
6363
steps:
6464
- name: Checkout repository
6565
uses: actions/checkout@v2
66-
66+
6767
- name: Set up Python
6868
uses: actions/setup-python@v1
6969
with:
@@ -86,12 +86,12 @@ jobs:
8686
uses: actions/setup-python@v1
8787
with:
8888
python-version: 3.7
89-
89+
9090
- name: Install dependencies
91-
# isort needs all of the packages to be installed so it can
91+
# isort needs all of the packages to be installed so it can
9292
# tell which are third party and which are first party
9393
run: pip install -r requirements.txt
94-
94+
9595
- name: Check formatting of imports
9696
run: isort --check-only --diff --verbose
9797

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ __pycache__/
1111
htmlcov/
1212
test.py
1313
*.egg-info
14-
coverage.xml
14+
coverage.xml

.pre-commit-config.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
exclude: (alembic|build|dist|docker|esign|kubernetes|migrations)
2+
3+
default_language_version:
4+
python: python3.7
5+
6+
repos:
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v4.0.1
9+
hooks:
10+
- id: end-of-file-fixer
11+
- id: trailing-whitespace
12+
- repo: https://github.com/asottile/pyupgrade
13+
rev: v2.28.0
14+
hooks:
15+
- id: pyupgrade
16+
args:
17+
- --py37-plus
18+
- repo: https://github.com/myint/autoflake
19+
rev: v1.4
20+
hooks:
21+
- id: autoflake
22+
args:
23+
- --in-place
24+
- --remove-all-unused-imports
25+
- --expand-star-imports
26+
- --remove-duplicate-keys
27+
- --remove-unused-variables
28+
- repo: https://github.com/PyCQA/isort
29+
rev: 5.9.3
30+
hooks:
31+
- id: isort
32+
- repo: https://github.com/psf/black
33+
rev: 21.9b0
34+
hooks:
35+
- id: black
36+
- repo: https://github.com/PyCQA/flake8
37+
rev: 3.9.2
38+
hooks:
39+
- id: flake8
40+
args:
41+
- --max-line-length=100
42+
- --ignore=E203, E501, W503
43+
- repo: https://github.com/pre-commit/mirrors-mypy
44+
rev: v0.910
45+
hooks:
46+
- id: mypy
47+
additional_dependencies:
48+
- pydantic
49+
- types-ujson

.pyup.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# autogenerated pyup.io config file
1+
# autogenerated pyup.io config file
22
# see https://pyup.io/docs/configuration/ for all available options
33

44
schedule: ''

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
### Description
1111

12-
FastAPI-Async-SQLAlchemy provides middleware for FastAPI and SQLAlchemy using async AsyncSession and async engine.
12+
FastAPI-Async-SQLAlchemy provides middleware for FastAPI and SQLAlchemy using async AsyncSession and async engine.
1313
Based on FastAPI-SQLAlchemy
1414

1515
### Install
@@ -34,7 +34,7 @@ from sqlalchemy import table
3434

3535
app = FastAPI()
3636
app.add_middleware(
37-
SQLAlchemyMiddleware,
37+
SQLAlchemyMiddleware,
3838
db_url="postgresql+asyncpg://user:[email protected]:5432/primary_db"
3939
)
4040

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ multi_line_output = 3
1616
include_trailing_comma = true
1717
force_grid_wrap = 0
1818
use_parentheses = true
19-
line_length = 100
19+
line_length = 100

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from setuptools import setup
55

66
with open(Path("fastapi_async_sqlalchemy") / "__init__.py", encoding="utf-8") as fh:
7-
version = re.search(r'__version__ = "(.*?)"', fh.read(), re.M).group(1)
7+
version = re.search(r'__version__ = "(.*?)"', fh.read(), re.M).group(1) # type: ignore
88

99
with open("README.md", encoding="utf-8") as fh:
1010
long_description = fh.read()

0 commit comments

Comments
 (0)