From 04ace4cc72ac26ed019e6a3a8dc31af8e0e59ff8 Mon Sep 17 00:00:00 2001 From: Pablo <48098178+PabloRuizCuevas@users.noreply.github.com> Date: Thu, 21 Jul 2022 10:53:23 +0200 Subject: [PATCH 1/9] Supported kargs in versioned documentation Till now some arguments of FastAPI where not working, like: description="Core API", swagger_ui_parameters={"docExpansion": "none"}, This issue is yet fixed --- fastapi_versioning/versioning.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fastapi_versioning/versioning.py b/fastapi_versioning/versioning.py index 0f282d2..7a55943 100644 --- a/fastapi_versioning/versioning.py +++ b/fastapi_versioning/versioning.py @@ -37,6 +37,9 @@ def VersionedFastAPI( title=app.title, **kwargs, ) + args = {arg: value for arg, value in kwargs.items() if + arg not in ['title', 'description', 'version']} + version_route_mapping: Dict[Tuple[int, int], List[APIRoute]] = defaultdict( list ) @@ -57,6 +60,7 @@ def VersionedFastAPI( title=app.title, description=app.description, version=semver, + **args ) for route in version_route_mapping[version]: for method in route.methods: @@ -80,6 +84,7 @@ def noop() -> None: title=app.title, description=app.description, version=semver, + **args ) for route in unique_routes.values(): versioned_app.router.routes.append(route) From f8ffa40a060f0528de2067d2b789e2799f3c5e9f Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 13:50:13 +0200 Subject: [PATCH 2/9] req --- requirements.txt | 132 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5739c2b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,132 @@ +anyio==3.6.2 +argon2-cffi==21.3.0 +argon2-cffi-bindings==21.2.0 +arrow==1.2.3 +asttokens==2.2.1 +attrs==22.2.0 +Babel==2.11.0 +backcall==0.2.0 +bcrypt==4.0.1 +beautifulsoup4==4.11.1 +bleach==5.0.1 +certifi==2022.12.7 +cffi==1.15.1 +charset-normalizer==3.0.1 +click==8.1.3 +cloudpickle==2.2.1 +comm==0.1.2 +contourpy==1.0.7 +cryptography==39.0.0 +cycler==0.11.0 +debugpy==1.6.5 +decorator==5.1.1 +defusedxml==0.7.1 +entrypoints==0.4 +et-xmlfile==1.1.0 +exceptiongroup==1.1.0 +executing==1.2.0 +fastapi==0.95.0 +fastjsonschema==2.16.2 +fonttools==4.38.0 +fqdn==1.5.1 +greenlet==2.0.1 +h11==0.14.0 +httptools==0.5.0 +idna==3.4 +iniconfig==2.0.0 +ipykernel==6.20.2 +ipytest==0.13.0 +ipython==8.8.0 +ipython-genutils==0.2.0 +isoduration==20.11.0 +jedi==0.18.2 +Jinja2==3.1.2 +json5==0.9.11 +jsonpointer==2.3 +jsonschema==4.17.3 +jupyter-events==0.6.3 +jupyter_client==7.4.9 +jupyter_core==5.1.3 +jupyter_server==2.1.0 +jupyter_server_terminals==0.4.4 +jupyterlab==3.5.2 +jupyterlab-pygments==0.2.2 +jupyterlab_server==2.19.0 +kiwisolver==1.4.4 +MarkupSafe==2.1.1 +matplotlib==3.7.0 +matplotlib-inline==0.1.6 +mistune==2.0.4 +mypy-extensions==1.0.0 +nbclassic==0.4.8 +nbclient==0.7.2 +nbconvert==7.2.8 +nbformat==5.7.3 +nest-asyncio==1.5.6 +notebook==6.5.2 +notebook_shim==0.2.2 +numpy==1.24.1 +openpyxl==3.1.1 +packaging==23.0 +pandas==1.5.2 +pandera==0.13.4 +pandocfilters==1.5.0 +paramiko==2.12.0 +parso==0.8.3 +pexpect==4.8.0 +pickleshare==0.7.5 +Pillow==9.4.0 +platformdirs==2.6.2 +pluggy==1.0.0 +prometheus-client==0.15.0 +prompt-toolkit==3.0.36 +psutil==5.9.4 +ptyprocess==0.7.0 +pure-eval==0.2.2 +pycparser==2.21 +pydantic==1.10.4 +pygad==2.19.2 +Pygments==2.14.0 +PyNaCl==1.5.0 +pyodbc==4.0.35 +pyparsing==3.0.9 +pyrsistent==0.19.3 +pytest==7.2.1 +python-dateutil==2.8.2 +python-dotenv==1.0.0 +python-json-logger==2.0.4 +pytz==2022.7.1 +PyYAML==6.0 +pyzmq==25.0.0 +requests==2.28.2 +rfc3339-validator==0.1.4 +rfc3986-validator==0.1.1 +scipy==1.10.1 +seaborn==0.12.2 +Send2Trash==1.8.0 +six==1.16.0 +sniffio==1.3.0 +soupsieve==2.3.2.post1 +SQLAlchemy==1.4.31 +stack-data==0.6.2 +starlette==0.26.1 +terminado==0.17.1 +tinycss2==1.2.1 +tomli==2.0.1 +tornado==6.2 +traitlets==5.8.1 +typing-inspect==0.8.0 +typing_extensions==4.4.0 +uri-template==1.2.0 +urllib3==1.26.14 +uuid==1.30 +uvicorn==0.21.1 +uvloop==0.17.0 +watchfiles==0.19.0 +wcwidth==0.2.6 +webcolors==1.12 +webencodings==0.5.1 +websocket-client==1.4.2 +websockets==10.4 +wrapt==1.15.0 +XlsxWriter==3.0.8 From d0fd504e88f5c9c05471c138da520f36dca79150 Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 13:57:12 +0200 Subject: [PATCH 3/9] setup --- setup.cfg | 19 +++++++++++++++++++ setup.py | 26 +------------------------- 2 files changed, 20 insertions(+), 25 deletions(-) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..73f3ca8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,19 @@ +[metadata] +description = This package provides the input and output schemas used by the CoreAPI in its endpoints +name = fast-api-versioning +version = 1.0.0 +author = Imogate +license = MIT +license_files = LICENSE +classifiers = + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 + +[options] +package_dir = + = src +packages = find: + +[options.packages.find] +where=src +exclude = tests* diff --git a/setup.py b/setup.py index 16a2418..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,3 @@ from setuptools import setup -with open("README.md", "r") as fh: - long_description = fh.read() - -setup( - name="fastapi_versioning", - version="0.10.0", - author="Dean Way", - description="api versioning for fastapi web applications", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/DeanWay/fastapi-versioning", - packages=["fastapi_versioning"], - classifiers=[ - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - install_requires=[ - "fastapi>=0.56.0", - "starlette", - ], - python_requires=">=3.6", -) +setup() From d0671e22aa799d724f4654597691a61006c53a90 Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 14:09:54 +0200 Subject: [PATCH 4/9] pipeline --- azure-pipelines.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..813be41 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,29 @@ +# Python package + +trigger: +- PROD + +pool: + vmImage: ubuntu-latest + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.10' + displayName: 'Use Python 3.10' + +- script: | + python -m pip install --upgrade pip build setuptools twine + pip install -r requirements.txt + displayName: 'Install dependencies' + +- script: | + python -m build + displayName: 'build project' + +- task: TwineAuthenticate@1 + inputs: + artifactFeed: 'APIs/fast-api-versioning' + +- script: | + twine upload -r "fast-api-versioning" --config-file $(PYPIRC_PATH) dist/* From 3c04f3f8e39246193283a79306d058136be76a38 Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 14:21:59 +0200 Subject: [PATCH 5/9] package --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 73f3ca8..d2c2a17 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,7 @@ classifiers = [options] package_dir = - = src + = fastapi-versioning packages = find: [options.packages.find] From b45c82225f662e3bd8453b842b7e5356ca33a98d Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 14:38:04 +0200 Subject: [PATCH 6/9] fixed src --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index d2c2a17..8859ba0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,7 @@ classifiers = [options] package_dir = - = fastapi-versioning + = fastapi_versioning packages = find: [options.packages.find] From e13954c66bf924d51e80ff4a0329c150a363242b Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 15:04:28 +0200 Subject: [PATCH 7/9] dep --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 813be41..1de9a53 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,7 @@ # Python package trigger: -- PROD +- master pool: vmImage: ubuntu-latest @@ -23,7 +23,7 @@ steps: - task: TwineAuthenticate@1 inputs: - artifactFeed: 'APIs/fast-api-versioning' + artifactFeed: 'APIs/core-api-dependencies' - script: | twine upload -r "fast-api-versioning" --config-file $(PYPIRC_PATH) dist/* From e6a862ee34cff02320ee5219c396409889f552fb Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 15:18:17 +0200 Subject: [PATCH 8/9] test --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1de9a53..7691e44 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,4 +26,4 @@ steps: artifactFeed: 'APIs/core-api-dependencies' - script: | - twine upload -r "fast-api-versioning" --config-file $(PYPIRC_PATH) dist/* + twine upload -r "core-api-dependencies" --config-file $(PYPIRC_PATH) dist/* From 63be6ad9d8eba2d10dc54fe2bc8d13cec732c03e Mon Sep 17 00:00:00 2001 From: pablo Date: Tue, 25 Jul 2023 16:20:45 +0200 Subject: [PATCH 9/9] name --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 8859ba0..3bd58d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] description = This package provides the input and output schemas used by the CoreAPI in its endpoints -name = fast-api-versioning -version = 1.0.0 +name = fastapi_versioning +version = 1.0.1 author = Imogate license = MIT license_files = LICENSE