2020-07-09 23:15:08 +00:00
|
|
|
from typing import List
|
2020-07-09 22:43:36 +00:00
|
|
|
import json
|
|
|
|
from pytablewriter import MarkdownTableWriter
|
2020-07-09 23:15:08 +00:00
|
|
|
from stdlib_list import stdlib_list
|
2020-07-09 22:43:36 +00:00
|
|
|
|
2020-07-09 23:15:08 +00:00
|
|
|
NATIVE = ["fastapi", "starlette", "pydantic", "typing", "uvicorn"]
|
|
|
|
|
|
|
|
|
|
|
|
def filter_list(dependencies: List[str]) -> List[str]:
|
|
|
|
return [
|
|
|
|
dependency
|
|
|
|
for dependency in dependencies
|
|
|
|
if not (
|
|
|
|
dependency in NATIVE
|
|
|
|
or dependency in stdlib_list("3.8")
|
|
|
|
or dependency.startswith("_")
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
with open("results.json") as json_file:
|
2020-07-09 22:43:36 +00:00
|
|
|
data = json.load(json_file)
|
|
|
|
writer = MarkdownTableWriter()
|
|
|
|
writer.headers = ["Project", "Dependencies"]
|
|
|
|
writer.value_matrix = [
|
2020-07-09 23:15:08 +00:00
|
|
|
[project, filter_list(dependencies)]
|
|
|
|
for project, dependencies in data.items()
|
|
|
|
if len(filter_list(dependencies)) > 0 and len(filter_list(dependencies)) < 20
|
2020-07-09 22:43:36 +00:00
|
|
|
]
|
|
|
|
writer.write_table()
|