Compare commits
12 Commits
main
...
v1.12.1-fi
Author | SHA1 | Date | |
---|---|---|---|
|
0e991070a5 | ||
|
bf34914a8a | ||
|
4aee715e48 | ||
|
c649905e69 | ||
|
4015c60cfa | ||
|
a1dcc544cf | ||
|
f278629217 | ||
|
4e8fb95c52 | ||
|
27c0d76e16 | ||
|
16ba8caa5b | ||
|
53357214a8 | ||
|
cdcd526fb4 |
11
.gitlab-ci.yml
Normal file
11
.gitlab-ci.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
stages:
|
||||||
|
- package
|
||||||
|
|
||||||
|
publish-pypi:
|
||||||
|
stage: package
|
||||||
|
image: python:3.8
|
||||||
|
script:
|
||||||
|
- pip install -U setuptools wheel pip; pip install invoke
|
||||||
|
- invoke upload --pypi-user ${PYPI_REPO_USER} --pypi-password ${PYPI_REPO_PASSWORD} --pypi-url ${PYPI_REPO_URL}
|
||||||
|
only:
|
||||||
|
- tags
|
@ -1,5 +1,5 @@
|
|||||||
from .view import PydanticView
|
from .view import PydanticView
|
||||||
|
|
||||||
__version__ = "1.12.1"
|
__version__ = "1.12.1-fixed2"
|
||||||
|
|
||||||
__all__ = ("PydanticView", "__version__")
|
__all__ = ("PydanticView", "__version__")
|
||||||
|
@ -15,10 +15,13 @@ def setup(
|
|||||||
enable: bool = True,
|
enable: bool = True,
|
||||||
version_spec: Optional[str] = None,
|
version_spec: Optional[str] = None,
|
||||||
title_spec: Optional[str] = None,
|
title_spec: Optional[str] = None,
|
||||||
|
raise_validation_errors: bool = False,
|
||||||
):
|
):
|
||||||
if enable:
|
if enable:
|
||||||
oas_app = web.Application()
|
oas_app = web.Application()
|
||||||
oas_app["apps to expose"] = tuple(apps_to_expose) or (app,)
|
oas_app["apps to expose"] = tuple(apps_to_expose) or (app,)
|
||||||
|
for a in oas_app["apps to expose"]:
|
||||||
|
a['raise_validation_errors'] = raise_validation_errors
|
||||||
oas_app["index template"] = jinja2.Template(
|
oas_app["index template"] = jinja2.Template(
|
||||||
resources.read_text("aiohttp_pydantic.oas", "index.j2")
|
resources.read_text("aiohttp_pydantic.oas", "index.j2")
|
||||||
)
|
)
|
||||||
|
@ -185,6 +185,8 @@ async def oas_ui(request):
|
|||||||
|
|
||||||
static_url = request.app.router["static"].url_for(filename="")
|
static_url = request.app.router["static"].url_for(filename="")
|
||||||
spec_url = request.app.router["spec"].url_for()
|
spec_url = request.app.router["spec"].url_for()
|
||||||
|
if request.scheme != request.headers.get('x-forwarded-proto', request.scheme):
|
||||||
|
request = request.clone(scheme=request.headers['x-forwarded-proto'])
|
||||||
host = request.url.origin()
|
host = request.url.origin()
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
|
@ -127,7 +127,10 @@ def inject_params(
|
|||||||
else:
|
else:
|
||||||
injector.inject(self.request, args, kwargs)
|
injector.inject(self.request, args, kwargs)
|
||||||
except ValidationError as error:
|
except ValidationError as error:
|
||||||
return await self.on_validation_error(error, injector.context)
|
if self.request.app['raise_validation_errors']:
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
return await self.on_validation_error(error, injector.context)
|
||||||
|
|
||||||
return await handler(self, *args, **kwargs)
|
return await handler(self, *args, **kwargs)
|
||||||
|
|
||||||
|
8
tasks.py
8
tasks.py
@ -136,6 +136,7 @@ def prepare_ci_env(c):
|
|||||||
|
|
||||||
title("Installing wheel", "=")
|
title("Installing wheel", "=")
|
||||||
package_version = read_configuration("./setup.cfg")["metadata"]["version"]
|
package_version = read_configuration("./setup.cfg")["metadata"]["version"]
|
||||||
|
print(Path("dist").glob('*'))
|
||||||
dist = next(Path("dist").glob(f"aiohttp_pydantic-{package_version}-*.whl"))
|
dist = next(Path("dist").glob(f"aiohttp_pydantic-{package_version}-*.whl"))
|
||||||
c.run(f"dist_venv/bin/python -m pip install {dist}")
|
c.run(f"dist_venv/bin/python -m pip install {dist}")
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ def prepare_upload(c):
|
|||||||
|
|
||||||
|
|
||||||
@task(tag_eq_version, prepare_upload)
|
@task(tag_eq_version, prepare_upload)
|
||||||
def upload(c, pypi_user=None, pypi_password=None):
|
def upload(c, pypi_user=None, pypi_password=None, pypi_url=None):
|
||||||
"""
|
"""
|
||||||
Upload on pypi
|
Upload on pypi
|
||||||
"""
|
"""
|
||||||
@ -165,8 +166,9 @@ def upload(c, pypi_user=None, pypi_password=None):
|
|||||||
if pypi_user is not None and pypi_password is not None:
|
if pypi_user is not None and pypi_password is not None:
|
||||||
c.run(
|
c.run(
|
||||||
f"dist_venv/bin/twine upload --non-interactive"
|
f"dist_venv/bin/twine upload --non-interactive"
|
||||||
f" -u {pypi_user} -p {pypi_password} {dist}",
|
f" -u {pypi_user} -p {pypi_password} {dist}"
|
||||||
|
f" --repository-url {pypi_url}",
|
||||||
hide=True,
|
hide=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
c.run(f"dist_venv/bin/twine upload --repository aiohttp-pydantic {dist}")
|
c.run(f"dist_venv/bin/twine upload --repository-url {pypi_url} --repository aiohttp-pydantic {dist}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user