FePy options

FePy has some optional parts you can choose to use or not. These options are provided by fepy package.

For example, you may want to use cipher option, which re-implements parts of Python Cryptoraphy Toolkit written in C using subclasses of SymmetricAlgorithm in .NET Framework. On the other hand, it will only lengthen the already long startup time if you don't need it.

There are two ways to use FePy options. One enables them at the startup time using site.py. The other enables them in the middle of execution, as in the interactive console.

Contents

Startup time usage

IPCE already includes following two lines in site.py, and that's all you need:

import fepy
fepy.install()

This reads the environment variable FEPY_OPTIONS. It is a comma separated list of option names. And then named options are enabled.

If the environment variable is not set, nothing happens and fepy.install() returns immediately.

Interactive usage

Let's have a look at the example:

$ ipy
IronPython 1.1a1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import socket
>>> socket._fileobject
Traceback (most recent call last):
AttributeError: 'module' object has no attribute '_fileobject'

IronPython 1.1a1 does not have an undocumented _fileobject class in socket module. Sadly, urllib2 module is using it anyway. FePy provides fileobject option for this, but how does one enable it in the middle of execution?

Of course, you can quit, set the environment variable, and start again, but you may not want to trash the interactive session if possible. So here's how:

>>> import fepy
>>> fepy.install_option('fileobject')
>>> socket._fileobject
<class '_fileobject._fileobject'>

Here's how to do this at the startup time:

$ export FEPY_OPTIONS=fileobject
$ ipy
IronPython 1.1a1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import socket
>>> socket._fileobject
<class '_fileobject._fileobject'>

Available options

ast
Support for compiler.parse using the internal parser of IronPython.
cipher
Support for Python Cryptoraphy Toolkit.
codecs_errors
Support for built-in codec error handling callbacks, ignore, xmlcharrefreplace, and backslashreplace. The stock IronPython provides strict and replace.
encoding
Support for standard encodings like base64 and hex.
fileobject
Support for socket._fileobject class.
network
Use FePy's version of socket, select, and ssl module.
pth_support
Support for .pth files and site-packages directory.
regex
Support for using pure Python regex engine _sre.py. You may want to try this if you are hit by bugs in IronPython's re module.