diff --git a/.github/scripts/releases.py b/.github/scripts/releases.py new file mode 100644 index 0000000..d1a6594 --- /dev/null +++ b/.github/scripts/releases.py @@ -0,0 +1,43 @@ +from os import environ +from pathlib import Path + +from github import Github +from github.GitRelease import GitRelease + +GITHUB_REPOSITORY = environ.get('GITHUB_REPOSITORY') +GITHUB_TOKEN = environ.get('GITHUB_TOKEN') +FILE_PATH = "docs/en/docs/releases.md" +COMMIT_MESSAGE = "🤖 auto update releases.md" + +gh = Github(GITHUB_TOKEN) + + +def generate_header(r: GitRelease, separator: bool = False): + header = '' + if separator: + header += "\n\n---\n" + + return header + f""" +## [{r.title}]({r.html_url}){" { .releases } "} +{r.created_at.date()} +""" + + +if __name__ == '__main__': + repo = gh.get_repo(REPO) + + content = '' + first = False + for r in repo.get_releases(): + if not r.draft: + content += generate_header(r, first) + content += r.body + first = True + + contents = repo.get_contents(FILE_PATH) + repo.update_file( + contents.path, + message=COMMIT_MESSAGE, + content=content, + sha=contents.sha + ) \ No newline at end of file diff --git a/.github/workflows/update-release-docs.yml b/.github/workflows/update-release-docs.yml new file mode 100644 index 0000000..04130ff --- /dev/null +++ b/.github/workflows/update-release-docs.yml @@ -0,0 +1,24 @@ +name: Update Release Docs + +on: + release: + types: [ published ] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.6' + - name: Updating Releases Documentation + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + python -m pip install --upgrade pip + pip install pygithub + + python .github/scripts/releases.py \ No newline at end of file diff --git a/README.md b/README.md index 888ec33..90587f1 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,25 @@ app = FastAPI() app.include_router(CRUDRouter(schema=Potato)) ``` +## Advanced Usage +fastapi-crudrouter provides a number of features that allow you to get the most out of your automatically generated CRUD +routes. Listed below are some highlights. + +- Automatic Pagination ([docs](https://fastapi-crudrouter.awtkns.com/pagination/)) +- Ability to Provide Custom Create and Update Schemas ([docs](https://fastapi-crudrouter.awtkns.com/schemas/)) +- Dynamic Generation of Create and Update Schemas ([docs](https://fastapi-crudrouter.awtkns.com/schemas/)) +- Ability to Add, Customize, or Disable Specific Routes ([docs](https://fastapi-crudrouter.awtkns.com/routing/)) +- Native Support for FastAPI Dependencies Injection ([docs](https://fastapi-crudrouter.awtkns.com/dependencies/)) + +## Supported Backends / ORMs +fastapi-crudrouter currently supports a number of backends / ORMs. Listed below are the backends currently supported. This list will +likely grow in future releases. + +- In Memory ([docs](https://fastapi-crudrouter.awtkns.com/backends/memory/)) +- SQLAlchemy ([docs](https://fastapi-crudrouter.awtkns.com/backends/sqlalchemy/)) +- Databases (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/async/)) +- Tortoise ORM (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/tortoise/)) + ## OpenAPI Support By default, all routes generated by the CRUDRouter will be documented according to OpenAPI spec. @@ -61,15 +80,3 @@ Below are the default routes created by the CRUDRouter shown in the generated Op The CRUDRouter is able to dynamically generate detailed documentation based on the models given to it. ![OpenAPI Route Detail](https://raw.githubusercontent.com/awtkns/fastapi-crudrouter/master/docs/en/docs/assets/RouteDetail.png) - -## Future Features :sunglasses: -Features planned for future releases include: - - Pagination support - - MongoDB / motor support - - Support for other backends - - And much more - -Please open an issue if there is a specific feature you would like supported. - - - diff --git a/docs/en/docs/css/main.css b/docs/en/docs/css/main.css index 27f7fe9..f7d7186 100644 --- a/docs/en/docs/css/main.css +++ b/docs/en/docs/css/main.css @@ -26,4 +26,19 @@ header { } } +a.announce:link, a.announce:visited { + color: #fff; +} + +a.announce:hover { + color: var(--md-accent-fg-color); +} + +h2.releases { + margin-bottom: 0; +} + +h2.releases + p { + margin-top: 0; +} diff --git a/docs/en/docs/index.md b/docs/en/docs/index.md index 512cd09..bd4dc52 100644 --- a/docs/en/docs/index.md +++ b/docs/en/docs/index.md @@ -41,7 +41,7 @@ $ pip install fastapi-crudrouter ## Basic Usage Below is a simple example of what the CRUDRouter can do. In just ten lines of code, you can generate all -the crud routes you need for any model. A full list of the routes generated can be found [here](./routing). +the crud routes you need for any model. A full list of the routes generated can be found [here](./routing). ```python from pydantic import BaseModel @@ -57,6 +57,25 @@ app = FastAPI() app.include_router(CRUDRouter(schema=Potato)) ``` +## Advanced Usage +fastapi-crudrouter provides a number of features that allow you to get the most out of your automatically generated CRUD +routes. Listed below are some highlights. + +- Automatic Pagination ([docs](https://fastapi-crudrouter.awtkns.com/pagination/)) +- Ability to Provide Custom Create and Update Schemas ([docs](https://fastapi-crudrouter.awtkns.com/schemas/)) +- Dynamic Generation of Create and Update Schemas ([docs](https://fastapi-crudrouter.awtkns.com/schemas/)) +- Ability to Add, Customize, or Disable Specific Routes ([docs](https://fastapi-crudrouter.awtkns.com/routing/)) +- Native Support for FastAPI Dependencies Injection ([docs](https://fastapi-crudrouter.awtkns.com/dependencies/)) + +## Supported Backends / ORMs +fastapi-crudrouter supports a number of backends / ORMs. Listed below are the backends currently supported. This list will +likely grow in future releases. + +- In Memory ([docs](https://fastapi-crudrouter.awtkns.com/backends/memory/)) +- SQLAlchemy ([docs](https://fastapi-crudrouter.awtkns.com/backends/sqlalchemy/)) +- Databases (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/async/)) +- Tortoise ORM (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/tortoise/)) + ## OpenAPI Support !!! tip "Automatic OpenAPI Documentation" diff --git a/docs/en/mkdocs.yml b/docs/en/mkdocs.yml index d1d46a1..411287d 100644 --- a/docs/en/mkdocs.yml +++ b/docs/en/mkdocs.yml @@ -5,6 +5,7 @@ edit_uri: '' theme: name: material + custom_dir: overrides palette: - scheme: primary accent: amber @@ -14,6 +15,7 @@ theme: favicon: assets/bolt-grad.svg language: en + # Nav nav: - Overview: index.md @@ -26,6 +28,7 @@ nav: - Databases (async): backends/async.md - Tortoise (async): backends/tortoise.md - Dependencies: dependencies.md + - Releases: releases.md google_analytics: - UA-186315536-1 @@ -45,7 +48,9 @@ extra: - icon: fontawesome/brands/linkedin link: https://www.linkedin.com/in/adam-watkins-yvr/ - icon: fontawesome/solid/globe - link: https://wtkns.dev + link: https://awtkns.com + - icon: fontawesome/brands/instagram + link: https://www.instagram.com/adamcwatkins/ extra_css: - css/main.css diff --git a/docs/en/overrides/main.html b/docs/en/overrides/main.html new file mode 100644 index 0000000..bbb42af --- /dev/null +++ b/docs/en/overrides/main.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} + +{% block announce %} + + 🎉 v0.5.0 - Pagination Released 🎉 + +{% endblock %} \ No newline at end of file diff --git a/setup.py b/setup.py index 5a6bf71..65f87b1 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,13 @@ from setuptools import setup, find_packages -VERSION = '0.4.3' +VERSION = '0.5.0' setup( name='fastapi-crudrouter', version=VERSION, author='Adam Watkins', author_email='cadamrun@gmail.com', - packages=find_packages(exclude=('tests', 'tests.implementations')), + packages=find_packages(exclude=('tests.*', 'tests')), url='https://github.com/awtkns/fastapi-crudrouter', documentation='https://fastapi-crudrouter.awtkns.com/', license='MIT', @@ -16,7 +16,7 @@ long_description_content_type="text/markdown", install_requires=["fastapi"], python_requires='>=3.6', - keywords=['fastapi', 'crud', 'restful', 'routing', 'generator'], + keywords=['fastapi', 'crud', 'restful', 'routing', 'generator', 'crudrouter'], classifiers=[ "Operating System :: OS Independent", "Programming Language :: Python :: 3", @@ -25,6 +25,7 @@ "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Code Generators", "Topic :: Software Development", "Typing :: Typed", "Development Status :: 4 - Beta",