Skip to content

Commit

Permalink
Merge branch 'master' into 105_schemathesis_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
awtkns committed Jan 29, 2023
2 parents f1ed7a0 + 9b82986 commit 54a8bb2
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.10'
- name: Bump Version
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10" ]
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
services:
postgres:
image: postgres
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
<sub>A dynamic FastAPI router that automatically creates CRUD routes for your models</sub>
</p>
<p align="center">
<img alt="Tests" src="https://github.com/awtkns/fastapi-crudrouter/workflows/Python%20application/badge.svg" />
<img alt="Docs" src="https://github.com/awtkns/fastapi-crudrouter/workflows/docs/badge.svg" />
<img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/awtkns/fastapi-crudrouter/.github/workflows/pytest.yml?color=%2334D058" />
<img alt="Downloads" src="https://img.shields.io/pypi/dm/fastapi-crudrouter?color=%2334D058" />
<a href="https://pypi.org/project/fastapi-crudrouter" target="_blank">
<img src="https://img.shields.io/pypi/v/fastapi-crudrouter?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<img alt="License" src="https://img.shields.io/github/license/awtkns/fastapi-crudrouter?color=%2334D058" />
</p>
<p align="center">
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/fastapi-crudrouter">
</p>

---

Expand Down
5 changes: 5 additions & 0 deletions docs/en/docs/backends/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Below is a minimal example assuming that you have already imported and created
all the required models and database connections.

```python
from fastapi_crudrouter import DatabasesCRUDRouter
from fastapi import FastAPI

app = FastAPI()

router = DatabasesCRUDRouter(
schema=MyPydanticModel,
table=my_table,
Expand Down
5 changes: 5 additions & 0 deletions docs/en/docs/backends/ormar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Below is an example assuming that you have already imported and created all the
models.

```python
from fastapi_crudrouter import OrmarCRUDRouter
from fastapi import FastAPI

app = FastAPI()

