-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Add pythonSrcRoot option to python servers (aiohttp/flask/blueplanet) to support src/ layout projects [and reenable/fix all python server tests] #5423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
spacether
merged 22 commits into
OpenAPITools:master
from
cognifloyd:python_connexion_src_layout
Apr 8, 2020
Merged
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
76d54f7
python server: Add pythonSrcRoot option
cognifloyd fd751e9
python server: update template files to support pythonSrcRoot
cognifloyd 7df485f
python server: update docs to add pythonSrcRoot option
cognifloyd 9e7a2a3
python server: add pythonSrcRoot sample script
cognifloyd a440404
python server: build sample srclayout project
cognifloyd 0bbd2b7
[Python] copy test files preserving history
cognifloyd 23a64a7
[Python] Make a conflict to preserve file copy history
cognifloyd 0e32620
Merge branch to finish copying python test files
cognifloyd a649ac4
[Python] customize pom.xml for src layout tests
cognifloyd ef999c2
[Python] add python-aiohttp-srclayout tests
cognifloyd b03adef
[Python] Fix server tests by updating requirements
cognifloyd 458de3f
[Python] Copy setup.py to python-aiohttp
cognifloyd c768797
[Python] Save history while copying setup.py to python-aiohttp
cognifloyd 422022a
[Python] Merge copied setup.py
cognifloyd b791fff
[Python] Add aiohttp server setup.py
cognifloyd 8a63a5c
[Python] Fix python server tests with src layout
cognifloyd 0398827
[Python] bump Flask-Testing version
cognifloyd 8dbc5f6
[Python] Pin pyyaml for py2.7 flask server
cognifloyd ef44596
[Python] simplify flask server requirements
cognifloyd 743a618
consolidate server tests
cognifloyd 2f5148b
[Python] rebuild python server samples
cognifloyd 85665f1
[Python] Fix python server requirements for older pythons
cognifloyd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/bin/sh | ||
|
|
||
| SCRIPT="$0" | ||
| echo "# START SCRIPT: $SCRIPT" | ||
|
|
||
| while [ -h "$SCRIPT" ] ; do | ||
| ls=`ls -ld "$SCRIPT"` | ||
| link=`expr "$ls" : '.*-> \(.*\)$'` | ||
| if expr "$link" : '/.*' > /dev/null; then | ||
| SCRIPT="$link" | ||
| else | ||
| SCRIPT=`dirname "$SCRIPT"`/"$link" | ||
| fi | ||
| done | ||
|
|
||
| if [ ! -d "${APP_DIR}" ]; then | ||
| APP_DIR=`dirname "$SCRIPT"`/.. | ||
| APP_DIR=`cd "${APP_DIR}"; pwd` | ||
| fi | ||
|
|
||
| executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" | ||
|
|
||
| if [ ! -f "$executable" ] | ||
| then | ||
| mvn -B clean package | ||
| fi | ||
|
|
||
| generator=python-aiohttp | ||
| input=modules/openapi-generator/src/test/resources/2_0/petstore.yaml | ||
| out_folder=samples/server/petstore/${generator}-srclayout | ||
| resources=modules/openapi-generator/src/main/resources/${generator} | ||
|
|
||
| # if you've executed sbt assembly previously it will use that instead. | ||
| export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" | ||
| ags="generate -t $resources -i $input -g $generator -o $out_folder --additional-properties pythonSrcRoot=src $@" | ||
|
|
||
| rm -rf $out_folder/.openapi* | ||
| rm -rf $out_folder/openapi_server | ||
| rm -rf $out_folder/tests* | ||
| rm $out_folder/README.md | ||
| rm $out_folder/requirements.txt | ||
| rm $out_folder/test-requirements.txt | ||
|
|
||
| java $JAVA_OPTS -jar $executable $ags |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| #!/bin/sh | ||
|
|
||
| ./bin/python-server-aiohttp-petstore.sh | ||
| ./bin/python-server-aiohttp-srclayout-petstore.sh | ||
| ./bin/python-server-flask-petstore.sh | ||
| ./bin/python-server-flask-petstore-python2.sh | ||
| ./bin/python-server-blueplanet-petstore.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
modules/openapi-generator/src/main/resources/python-aiohttp/requirements.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| connexion[aiohttp,swagger-ui] == 2.0.2 | ||
| swagger-ui-bundle == 0.0.2 | ||
| aiohttp_jinja2 == 1.1.0 | ||
| connexion[aiohttp,swagger-ui] == 2.6.0 | ||
| swagger-ui-bundle == 0.0.6 | ||
| aiohttp_jinja2 == 1.2.0 | ||
40 changes: 40 additions & 0 deletions
40
modules/openapi-generator/src/main/resources/python-aiohttp/setup.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # coding: utf-8 | ||
|
|
||
| import sys | ||
| from setuptools import setup, find_packages | ||
|
|
||
| NAME = "{{packageName}}" | ||
| VERSION = "{{packageVersion}}" | ||
| {{#apiInfo}}{{#apis}}{{^hasMore}} | ||
| # To install the library, run the following | ||
| # | ||
| # python setup.py install | ||
| # | ||
| # prerequisite: setuptools | ||
| # http://pypi.python.org/pypi/setuptools | ||
|
|
||
| REQUIRES = [ | ||
| "connexion==2.6.0", | ||
| "swagger-ui-bundle==0.0.6", | ||
| "aiohttp_jinja2==1.2.0", | ||
| ] | ||
|
|
||
| setup( | ||
| name=NAME, | ||
| version=VERSION, | ||
| description="{{appName}}", | ||
| author_email="{{infoEmail}}", | ||
| url="{{packageUrl}}", | ||
| keywords=["OpenAPI", "{{appName}}"], | ||
| install_requires=REQUIRES, | ||
| packages=find_packages({{#pythonSrcRoot}}"{{{.}}}"{{/pythonSrcRoot}}),{{#pythonSrcRoot}} | ||
| package_dir={"": "{{{.}}}"},{{/pythonSrcRoot}} | ||
| package_data={'': ['{{#pythonSrcRoot}}{{{.}}}/{{/pythonSrcRoot}}openapi/openapi.yaml']}, | ||
| include_package_data=True, | ||
| entry_points={ | ||
| 'console_scripts': ['{{packageName}}={{packageName}}.__main__:main']}, | ||
| long_description="""\ | ||
| {{appDescription}} | ||
| """ | ||
| ) | ||
| {{/hasMore}}{{/apis}}{{/apiInfo}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
14 changes: 12 additions & 2 deletions
14
modules/openapi-generator/src/main/resources/python-flask/requirements.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,20 @@ | ||
| connexion >= 2.6.0; python_version>="3.6" | ||
| connexion >= 2.3.0; python_version=="3.5" | ||
| connexion >= 2.3.0; python_version=="3.4" | ||
| # connexion 2.6 dropped support for python < 3.6 | ||
| connexion >= 2.3.0; python_version=="3.5" or python_version=="3.4" | ||
spacether marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {{#supportPython2}} | ||
| connexion == 2.4.0; python_version<="2.7" | ||
| {{/supportPython2}} | ||
| # connexion requires werkzeug but connexion < 2.4.0 does not install werkzeug | ||
| # we must peg werkzeug versions below to fix connexion | ||
| # https://github.com/zalando/connexion/pull/1044 | ||
| werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4" | ||
| swagger-ui-bundle >= 0.0.2 | ||
| python_dateutil >= 2.6.0 | ||
| {{#supportPython2}} | ||
| typing >= 3.5.2.2 | ||
| # For specs with timestamps, pyyaml 5.3 broke connexion's spec parsing in python 2. | ||
| # Connexion uses copy.deepcopy() on the spec, thus hitting this bug: | ||
| # https://github.com/yaml/pyyaml/issues/387 | ||
| pyyaml < 5.3; python_version<="2.7" | ||
| {{/supportPython2}} | ||
| setuptools >= 21.0.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
modules/openapi-generator/src/main/resources/python-flask/tox.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| [tox] | ||
| envlist = {{#supportPython2}}py27, {{/supportPython2}}py3 | ||
| skipsdist=True | ||
|
|
||
| [testenv] | ||
| deps=-r{toxinidir}/requirements.txt | ||
| -r{toxinidir}/test-requirements.txt | ||
| {toxinidir} | ||
|
|
||
| commands= | ||
| {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}} | ||
| {{^useNose}}pytest --cov={{{pythonSrcRoot}}}{{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.