update Makefile

This commit is contained in:
long2ice
2020-07-05 23:51:04 +08:00
parent 0021487167
commit 3ada1a1b1c
9 changed files with 21 additions and 28 deletions

View File

@@ -20,18 +20,13 @@ deps:
@poetry install --no-root
style: deps
isort -rc $(checkfiles)
isort -src $(checkfiles)
black $(black_opts) $(checkfiles)
check: deps
ifneq ($(shell which black),)
black --check $(black_opts) $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)
endif
flake8 $(checkfiles)
mypy $(checkfiles)
pylint -d C,W,R $(checkfiles)
bandit -r $(checkfiles)
python setup.py check -mrs
test: deps
$(py_warn) py.test
@@ -39,9 +34,6 @@ test: deps
build: deps
@poetry build
publish: deps
@poetry publish
docs: deps
@pip install -r docs/requirements.txt
@sphinx-build docs/ docs/_build

View File

@@ -59,7 +59,7 @@ app = create_app()
@app.on_event("startup")
async def start_up():
admin_app.init(
admin_app.init( # nosec
admin_secret="test",
permission=True,
site=Site(

View File

@@ -6,4 +6,4 @@
</div>
</div>
<h2>Stargazers over time</h2>
<div><img src="https://starchart.cc/long2ice/fastapi-admin.svg"></div>
<div style="width: 100vw"><img src="https://starchart.cc/long2ice/fastapi-admin.svg" alt="Stargazers over time"></div>

View File

@@ -1,4 +1,4 @@
from . import routes
from . import routes # noqa: F401
def version():

View File

@@ -66,7 +66,7 @@ async def createsuperuser(args):
except Exception as e:
Logger.error(f"Create superuser {username} error,{e}")
except (EOFError, KeyboardInterrupt):
Logger.success(f"Exit success!")
Logger.success("Exit success!")
return

View File

@@ -77,7 +77,7 @@ class AdminApp(FastAPI):
def _build_content_menus(self) -> List[Menu]:
models = deepcopy(self.models) # type:Dict[str,Type[Model]]
models.pop("Role", None)
models.pop("User", None)
models.pop(self.user_model.__name__, None)
models.pop("Permission", None)
menus = []
for k, v in models.items():
@@ -86,7 +86,7 @@ class AdminApp(FastAPI):
url=f"/rest/{k}",
fields_type=self._get_model_fields_type(v),
icon="icon-list",
bulk_actions=[{"value": "delete", "text": "delete_all",},],
bulk_actions=[{"value": "delete", "text": "delete_all"}],
)
menus.append(menu)
return menus
@@ -299,7 +299,8 @@ class AdminApp(FastAPI):
async def get_resource(
self, resource: str, exclude_pk=False, exclude_m2m_field=True, exclude_actions=False
) -> Resource:
assert self._inited, "must call init() first!"
if not self._inited:
raise Exception("must call init() first!")
model = self.models.get(resource) # type:Type[Model]
model_describe = model.describe(serializable=False)
pk, fields, search_fields = await self._build_resource_from_model_describe(

View File

@@ -31,7 +31,7 @@ class Menu(BaseModel):
# active table export
export: bool = True
actions: Optional[Dict]
bulk_actions: List[Dict] = [{"value": "delete", "text": "delete_all",}]
bulk_actions: List[Dict] = [{"value": "delete", "text": "delete_all"}]
Menu.update_forward_refs()

20
poetry.lock generated
View File

@@ -238,14 +238,12 @@ category = "dev"
description = "A Python utility / library to sort Python imports."
name = "isort"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "4.3.21"
python-versions = ">=3.6,<4.0"
version = "5.0.3"
[package.extras]
pipfile = ["pipreqs", "requirementslib"]
pyproject = ["toml"]
requirements = ["pipreqs", "pip-api"]
xdg_home = ["appdirs (>=1.4.0)"]
pipfile_deprecated_finder = ["pipreqs", "requirementslib", "tomlkit (>=0.5.3)"]
requirements_deprecated_finder = ["pipreqs", "pip-api"]
[[package]]
category = "main"
@@ -491,7 +489,7 @@ description = "Add .env support to your django/flask apps in development and dep
name = "python-dotenv"
optional = false
python-versions = "*"
version = "0.13.0"
version = "0.14.0"
[package.extras]
cli = ["click (>=5.0)"]
@@ -790,8 +788,8 @@ iso8601 = [
{file = "iso8601-0.1.12.tar.gz", hash = "sha256:49c4b20e1f38aa5cf109ddcd39647ac419f928512c869dc01d5c7098eddede82"},
]
isort = [
{file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"},
{file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"},
{file = "isort-5.0.3-py3-none-any.whl", hash = "sha256:3fbfad425b0a08a2969c5e1821d88785c210a08656c029c28931a1620f2d0f12"},
{file = "isort-5.0.3.tar.gz", hash = "sha256:4c48d4cd773a6226baaaa176839e6f7ff82ef7c7842f6c54374fe2b14df4024b"},
]
jinja2 = [
{file = "Jinja2-2.11.2-py2.py3-none-any.whl", hash = "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"},
@@ -918,8 +916,8 @@ pytest-xdist = [
{file = "pytest_xdist-1.32.0-py2.py3-none-any.whl", hash = "sha256:ba5ec9fde3410bd9a116ff7e4f26c92e02fa3d27975ef3ad03f330b3d4b54e91"},
]
python-dotenv = [
{file = "python-dotenv-0.13.0.tar.gz", hash = "sha256:3b9909bc96b0edc6b01586e1eed05e71174ef4e04c71da5786370cebea53ad74"},
{file = "python_dotenv-0.13.0-py2.py3-none-any.whl", hash = "sha256:25c0ff1a3e12f4bde8d592cc254ab075cfe734fc5dd989036716fd17ee7e5ec7"},
{file = "python-dotenv-0.14.0.tar.gz", hash = "sha256:8c10c99a1b25d9a68058a1ad6f90381a62ba68230ca93966882a4dbc3bc9c33d"},
{file = "python_dotenv-0.14.0-py2.py3-none-any.whl", hash = "sha256:c10863aee750ad720f4f43436565e4c1698798d763b63234fb5021b6c616e423"},
]
python-rapidjson = [
{file = "python-rapidjson-0.9.1.tar.gz", hash = "sha256:ad80bd7e4bb15d9705227630037a433e2e2a7982b54b51de2ebabdd1611394a1"},

2
setup.cfg Normal file
View File

@@ -0,0 +1,2 @@
[flake8]
ignore = E501,W503