Skip to content

Commit

Permalink
Merge pull request #36 from awtkns/rc_0.5
Browse files Browse the repository at this point in the history
Release Candidate  v0.5.0
  • Loading branch information
awtkns authored Mar 7, 2021
2 parents 68c07e1 + dd0da56 commit 36eaa63
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 17 deletions.
43 changes: 43 additions & 0 deletions .github/scripts/releases.py
Original file line number Diff line number Diff line change
@@ -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
)
24 changes: 24 additions & 0 deletions .github/workflows/update-release-docs.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.



15 changes: 15 additions & 0 deletions docs/en/docs/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

21 changes: 20 additions & 1 deletion docs/en/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion docs/en/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edit_uri: ''

theme:
name: material
custom_dir: overrides
palette:
- scheme: primary
accent: amber
Expand All @@ -14,6 +15,7 @@ theme:
favicon: assets/bolt-grad.svg
language: en


# Nav
nav:
- Overview: index.md
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/en/overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "base.html" %}

{% block announce %}
<a class="announce" href="/releases/#v050-pagination" target="_blank">
🎉 v0.5.0 - Pagination Released 🎉
</a>
{% endblock %}
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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='[email protected]',
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',
Expand All @@ -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",
Expand All @@ -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",
Expand Down

1 comment on commit 36eaa63

@vercel
Copy link

@vercel vercel bot commented on 36eaa63 Mar 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.