New release / v2.0

6 views
Skip to first unread message

Richard Tew

unread,
Apr 4, 2009, 10:37:02 PM4/4/09
to py-livecoding
Hi,

I've just released version 2.0, the rewrite. Everything I could think
of was done.

http://code.google.com/p/livecoding/

The released code is for Python 2.6. Python 3.0+ removes some of the
constraints which make code reloading hard. However, while the reload
builtin has been moved to a module, it still looks like it leaves
broken modules in place in event of an importation error. I don't use
Python 3.0 at this time, so I have no need to devote the extra time to
port the module.

Cheers,
Richard.

Alia K

unread,
Apr 20, 2009, 9:40:28 AM4/20/09
to py-livecoding
Richard Tew wrote:

> The released code is for Python 2.6.  Python 3.0+ removes some of the
> constraints which make code reloading hard.  However, while the reload
> builtin has been moved to a module, it still looks like it leaves
> broken modules in place in event of an importation error. I don't use
> Python 3.0 at this time, so I have no need to devote the extra time to
> port the module.

First of all, thanks for creating a very interesting and useful
module.

I have a couple of questions:

(1) Is it absolutely necessary that this module is 2.6 specific, as
there's an awful lot of code out there which is still in 2.5 land...
If not, would it be difficult to port to 2.5.4?

(2) I ran the test_reloading.py file with 2.6.2 (on mac os x leopard)
and received the following test failures:

<snip>

