High-performance web service framework
Project description
Summary
Smisk is a simple, high-performance and scalable web service framework written in C, but controlled by Python.
It is designed to widen the common bottle necks in heavy-duty web services.
More information at the Smisk website
Getting Started
Install with easy_install smisk, download from PyPI or use a Debian package
Have a look at a few examples
Examples
This is a minimal Smisk service:
from smisk.core import Application class MyApp(Application): def service(self): self.response.headers = ['Content-Type: text/plain'] self.response("Hello World!") MyApp().run()
And here we have a WSGI compatible application:
from smisk.wsgi import * def hello_app(env, start_response): start_response("200 OK", [('Content-Type', 'text/plain')]) return ["Hello, World!"] main(hello_app)
More examples available here…
Changes
1.1.3
Fixed a bug with parameter keys not being normalized to unicode.
Reworked Elixir/SQLAlchemy handling of sessions during HTTP transactions.
Only a subset of the built-in serializers are loaded by default, rather than all. There’s a new module called smisk.serialization.all which can be imported in order to load all built-in serializers.
Serializers now need to excplicitly specify their read/write capabilities using two boolean attributes: can_serialize and can_unserialize. BaseSerializer defines both of these as False.
plist serializer reworked to use plistlib, which has been modified to support serialization of Elixir Entities (database objects).
New generic XML serializer smisk.serialization.xmlgeneric (not loaded by default).
smisk.mvc.Request instances have a new attribute called cn_url. The value is a smisk.core.URL instance which is guaranteed not to include any filename extension. cn_url is a copy of Request.url if the request was made without the canonical path (i.e. not including filename extension. “/foo/bar” instead of “/foo/bar.json”). Otherwise cn_url is a modified copy of url. This is useful for building paths based on the request path wihout having to know if there’s a filename extension involved or not.
Leaf filters can now be created as pythonic decorators using the aiding decorator leaf_filter, found in smisk.mvc.decorators. See http://python-smisk.org/docs/1.1.3/library/smisk.mvc.html#leaf-filters for more information.
The previously built-in crash reporter is no longer built by default. Can be enabled by defining the macro SMISK_ENABLE_CRASH_REPORTING 1 (more info in src/config.h).
Major documentation update.
Various minor fixes.
1.1.2
Inter-process communication module smisk.ipc, providing a shared dictionary which can be concurrently manipulated by a set of processes.
Berkely DB module smisk.core.bsddb
Benchmark utility module smisk.util.benchmark exposes an iterator which can be used to easily benchmark snippets of code.
The key-value store example application now uses the shared dictionary provided by smisk.ipc.
smisk.core.Request have two soft limits – max_multipart_size and max_formdata_size – for limiting automatically handled input data size. These soft limits can also be used to disable the automated parsing of Smisk.
smisk.util.cache has a new function – app_shared_key – returning a byte string which can be used to uniqely identify the application. The key is based on the entry file (the python file in which __name__ == “__main__”).
smisk.util.type exposes MutableMapping – in Python >=2.6 this is collections.MutableMapping, in Python >=2.3 it is UserDict.DictMixin.
Serializers no longer emit warning.warn-messages when no suiting implementations are available. Now they are simply not registered whitout as much as a whisper.
In the C library, the macro SMISK_PyString_Check has changed name to SMISK_STRING_CHECK (however it still does the exact same thing as before, just that in preparation for porting Smisk to Python 3, we need to sort out the different meanings of “bytes strings” and “character strings”)
In the C library, we use PyBytes instead of PyString and NUMBER_* instead of some PyInt-functions, having macros for Python <2.5. This is a step toward the Python 3 port.
smisk.core is now stored as _smisk and imported by smisk/core/__init__.py. This follows the naming custom of other machine-native modules as well as provides better name (i.e. _smisk.so instead of core.so) in various listings.
Fixed a bug in smisk.core where a www-form-urlencoded request with incorrect content length and the first key was longer than the provided content length, smisk would induce strange errors (because trying to set NULL into a python dict).
1.1.1
Fully unicode on the inside – request.get, .post, .cookies, etc return unicode values and where dictionary keys are used, which have been translated from the outside world, they are guranteeded to be encoded as UTF-8. (Dictionary keys used as keyword arguments must be str in Python <=2.5)
YAML read/write-serialization #21 [a72dc2f0855b]
Handles and reconnects dead MySQL-connections. #23 [49cb2034a8b1]
No longer stores empty parts as None from multipart messages. #15 [d9920fb75ca2]
Makes full use of HTTP 1.1 request methods (OPTIONS, GET, HEAD, PUT, POST, DELETE). See example application: examples/mvc/key-value-store/
smisk.mvc.model no longer disposes SA/Elixir sessions for each request, but tries to reuse a session as long as no error occur.
redirect_to() respects and retains explicit request format, denoted by path extension in the original request.
smisk.test.live introduces “live” tests, running a server and a client, measuring communication and effects.
1.1.0
MVC module – smisk.mvc.
Better unicode support.
Compatible with Debian Etch.
Host server URL rewrites now propagating correctly.
1.0.1
Full WSGI support – passes the wsgiref validation tests.
Iterable request makes reading input data simple.
Stream implements writelines for optimized sending of chunks of strings.
Response implements a Stream.writelines proxy, automatically calling begin().
Callable response makes responses simpler. Based on writelines.
Fixed a bug where smisk_multipart_parse_file would try to fclose a uninitialized fd. [11c4ffae718f]
1.0.0
First stable version
License
Copyright (c) 2007-2009 Rasmus Andersson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Download
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.