router = OrmarCRUDRouter(
schema=MyOrmarModel,
create_schema=Optional[MyPydanticCreateModel],
Expand Down
5 changes: 5 additions & 0 deletions docs/en/docs/backends/sqlalchemy.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ database dependency.
Below is an example assuming that you have already imported and created all the required models.

```python
from fastapi_crudrouter import SQLAlchemyCRUDRouter
from fastapi import FastAPI

app = FastAPI()

router = SQLAlchemyCRUDRouter(
schema=MyPydanticModel,
create_schema=MyPydanticCreateModel,
Expand Down
6 changes: 6 additions & 0 deletions docs/en/docs/backends/tortoise.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ your database using your [Tortoise](https://tortoise-orm.readthedocs.io/en/lates
!!! warning
To use the `TortoiseCRUDRouter`, [Tortoise ORM](https://pypi.org/project/tortoise-orm/) must be first installed.

!!! warning
Tortoise ORM works on python versions 3.7 and higher, so if you want to use this backend, you would not be able to use `python 3.6`.

## Simple Example
Below is an example assuming that you have already imported and created all the required models.

```python
from fastapi_crudrouter.core.tortoise import TortoiseCRUDRouter
from fastapi import FastAPI

app = FastAPI()
register_tortoise(app, config=TORTOISE_ORM)

Expand Down
16 changes: 8 additions & 8 deletions docs/en/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ works and is bug free.

#### Test requirements
Tests require a postgres database for tests to run. The easiest way to accomplish this is with docker. This project offers
a docker-compose file at tests/conf/dev.docker-compose.yaml. You can use this file with
a docker-compose file at tests/conf/dev.docker-compose.yml. You can use this file with

```console
$ docker compose -f tests/conf/dev.docker-compose.yaml up -d
```bash
docker compose -f tests/conf/dev.docker-compose.yml up -d
```

After testing you can tear down the running containers with

```console
$ docker compose -f tests/conf/dev.docker-compose.yaml down
```bash
docker compose -f tests/conf/dev.docker-compose.yml down
```

#### Running tests
Expand All @@ -63,19 +63,19 @@ With `dev.requirements.txt` installed above you also install tools to lint, form

To format the project run:

```
```bash
black fastapi_crudrouter tests
```

To check styles, imports, annotations, pep8 etc. run:

```
```bash
flake8 fastapi_crudrouter
```

To check static types annotations run:

```
```bash
mypy fastapi_crudrouter tests
```

Expand Down
12 changes: 9 additions & 3 deletions docs/en/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
<sub>A dynamic FastAPI router that automatically creates routes CRUD for your models</sub>
</p>
<p align="center">
<img alt="Tests" src="https://github.com/awtkns/fastapi-crudrouter/workflows/Python%20application/badge.svg" />
<img alt="Docs" src="https://github.com/awtkns/fastapi-crudrouter/workflows/docs/badge.svg" />
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/fastapi" />
<img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/awtkns/fastapi-crudrouter/.github/workflows/pytest.yml?color=%2334D058" />
<img alt="Downloads" src="https://img.shields.io/pypi/dm/fastapi-crudrouter?color=%2334D058" />
<a href="https://pypi.org/project/fastapi-crudrouter" target="_blank">
<img src="https://img.shields.io/pypi/v/fastapi-crudrouter?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<img alt="License" src="https://img.shields.io/github/license/awtkns/fastapi-crudrouter?color=%2334D058" />
</p>
<p align="center">
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/fastapi-crudrouter">
</p>

---
Expand Down
2 changes: 1 addition & 1 deletion docs/en/docs/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ are shown below.

As an example, the *delete all* route can be disabled by doing the following:
```python
router = MemmoryCRUDRouter(schema=MyModel, deleta_all_route=False)
router = MemoryCRUDRouter(schema=MyModel, delete_all_route=False)
```

!!! tip "Custom Dependencies"
Expand Down
7 changes: 3 additions & 4 deletions docs/en/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ theme:
name: material
features:
- navigation.expand
- content.code.copy
palette:
- scheme: default
primary: indigo
Expand Down Expand Up @@ -58,11 +59,9 @@ extra:
- icon: fontawesome/brands/github-alt
link: https://github.com/awtkns/fastapi-crudrouter
- icon: fontawesome/brands/linkedin
link: https://www.linkedin.com/in/adam-watkins-yvr/
link: https://www.linkedin.com/in/awtkns/
- icon: fontawesome/solid/globe
link: https://awtkns.com
- icon: fontawesome/brands/instagram
link: https://www.instagram.com/adamcwatkins/
link: https://github.com/awtkns

extra_css:
- css/main.css
Expand Down
2 changes: 1 addition & 1 deletion fastapi_crudrouter/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.5"
__version__ = "0.8.6"
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_version():
name="fastapi-crudrouter",
version=get_version(),
author="Adam Watkins",
author_email="cadamrun@gmail.com",
author_email="hello@awtkns.com",
packages=find_packages(exclude=("tests.*", "tests")),
url="https://github.com/awtkns/fastapi-crudrouter",
documentation="https://fastapi-crudrouter.awtkns.com/",
Expand All @@ -23,7 +23,7 @@ def get_version():
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
install_requires=["fastapi"],
python_requires=">=3.6",
python_requires=">=3.7",
keywords=["fastapi", "crud", "restful", "routing", "generator", "crudrouter"],
classifiers=[
"Operating System :: OS Independent",
Expand All @@ -44,11 +44,11 @@ def get_version():
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP",
],
Expand Down
8 changes: 4 additions & 4 deletions tests/dev.requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
fastapi
async-generator; python_version=='3.6'
async-exit-stack; python_version=='3.6'
httpx

# Backends
ormar
tortoise-orm==0.17.8; python_version>='3.7'
tortoise-orm==0.18.1
databases
aiosqlite
sqlalchemy==1.3.22
sqlalchemy<1.4.0
sqlalchemy_utils==0.36.8
gino-starlette==0.1.1
asyncpg

# Testing
openapi-spec-validator
Expand Down
10 changes: 5 additions & 5 deletions tests/implementations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

from .databases_ import (
databases_implementation,
databases_implementation_custom_ids,
Expand All @@ -23,6 +25,7 @@
sqlalchemy_implementation_string_pk,
DSN_LIST,
)
from .tortoise_ import tortoise_implementation

implementations = [
(memory_implementation, ""),
Expand All @@ -33,9 +36,6 @@
implementations.extend([(sqlalchemy_implementation, dsn) for dsn in DSN_LIST])
implementations.extend([(databases_implementation, dsn) for dsn in DSN_LIST])

try:
from .tortoise_ import tortoise_implementation
except ImportError:
pass
else:

if sys.version_info >= (3, 8):
implementations.append((tortoise_implementation, ""))

0 comments on commit 54a8bb2

Please sign in to comment.