Skip to content
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

Spyne in Google App Engine. #438

Closed
wants to merge 1 commit into from
Closed

Spyne in Google App Engine. #438

wants to merge 1 commit into from

Conversation

neriksso
Copy link

Recently I had to include SOAP service within Django app that was running in Google App Engine. There aren't many good SOAP libraries for python and even fewer work within the GAE sandbox. Spyne seems to be the best library out there, so I decided to try to modify it to work inside the GAE sandbox. Fortunately, it didn't require too many changes to the library.

Python module mmap is not supported inside GAE, therefore added a catch for the ImportError and an assert upon mmap usage.
Also, refactored build_validation_schema to use memcache and StringIO when tempfile.mkdtemp raises NotImplementedError.
(In GAE, tempfile.TemporaryFile is an alias for StringIO)

Tested with helloworld soap example with normal WSGI app and Django.

Python module mmap is not supported inside GAE, therefore added a catch for the ImportError and an assert upon mmap usage.
Also, refactored build_validation_schema to use memcache and StringIO when tempfile.mkdtemp raises NotImplementedError.
(In GAE, tempfile.TemporaryFile is an alias for StringIO)
@landscape-bot
Copy link

Code Health
Repository health increased by 0.01% when pulling 7aad1d2 on neriksso:feature/gae into 6e7ac77 on arskom:master.

@plq
Copy link
Member

plq commented May 21, 2015

Interesting, thanks for the patch.

You don't need a plan b for when mmap is missing? Large requests need mmap for some transports.

@neriksso
Copy link
Author

You probably do need a plan b for those cases, hence I added the asserts to inform when that occurs. Would probably need to build some sort of replacement with StringIO perhaps? GAE needs pure python libraries and therefore mmap is not available in its sandbox..

@plq
Copy link
Member

plq commented May 21, 2015

GAE needs pure python libraries and therefore mmap is not available in its sandbox..

I thought mmap was part of stdlib?

@neriksso
Copy link
Author

Yes, it is part of the stdlib but it is disabled in GAE, sorry for the confusion. I was trying to say that you can't include it manually as it is a c extension, if I'm not terribly mistaken?

All code for the Python runtime environment must be pure Python, and not include any C extensions or other code that must be compiled.

The environment includes the Python standard library. Some modules have been disabled because their core functions are not supported by App Engine, such as networking or writing to the filesystem. In addition, the os module is available, but with unsupported features disabled. An attempt to import an unsupported module or use an unsupported feature will raise an exception.

A few modules from the standard library have been replaced or customized to work with App Engine. These modules vary between the two Python runtimes, as described below.

I don't know the specifics of the mmap module but I would guess it is using the file system which is why it is disabled.

@landscape-bot
Copy link

Code Health
Repository health decreased by 0.53% when pulling 7aad1d2 on neriksso:feature/gae into b35f6c2 on arskom:master.

@neriksso neriksso closed this Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants