muffin-rest 4.4.3__tar.gz → 4.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {muffin-rest-4.4.3/muffin_rest.egg-info → muffin_rest-4.5.1}/PKG-INFO +26 -15
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/openapi.py +5 -6
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/peewee/__init__.py +5 -3
- muffin_rest-4.5.1/muffin_rest/peewee/schemas.py +36 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/peewee/types.py +2 -1
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/pyproject.toml +48 -45
- muffin-rest-4.4.3/CHANGELOG.md +0 -35
- muffin-rest-4.4.3/MANIFEST.in +0 -11
- muffin-rest-4.4.3/PKG-INFO +0 -175
- muffin-rest-4.4.3/muffin_rest.egg-info/SOURCES.txt +0 -44
- muffin-rest-4.4.3/muffin_rest.egg-info/dependency_links.txt +0 -1
- muffin-rest-4.4.3/muffin_rest.egg-info/requires.txt +0 -40
- muffin-rest-4.4.3/muffin_rest.egg-info/top_level.txt +0 -1
- muffin-rest-4.4.3/setup.cfg +0 -4
- muffin-rest-4.4.3/tests/test_base.py +0 -305
- muffin-rest-4.4.3/tests/test_mongo.py +0 -249
- muffin-rest-4.4.3/tests/test_openapi.py +0 -64
- muffin-rest-4.4.3/tests/test_peewee.py +0 -340
- muffin-rest-4.4.3/tests/test_sqlalchemy.py +0 -299
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/LICENSE +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/README.rst +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/__init__.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/api.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/errors.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/filters.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/handler.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/mongo/__init__.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/mongo/filters.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/mongo/schema.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/mongo/sorting.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/mongo/types.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/mongo/utils.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/options.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/peewee/filters.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/peewee/openapi.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/peewee/options.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/peewee/sorting.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/py.typed +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/redoc.html +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/sorting.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/sqlalchemy/__init__.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/sqlalchemy/filters.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/sqlalchemy/sorting.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/sqlalchemy/types.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/swagger.html +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/types.py +0 -0
- {muffin-rest-4.4.3 → muffin_rest-4.5.1}/muffin_rest/utils.py +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: muffin-rest
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.5.1
|
|
4
4
|
Summary: The package provides enhanced support for writing REST APIs with Muffin framework
|
|
5
|
-
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: homepage, https://github.com/klen/muffin-rest
|
|
8
|
-
Project-URL: repository, https://github.com/klen/muffin-rest
|
|
9
|
-
Project-URL: changelog, https://raw.githubusercontent.com/klen/muffin-rest/master/CHANGELOG.md
|
|
5
|
+
Home-page: https://github.com/klen/muffin-rest
|
|
6
|
+
License: MIT
|
|
10
7
|
Keywords: rest,api,muffin,asgi,asyncio,trio
|
|
8
|
+
Author: Kirill Klenov
|
|
9
|
+
Author-email: horneds@gmail.com
|
|
10
|
+
Requires-Python: >=3.8,<4.0
|
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Framework :: AsyncIO
|
|
13
|
+
Classifier: Framework :: Trio
|
|
12
14
|
Classifier: Intended Audience :: Developers
|
|
13
15
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
16
|
Classifier: Programming Language :: Python
|
|
@@ -17,18 +19,26 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
17
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
27
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
-
Classifier: Framework :: AsyncIO
|
|
22
|
-
Classifier: Framework :: Trio
|
|
23
|
-
Requires-Python: >=3.8
|
|
24
|
-
Description-Content-Type: text/x-rst
|
|
25
|
-
Provides-Extra: tests
|
|
26
|
-
Provides-Extra: dev
|
|
27
|
-
Provides-Extra: yaml
|
|
28
|
-
Provides-Extra: example
|
|
29
28
|
Provides-Extra: peewee
|
|
30
29
|
Provides-Extra: sqlalchemy
|
|
31
|
-
|
|
30
|
+
Provides-Extra: yaml
|
|
31
|
+
Requires-Dist: apispec (>=4,<5)
|
|
32
|
+
Requires-Dist: marshmallow (>=3.14,<4.0)
|
|
33
|
+
Requires-Dist: marshmallow-peewee (>=4,<5) ; extra == "peewee"
|
|
34
|
+
Requires-Dist: marshmallow-sqlalchemy (>=0.27.0,<0.28.0) ; extra == "sqlalchemy"
|
|
35
|
+
Requires-Dist: muffin (>=0.94,<0.95)
|
|
36
|
+
Requires-Dist: muffin-databases (>=0.5.0,<0.6.0) ; extra == "sqlalchemy"
|
|
37
|
+
Requires-Dist: muffin-peewee-aio (>=0.9.6,<0.10.0) ; extra == "peewee"
|
|
38
|
+
Requires-Dist: pyyaml ; extra == "yaml"
|
|
39
|
+
Requires-Dist: sqlalchemy ; extra == "sqlalchemy"
|
|
40
|
+
Project-URL: Repository, https://github.com/klen/muffin-rest
|
|
41
|
+
Description-Content-Type: text/x-rst
|
|
32
42
|
|
|
33
43
|
Muffin-REST
|
|
34
44
|
###########
|
|
@@ -173,3 +183,4 @@ Licensed under a `MIT license`_.
|
|
|
173
183
|
.. _SqlAlchemy Core: https://docs.sqlalchemy.org/en/14/core/
|
|
174
184
|
|
|
175
185
|
.. _MIT license: http://opensource.org/licenses/MIT
|
|
186
|
+
|
|
@@ -4,8 +4,7 @@ import re
|
|
|
4
4
|
from contextlib import suppress
|
|
5
5
|
from functools import partial
|
|
6
6
|
from http import HTTPStatus
|
|
7
|
-
from
|
|
8
|
-
from typing import Callable, Dict, List, Optional, Tuple, cast
|
|
7
|
+
from typing import Callable, Dict, List, Tuple, cast
|
|
9
8
|
|
|
10
9
|
from apispec import utils
|
|
11
10
|
from apispec.core import APISpec
|
|
@@ -18,11 +17,11 @@ from muffin import Response
|
|
|
18
17
|
from . import LIMIT_PARAM, OFFSET_PARAM, openapi
|
|
19
18
|
from .options import RESTOptions
|
|
20
19
|
|
|
21
|
-
yaml_utils: Optional[ModuleType] = None
|
|
22
|
-
|
|
23
20
|
with suppress(ImportError):
|
|
24
21
|
from apispec import yaml_utils
|
|
25
22
|
|
|
23
|
+
locals().setdefault("yaml_utils", None)
|
|
24
|
+
|
|
26
25
|
|
|
27
26
|
DEFAULT_METHODS = ("get",)
|
|
28
27
|
HTTP_METHODS = [
|
|
@@ -45,7 +44,8 @@ def render_openapi(api, request):
|
|
|
45
44
|
# Setup Specs
|
|
46
45
|
options = dict(api.openapi_options)
|
|
47
46
|
options.setdefault(
|
|
48
|
-
"servers",
|
|
47
|
+
"servers",
|
|
48
|
+
[{"url": str(request.url.with_query("").with_path(api.prefix))}],
|
|
49
49
|
)
|
|
50
50
|
|
|
51
51
|
spec = APISpec(
|
|
@@ -163,7 +163,6 @@ def return_type_to_response(fn: Callable) -> Dict:
|
|
|
163
163
|
and issubclass(return_type, Response)
|
|
164
164
|
and return_type.content_type
|
|
165
165
|
):
|
|
166
|
-
|
|
167
166
|
responses[return_type.status_code] = {
|
|
168
167
|
"description": HTTPStatus(return_type.status_code).description,
|
|
169
168
|
"content": {return_type.content_type: {}},
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import TYPE_CHECKING, Optional, Tuple, Type,
|
|
5
|
+
from typing import TYPE_CHECKING, Optional, Tuple, Type, cast, overload
|
|
6
6
|
|
|
7
|
+
import marshmallow as ma
|
|
7
8
|
import peewee as pw
|
|
8
9
|
from apispec.ext.marshmallow import MarshmallowPlugin
|
|
9
10
|
from marshmallow_peewee import ForeignKey
|
|
@@ -14,16 +15,17 @@ from muffin_rest.handler import RESTBase
|
|
|
14
15
|
from muffin_rest.peewee.openapi import PeeweeOpenAPIMixin
|
|
15
16
|
|
|
16
17
|
from .options import PWRESTOptions
|
|
18
|
+
from .schemas import EnumField
|
|
19
|
+
from .types import TVModel
|
|
17
20
|
|
|
18
21
|
if TYPE_CHECKING:
|
|
19
|
-
import marshmallow as ma
|
|
20
22
|
from asgi_tools.types import TJSON
|
|
21
23
|
from muffin import Request
|
|
22
24
|
|
|
23
25
|
# XXX: Patch apispec.MarshmallowPlugin to support ForeignKeyField
|
|
24
26
|
MarshmallowPlugin.Converter.field_mapping[ForeignKey] = ("integer", None)
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
assert issubclass(EnumField, ma.fields.Field) # just register EnumField
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import marshmallow as ma
|
|
2
|
+
from marshmallow_peewee import DefaultConverter
|
|
3
|
+
from muffin_peewee.fields import IntEnumField, StrEnumField
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class EnumField(ma.fields.Field):
|
|
7
|
+
default_error_messages = {
|
|
8
|
+
"unknown": "Must be one of: {choices}.",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
def __init__(self, enum, **kwargs):
|
|
12
|
+
self.enum = enum
|
|
13
|
+
self.choices_text = ", ".join([str(c.value) for c in enum])
|
|
14
|
+
super().__init__(**kwargs)
|
|
15
|
+
|
|
16
|
+
def _serialize(self, value, attr, obj, **kwargs):
|
|
17
|
+
if value is None:
|
|
18
|
+
return None
|
|
19
|
+
|
|
20
|
+
return value.value
|
|
21
|
+
|
|
22
|
+
def _deserialize(self, value, attr, data, **kwargs):
|
|
23
|
+
try:
|
|
24
|
+
return self.enum(value)
|
|
25
|
+
except ValueError as error:
|
|
26
|
+
raise self.make_error("unknown", choices=self.choices_text) from error
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@DefaultConverter.register(StrEnumField)
|
|
30
|
+
@DefaultConverter.register(IntEnumField)
|
|
31
|
+
def build_field(field, opts, **params):
|
|
32
|
+
params.pop("validate", None)
|
|
33
|
+
return EnumField(field.enum, **params)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# ruff: noqa: ARG001, ARG002
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
[
|
|
1
|
+
[tool.poetry]
|
|
2
2
|
name = "muffin-rest"
|
|
3
|
-
version = "4.
|
|
3
|
+
version = "4.5.1"
|
|
4
4
|
description = "The package provides enhanced support for writing REST APIs with Muffin framework"
|
|
5
5
|
readme = "README.rst"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
authors = [
|
|
6
|
+
homepage = "https://github.com/klen/muffin-rest"
|
|
7
|
+
repository = "https://github.com/klen/muffin-rest"
|
|
8
|
+
authors = ["Kirill Klenov <horneds@gmail.com>"]
|
|
9
|
+
license = "MIT"
|
|
9
10
|
keywords = ["rest", "api", "muffin", "asgi", "asyncio", "trio"]
|
|
10
11
|
classifiers = [
|
|
11
12
|
"Development Status :: 5 - Production/Stable",
|
|
@@ -21,51 +22,49 @@ classifiers = [
|
|
|
21
22
|
"Framework :: AsyncIO",
|
|
22
23
|
"Framework :: Trio",
|
|
23
24
|
]
|
|
24
|
-
dependencies = [
|
|
25
|
-
"apispec >= 4",
|
|
26
|
-
"marshmallow >= 3.14",
|
|
27
|
-
"muffin >= 0.92",
|
|
28
|
-
]
|
|
29
25
|
|
|
30
|
-
[
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
[tool.poetry.dependencies]
|
|
27
|
+
python = "^3.8"
|
|
28
|
+
apispec = "^4"
|
|
29
|
+
marshmallow = "^3.14"
|
|
30
|
+
muffin = "^0.94"
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"pytest-aio[curio,trio]",
|
|
45
|
-
"pytest-mypy",
|
|
46
|
-
"pyyaml",
|
|
47
|
-
"types-PyYAML",
|
|
48
|
-
"types-ujson",
|
|
49
|
-
"ruff",
|
|
50
|
-
]
|
|
51
|
-
dev = ["pre-commit", "refurb", "bump2version"]
|
|
32
|
+
# Optional dependencies
|
|
33
|
+
pyyaml = {version = "*", optional = true}
|
|
34
|
+
muffin-peewee-aio = {version = "^0.9.6", optional = true}
|
|
35
|
+
marshmallow-peewee = {version = "^4", optional = true}
|
|
36
|
+
muffin-databases = {version = "^0.5.0", optional = true}
|
|
37
|
+
marshmallow-sqlalchemy = {version = "^0.27.0", optional = true}
|
|
38
|
+
sqlalchemy = {version = "*", optional = true}
|
|
39
|
+
|
|
40
|
+
[tool.poetry.extras]
|
|
52
41
|
yaml = ["pyyaml"]
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"muffin-peewee-aio >= 0.2.2",
|
|
56
|
-
"marshmallow-peewee >= 3.2.0",
|
|
57
|
-
]
|
|
58
|
-
sqlalchemy = [
|
|
59
|
-
"muffin-databases >= 0.3.2",
|
|
60
|
-
"marshmallow-sqlalchemy",
|
|
61
|
-
"sqlalchemy",
|
|
62
|
-
]
|
|
42
|
+
peewee = ["muffin-peewee-aio", "marshmallow-peewee"]
|
|
43
|
+
sqlalchemy = ["muffin-databases", "marshmallow-sqlalchemy", "sqlalchemy"]
|
|
63
44
|
|
|
64
|
-
[tool.
|
|
65
|
-
|
|
45
|
+
[tool.poetry.group.tests.dependencies]
|
|
46
|
+
aiosqlite = "*"
|
|
47
|
+
marshmallow-peewee = "^4"
|
|
48
|
+
marshmallow-sqlalchemy = "^0.27.0"
|
|
49
|
+
muffin-databases = "^0.5.0"
|
|
50
|
+
muffin-mongo = "^0.5.1"
|
|
51
|
+
muffin-peewee-aio = "^0.9.6"
|
|
52
|
+
pytest = "*"
|
|
53
|
+
pytest-aio = {version = "*", extras = ["curio", "trio"]}
|
|
54
|
+
pytest-mypy = "*"
|
|
55
|
+
pyyaml = "*"
|
|
56
|
+
types-PyYAML = "*"
|
|
57
|
+
types-ujson = "*"
|
|
58
|
+
ruff = "*"
|
|
59
|
+
|
|
60
|
+
[tool.poetry.group.dev.dependencies]
|
|
61
|
+
pre-commit = "*"
|
|
62
|
+
|
|
63
|
+
[tool.poetry.group.example.dependencies]
|
|
64
|
+
uvicorn = "*"
|
|
65
|
+
muffin-peewee-aio = "^0.9.6"
|
|
66
|
+
marshmallow-peewee = "^4"
|
|
66
67
|
|
|
67
|
-
[tool.setuptools.package-data]
|
|
68
|
-
muffin_rest = ["py.typed"]
|
|
69
68
|
|
|
70
69
|
[tool.pytest.ini_options]
|
|
71
70
|
addopts = "-xsv"
|
|
@@ -100,3 +99,7 @@ target-version = "py38"
|
|
|
100
99
|
exclude = [".venv", "docs", "examples"]
|
|
101
100
|
select = ["ALL"]
|
|
102
101
|
ignore = ["D", "UP", "ANN", "DJ", "EM", "RSE", "SLF", "RET", "S101", "PLR2004", "PLR0912", "N804", "A003", "TRY003"]
|
|
102
|
+
|
|
103
|
+
[build-system]
|
|
104
|
+
requires = ["poetry-core>=1.0.0"]
|
|
105
|
+
build-backend = "poetry.core.masonry.api"
|
muffin-rest-4.4.3/CHANGELOG.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
-
|
|
7
|
-
## [Unreleased]
|
|
8
|
-
|
|
9
|
-
## [4.0.0] - 2021-11-01
|
|
10
|
-
### Changed
|
|
11
|
-
* Filters and sorting are async now
|
|
12
|
-
|
|
13
|
-
## [3.5.1] - 2021-10-21
|
|
14
|
-
### Changed
|
|
15
|
-
* Minimal version for `marshmallow-peewee` now is `3.2`
|
|
16
|
-
|
|
17
|
-
## [3.5.0] - 2021-10-20
|
|
18
|
-
### Added
|
|
19
|
-
- Support for python 3.10
|
|
20
|
-
|
|
21
|
-
## [3.4.4] - 2021-09-16
|
|
22
|
-
### Added
|
|
23
|
-
|
|
24
|
-
### Changed
|
|
25
|
-
|
|
26
|
-
### Removed
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
[Unreleased]: https://github.com/klen/muffin-rest/compare/4.0.0...HEAD
|
|
30
|
-
[3.5.1]: https://github.com/klen/muffin-rest/compare/3.5.1...4.0.0
|
|
31
|
-
[3.5.1]: https://github.com/klen/muffin-rest/compare/3.5.0...3.5.1
|
|
32
|
-
[3.5.0]: https://github.com/klen/muffin-rest/compare/3.4.4...3.5.0
|
|
33
|
-
[3.4.4]: https://github.com/klen/muffin-rest/compare/0.1.0...3.4.4
|
|
34
|
-
[0.1.0]: https://github.com/klen/aio-apiclient/releases/tag/0.1.0
|
|
35
|
-
|
muffin-rest-4.4.3/MANIFEST.in
DELETED
muffin-rest-4.4.3/PKG-INFO
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: muffin-rest
|
|
3
|
-
Version: 4.4.3
|
|
4
|
-
Summary: The package provides enhanced support for writing REST APIs with Muffin framework
|
|
5
|
-
Author-email: Kirill Klenov <horneds@gmail.com>
|
|
6
|
-
License: MIT License
|
|
7
|
-
Project-URL: homepage, https://github.com/klen/muffin-rest
|
|
8
|
-
Project-URL: repository, https://github.com/klen/muffin-rest
|
|
9
|
-
Project-URL: changelog, https://raw.githubusercontent.com/klen/muffin-rest/master/CHANGELOG.md
|
|
10
|
-
Keywords: rest,api,muffin,asgi,asyncio,trio
|
|
11
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
-
Classifier: Programming Language :: Python
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
-
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
-
Classifier: Framework :: AsyncIO
|
|
22
|
-
Classifier: Framework :: Trio
|
|
23
|
-
Requires-Python: >=3.8
|
|
24
|
-
Description-Content-Type: text/x-rst
|
|
25
|
-
Provides-Extra: tests
|
|
26
|
-
Provides-Extra: dev
|
|
27
|
-
Provides-Extra: yaml
|
|
28
|
-
Provides-Extra: example
|
|
29
|
-
Provides-Extra: peewee
|
|
30
|
-
Provides-Extra: sqlalchemy
|
|
31
|
-
License-File: LICENSE
|
|
32
|
-
|
|
33
|
-
Muffin-REST
|
|
34
|
-
###########
|
|
35
|
-
|
|
36
|
-
.. _description:
|
|
37
|
-
|
|
38
|
-
**Muffin-REST** -- provides enhanced support for writing REST APIs with Muffin_.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.. _badges:
|
|
42
|
-
|
|
43
|
-
.. image:: https://github.com/klen/muffin-rest/workflows/tests/badge.svg
|
|
44
|
-
:target: https://github.com/klen/muffin-rest/actions
|
|
45
|
-
:alt: Tests Status
|
|
46
|
-
|
|
47
|
-
.. image:: https://img.shields.io/pypi/v/muffin-rest
|
|
48
|
-
:target: https://pypi.org/project/muffin-rest/
|
|
49
|
-
:alt: PYPI Version
|
|
50
|
-
|
|
51
|
-
.. image:: https://img.shields.io/pypi/pyversions/muffin-rest
|
|
52
|
-
:target: https://pypi.org/project/muffin-rest/
|
|
53
|
-
:alt: Python Versions
|
|
54
|
-
|
|
55
|
-
----------
|
|
56
|
-
|
|
57
|
-
.. _features:
|
|
58
|
-
|
|
59
|
-
Features
|
|
60
|
-
--------
|
|
61
|
-
|
|
62
|
-
- API class to simplify the creation of REST APIs;
|
|
63
|
-
- Automatic filtering and sorting for resources;
|
|
64
|
-
- Support for `Peewee ORM`_, Mongo_, `SQLAlchemy Core`_;
|
|
65
|
-
- Auto documentation with Swagger_;
|
|
66
|
-
|
|
67
|
-
.. _contents:
|
|
68
|
-
|
|
69
|
-
.. contents::
|
|
70
|
-
|
|
71
|
-
.. _requirements:
|
|
72
|
-
|
|
73
|
-
Requirements
|
|
74
|
-
=============
|
|
75
|
-
|
|
76
|
-
- python >= 3.7
|
|
77
|
-
|
|
78
|
-
.. note:: Trio is only supported with Peewee ORM
|
|
79
|
-
|
|
80
|
-
.. _installation:
|
|
81
|
-
|
|
82
|
-
Installation
|
|
83
|
-
=============
|
|
84
|
-
|
|
85
|
-
**Muffin-REST** should be installed using pip: ::
|
|
86
|
-
|
|
87
|
-
pip install muffin-rest
|
|
88
|
-
|
|
89
|
-
With `SQLAlchemy Core`_ support: ::
|
|
90
|
-
|
|
91
|
-
pip install muffin-rest[sqlalchemy]
|
|
92
|
-
|
|
93
|
-
With `Peewee ORM`_ support: ::
|
|
94
|
-
|
|
95
|
-
pip install muffin-rest[peewee]
|
|
96
|
-
|
|
97
|
-
With YAML support for autodocumentation: ::
|
|
98
|
-
|
|
99
|
-
pip install muffin-rest[yaml]
|
|
100
|
-
|
|
101
|
-
.. _usage:
|
|
102
|
-
|
|
103
|
-
Usage
|
|
104
|
-
=====
|
|
105
|
-
|
|
106
|
-
Create an API:
|
|
107
|
-
|
|
108
|
-
.. code-block:: python
|
|
109
|
-
|
|
110
|
-
from muffin_rest import API
|
|
111
|
-
|
|
112
|
-
api = API()
|
|
113
|
-
|
|
114
|
-
Create endpoints and connect them to the API (example for sqlalchemy):
|
|
115
|
-
|
|
116
|
-
.. code-block:: python
|
|
117
|
-
|
|
118
|
-
from muffin_rest.sqlalchemy import SAEndpoint
|
|
119
|
-
from project.api import api
|
|
120
|
-
|
|
121
|
-
@api.route
|
|
122
|
-
class MyEndpoint(SAEndpoint):
|
|
123
|
-
|
|
124
|
-
class Meta:
|
|
125
|
-
table = MyTable
|
|
126
|
-
database = db
|
|
127
|
-
|
|
128
|
-
Connect it to your Muffin_ application:
|
|
129
|
-
|
|
130
|
-
.. code-block:: python
|
|
131
|
-
|
|
132
|
-
from project.api import api
|
|
133
|
-
|
|
134
|
-
api.setup(app, prefix='/api/v1')
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
.. _bugtracker:
|
|
138
|
-
|
|
139
|
-
Bug tracker
|
|
140
|
-
===========
|
|
141
|
-
|
|
142
|
-
If you have any suggestions, bug reports or
|
|
143
|
-
annoyances please report them to the issue tracker
|
|
144
|
-
at https://github.com/klen/muffin-rest/issues
|
|
145
|
-
|
|
146
|
-
.. _contributing:
|
|
147
|
-
|
|
148
|
-
Contributing
|
|
149
|
-
============
|
|
150
|
-
|
|
151
|
-
Development of Muffin-REST happens at: https://github.com/klen/muffin-rest
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Contributors
|
|
155
|
-
=============
|
|
156
|
-
|
|
157
|
-
* klen_ (Kirill Klenov)
|
|
158
|
-
|
|
159
|
-
.. _license:
|
|
160
|
-
|
|
161
|
-
License
|
|
162
|
-
========
|
|
163
|
-
|
|
164
|
-
Licensed under a `MIT license`_.
|
|
165
|
-
|
|
166
|
-
.. _links:
|
|
167
|
-
|
|
168
|
-
.. _klen: https://github.com/klen
|
|
169
|
-
.. _Muffin: https://github.com/klen/muffin
|
|
170
|
-
.. _Swagger: https://swagger.io/tools/swagger-ui/
|
|
171
|
-
.. _Mongo: https://www.mongodb.com/
|
|
172
|
-
.. _Peewee ORM: http://docs.peewee-orm.com/en/latest/
|
|
173
|
-
.. _SqlAlchemy Core: https://docs.sqlalchemy.org/en/14/core/
|
|
174
|
-
|
|
175
|
-
.. _MIT license: http://opensource.org/licenses/MIT
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
CHANGELOG.md
|
|
2
|
-
LICENSE
|
|
3
|
-
MANIFEST.in
|
|
4
|
-
README.rst
|
|
5
|
-
pyproject.toml
|
|
6
|
-
muffin_rest/__init__.py
|
|
7
|
-
muffin_rest/api.py
|
|
8
|
-
muffin_rest/errors.py
|
|
9
|
-
muffin_rest/filters.py
|
|
10
|
-
muffin_rest/handler.py
|
|
11
|
-
muffin_rest/openapi.py
|
|
12
|
-
muffin_rest/options.py
|
|
13
|
-
muffin_rest/py.typed
|
|
14
|
-
muffin_rest/redoc.html
|
|
15
|
-
muffin_rest/sorting.py
|
|
16
|
-
muffin_rest/swagger.html
|
|
17
|
-
muffin_rest/types.py
|
|
18
|
-
muffin_rest/utils.py
|
|
19
|
-
muffin_rest.egg-info/PKG-INFO
|
|
20
|
-
muffin_rest.egg-info/SOURCES.txt
|
|
21
|
-
muffin_rest.egg-info/dependency_links.txt
|
|
22
|
-
muffin_rest.egg-info/requires.txt
|
|
23
|
-
muffin_rest.egg-info/top_level.txt
|
|
24
|
-
muffin_rest/mongo/__init__.py
|
|
25
|
-
muffin_rest/mongo/filters.py
|
|
26
|
-
muffin_rest/mongo/schema.py
|
|
27
|
-
muffin_rest/mongo/sorting.py
|
|
28
|
-
muffin_rest/mongo/types.py
|
|
29
|
-
muffin_rest/mongo/utils.py
|
|
30
|
-
muffin_rest/peewee/__init__.py
|
|
31
|
-
muffin_rest/peewee/filters.py
|
|
32
|
-
muffin_rest/peewee/openapi.py
|
|
33
|
-
muffin_rest/peewee/options.py
|
|
34
|
-
muffin_rest/peewee/sorting.py
|
|
35
|
-
muffin_rest/peewee/types.py
|
|
36
|
-
muffin_rest/sqlalchemy/__init__.py
|
|
37
|
-
muffin_rest/sqlalchemy/filters.py
|
|
38
|
-
muffin_rest/sqlalchemy/sorting.py
|
|
39
|
-
muffin_rest/sqlalchemy/types.py
|
|
40
|
-
tests/test_base.py
|
|
41
|
-
tests/test_mongo.py
|
|
42
|
-
tests/test_openapi.py
|
|
43
|
-
tests/test_peewee.py
|
|
44
|
-
tests/test_sqlalchemy.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
apispec>=4
|
|
2
|
-
marshmallow>=3.14
|
|
3
|
-
muffin>=0.92
|
|
4
|
-
|
|
5
|
-
[dev]
|
|
6
|
-
pre-commit
|
|
7
|
-
refurb
|
|
8
|
-
bump2version
|
|
9
|
-
|
|
10
|
-
[example]
|
|
11
|
-
uvicorn
|
|
12
|
-
muffin-peewee-aio
|
|
13
|
-
marshmallow-peewee
|
|
14
|
-
|
|
15
|
-
[peewee]
|
|
16
|
-
muffin-peewee-aio>=0.2.2
|
|
17
|
-
marshmallow-peewee>=3.2.0
|
|
18
|
-
|
|
19
|
-
[sqlalchemy]
|
|
20
|
-
muffin-databases>=0.3.2
|
|
21
|
-
marshmallow-sqlalchemy
|
|
22
|
-
sqlalchemy
|
|
23
|
-
|
|
24
|
-
[tests]
|
|
25
|
-
aiosqlite
|
|
26
|
-
marshmallow-peewee>=3.2.0
|
|
27
|
-
marshmallow-sqlalchemy>=0.27.0
|
|
28
|
-
muffin-databases>=0.3.2
|
|
29
|
-
muffin-mongo>=0.3.1
|
|
30
|
-
muffin-peewee-aio
|
|
31
|
-
pytest
|
|
32
|
-
pytest-aio[curio,trio]
|
|
33
|
-
pytest-mypy
|
|
34
|
-
pyyaml
|
|
35
|
-
types-PyYAML
|
|
36
|
-
types-ujson
|
|
37
|
-
ruff
|
|
38
|
-
|
|
39
|
-
[yaml]
|
|
40
|
-
pyyaml
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
muffin_rest
|
muffin-rest-4.4.3/setup.cfg
DELETED