$ python2.6 test_reloading.py
WARNING:root:TODO, implement leakage compatibility case
..F...........E
======================================================================
ERROR: testUpdateSameFileReload_FunctionUpdate
(__main__.CodeReloadingObstacleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_reloading.py", line 551, in
testUpdateSameFileReload_FunctionUpdate
newScriptFile = self.ReloadScriptFile(scriptDirectory,
scriptDirPath, "functions.py", mangleCallback=cb)
File "test_reloading.py", line 100, in ReloadScriptFile
result = self.codeReloader.ReloadScript(oldScriptFile)
File "/Users/sa/Code/src/livecoding/reloader.py", line 126, in
ReloadScript
newScriptFile = self.CreateNewScript(oldScriptFile)
File "/Users/sa/Code/src/livecoding/reloader.py", line 142, in
CreateNewScript
newScriptFile = scriptDirectory.LoadScript(filePath,
namespacePath)
File "/Users/sa/Code/src/livecoding/namespace.py", line 316, in
LoadScript
return self.scriptFileClass(filePath, namespacePath)
File "/Users/sa/Code/src/livecoding/namespace.py", line 29, in
__init__
self.Load(filePath)
File "/Users/sa/Code/src/livecoding/namespace.py", line 38, in Load
self.codeObject = compile(script, self.filePath, "exec")
File "/Users/sa/Code/src/livecoding/scripts/functions.py", line 2

^
SyntaxError: invalid syntax

======================================================================
FAIL: testFileChangeDetection (__main__.CodeReloaderSupportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_reloading.py", line 788, in testFileChangeDetection
self.failUnless(game.FileChangeFunction.__doc__ == " new version
", "Updated function doc string value still the original one")
AssertionError: Updated function doc string value still the original
one

----------------------------------------------------------------------
Ran 15 tests in 0.431s

FAILED (failures=1, errors=1)

</snip>

Is this expected?

Best,

AliaK

Richard Tew

unread,
Apr 20, 2009, 11:53:27 AM4/20/09
to py-liv...@googlegroups.com
On Mon, Apr 20, 2009 at 9:40 AM, Alia K <alia_...@yahoo.com> wrote:
> First of all, thanks for creating a very interesting and useful
> module.
>
> I have a couple of questions:
>
> (1) Is it absolutely necessary that this module is 2.6 specific, as
> there's an awful lot of code out there which is still in 2.5 land...
> If not, would it be difficult to port to 2.5.4?

I could swear I tested this with 2.5 and there was only one function
which was problematic (os.path.relpath or something). Feel free to
submit a bug and I'll get around to dealing with this as I have time.

> (2) I ran the test_reloading.py file with 2.6.2 (on mac os x leopard)
> and received the following test failures:

Strange. The tests passed fine for me. Maybe the file change
detection faking in the unit test is not compatible on operating
systems other than Windows. Again, submit a bug and I'll get around
to dealing with it as I have time.

Patches are welcome of course! :-)

Cheers,
Richard.

Alia K

unread,
Apr 20, 2009, 4:36:05 PM4/20/09
to py-livecoding
Richard wrote:

> I could swear I tested this with 2.5 and there was only one function
> which was problematic (os.path.relpath or something).  Feel free to
> submit a bug and I'll get around to dealing with this as I have time.

Yup, it was os.path.relpath that broke.

> > (2) I ran the test_reloading.py file with 2.6.2 (on mac os x leopard)
> > and received the following test failures:
>
> Strange.  The tests passed fine for me.  Maybe the file change
> detection faking in the unit test is not compatible on operating
> systems other than Windows.  Again, submit a bug and I'll get around
> to dealing with it as I have time.
>
> Patches are welcome of course! :-)

Thanks. (-:

AK

Richard Tew

unread,
Apr 20, 2009, 9:48:47 PM4/20/09
to py-liv...@googlegroups.com
On Mon, Apr 20, 2009 at 4:36 PM, Alia K <alia_...@yahoo.com> wrote:
> Richard wrote:
>> I could swear I tested this with 2.5 and there was only one function
>> which was problematic (os.path.relpath or something).  Feel free to
>> submit a bug and I'll get around to dealing with this as I have time.
>
> Yup, it was os.path.relpath that broke.

I can't reproduce the syntax error. I've even examined the bytes
within the script and it looks fine to me.

Cheers,
Richard.

Alia K

unread,
Apr 23, 2009, 5:46:48 AM4/23/09
to py-livecoding


Richard wrote:

> I can't reproduce the syntax error.  I've even examined the bytes
> within the script and it looks fine to me.

I was able to reproduce the syntax error using ubuntu 8.10 on a
virtual machine with python 2.5.4 off a fresh svn checkout (rev 113):

WARNING:root:TODO, implement leakage compatibility case
..F...........E
======================================================================
ERROR: testUpdateSameFileReload_FunctionUpdate
(__main__.CodeReloadingObstacleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_reloading.py", line 551, in
testUpdateSameFileReload_FunctionUpdate
newScriptFile = self.ReloadScriptFile(scriptDirectory,
scriptDirPath, "functions.py", mangleCallback=cb)
File "test_reloading.py", line 100, in ReloadScriptFile
result = self.codeReloader.ReloadScript(oldScriptFile)
File "/home/user/Code/livecoding/reloader.py", line 126, in
ReloadScript
newScriptFile = self.CreateNewScript(oldScriptFile)
File "/home/user/Code/livecoding/reloader.py", line 142, in
CreateNewScript
newScriptFile = scriptDirectory.LoadScript(filePath,
namespacePath)
File "/home/user/Code/livecoding/namespace.py", line 315, in
LoadScript
return self.scriptFileClass(filePath, namespacePath)
File "/home/user/Code/livecoding/namespace.py", line 29, in __init__
self.Load(filePath)
File "/home/user/Code/livecoding/namespace.py", line 38, in Load
self.codeObject = compile(script, self.filePath, "exec")
File "/home/user/Code/livecoding/scripts/functions.py", line 2

^
SyntaxError: invalid syntax

======================================================================
FAIL: testFileChangeDetection (__main__.CodeReloaderSupportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_reloading.py", line 788, in testFileChangeDetection
self.failUnless(game.FileChangeFunction.__doc__ == " new version
", "Updated function doc string value still the original one")
AssertionError: Updated function doc string value still the original
one

----------------------------------------------------------------------
Ran 15 tests in 0.273s

FAILED (failures=1, errors=1)
user@desktop:~/Code/livecoding/tests$



Richard Tew

unread,
Apr 24, 2009, 9:05:29 PM4/24/09
to py-liv...@googlegroups.com
On Thu, Apr 23, 2009 at 5:46 AM, Alia K <alia_...@yahoo.com> wrote:
>> I can't reproduce the syntax error.  I've even examined the bytes
>> within the script and it looks fine to me.
>
> I was able to reproduce the syntax error using ubuntu 8.10 on a
> virtual machine with python 2.5.4 off a fresh svn checkout (rev 113):

Fixed. This error was caused because the resolution of the mtime
attribute of files on Linux appears to be the current second. On
Windows, it is to a higher resolution. So in order to get the unit
tests to work, I need to stall before changing a file...

Thanks for the bug report. All the tests pass for me on Linux now.

Cheers,
Richard.

Reply all
Reply to author
Forward
0 new messages