[Python.NET] deprecation of CLR module, implicit assembly loading

Brian Lloyd brian.d.lloyd at gmail.com
Wed Apr 19 02:29:17 CEST 2006


Hi all,

The current SVN (and upcoming releases) includes changes to support a
refactored,
 IronPython-compatible import syntax and assembly load behavior.

Where in releases to date you had to use the magic 'CLR' module as the root
of all
CLR imports, now you can just say:

from System import *

The old 'CLR' syntax is deprecated but will continue to work until pythonnet
3.x.

A second job of the artist-formerly-known-as-the-magic-CLR-module was to
provide a
way to bootstrap CLR support in an existing CPython installation (by
providing a pseudo-
C-extension). In other words, you had to say 'import CLR' before using .NET
from an
stock Python install.

The next releases will continue to include an (upper-case) "CLR" extension
for b/w
compatibility, but it will also include a (lower-case) "clr" module that is
call-compatible
with the clr module from IronPython.

The new "clr" module will provide the IP-compatible AddReference APIs to
support
explicit loading of assembly dependencies, and it will also become the
officially
supported way of bootstrapping CLR support in a stock Python install.

So if you want to use .NET from an existing Python install or ensure that
your code is
portable between IP and PythonNet, you should either arrange for your app to
'import clr'
before using .NET features, or to advise users to add 'import clr' to their
sitecustomize.py.

I've tried hard to look at this from every angle and make sure this is not a
breaking change
for 2.x (though it will be for 3.x), but if you're building on pythonnet and
this will cause
you any problems, please let me know soonest.

- Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20060418/5ce66f34/attachment.html 


More information about the PythonDotNet mailing list