installing pythoscope without setuptools

Asked by Rex Turnbull

I would like to install pythoscope. My python is not registered in windows so I can't install the setuptools. I have nose and python 2.5.1.
Is there a simple way to install 'by hand'?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Pythoscope Edit question
Assignee:
No assignee Edit question
Solved by:
Michal Kwiatkowski
Solved:
Last query:
Last reply:
Revision history for this message
Best Michal Kwiatkowski (ruby) said :
#1

Sorry for this long delay, I thought Answers were disabled for Pythoscope. Launchpad doesn't always work as expected...

Pythoscope doesn't have any external dependencies, so to make it work without setuptools you have to do two things:

1. Put pythoscope/ and lib2to3/ directories from the source package into your PYTHONPATH, usually something like /usr/lib/python2.5/site-packages/ on Linux or C:\Python\Lib\site-packages on Windows.

2. Create a pythoscope.py script with the following contents:

    from pythoscope import main
    main()

After that you should be able to run pythoscope with "python pythoscope.py".

One more thing, you may have problems using dynamic analysis on Python 2.5.1. For details please see this post http://groups.google.com/group/pythoscope/browse_thread/thread/9c4df74d2a396b1 on the Pythoscope google group. BTW, you may also ask questions there, if you prefer.

Revision history for this message
Rex Turnbull (rex-dicad) said :
#2

Thanks Michal Kwiatkowski, that solved my question.

Revision history for this message
Rex Turnbull (rex-dicad) said :
#3

These additional notes should help others in a similar situation (if there are any):

(These apply to OS Windows where python is not registered)

Save pythoscope.bat to a directory listed in path (I use c:\bat)
---
@echo off
rem c:\bat\pythoscope.bat
rem calls pythoscope and makes it run for all files listed
if '%1' == '' goto usage

if not exist ".pythoscope" md ".pythoscope"
del ".pythoscope\project.pickle"

c:\mypathtopython\python.exe c:\mypathtopython\lib\site-packages\pythoscope.py --init %1 %2 %3 %4 %5 %6 %7 %8 %9
c:\mypathtopython\python.exe c:\mypathtopython\lib\site-packages\pythoscope.py %1 %2 %3 %4 %5 %6 %7 %8 %9

goto exit
:usage
@echo off
@echo pythoscope creates unittest stubs for up to 9 python files at once
@echo change directories to where the files are you want analysed and type
@echo --- ---
@echo pythoscope filename1.py [filename2.py filename3.py ... filename9.py]
@echo --- ---
:exit
---

This creates the directory '.pythoscope' if it isn't already there (doesn't work in my windows with python 2.5.1)
and also deletes project.pickle which seems to also get in the way. (However everything needs to be reanalysed at each call).

Revision history for this message
Michal Kwiatkowski (ruby) said :
#4

Thank you for this comment.

I found it a bit troubling though. Why creating .pythoscope directory by yourself and removing the project.pickle? Why not let pythoscope --init do the necessary initializations? Is there anything we could change in the pythoscope itself to make this script unnecessary?

Revision history for this message
Rex Turnbull (rex-dicad) said :
#5

It was rather difficult for me to get started with Pythoscope. Since my development department guidelines say we must have python *not* registered on our systems, installation was not directly possible. As there are no external dependencies, perhaps distutils (standard module) would be the better method

Re: creating the '.pythoscope' directory
In Windows-Explorer it is not possible to create a directory beginning with '.' this is blocked with a message 'Please enter a file name'. Perhaps this is why .pythoscope is not created? I tried os.mkdir('.pythoscope') and os.makedirs('aaa/.pythoscope') in my python shell, and that worked. I am not sure why it doesn't work in Pythoscope.

Re: removing project.pickle
I found this to be the only way to get Pythoscope to run again.

Revision history for this message
Rex Turnbull (rex-dicad) said :
#6

Re: changing Pythoscope
I am willing to help out. How is best?

Revision history for this message
Michal Kwiatkowski (ruby) said :
#7

There are no external dependencies for usage, only for running self tests, so theoretically you could use bare distutils. I created a new blueprint to track this idea: https://blueprints.launchpad.net/pythoscope/+spec/dont-require-setuptools-for-installation . Please post any suggestions about this issue there.

About the .pythoscope: this may be a bug, so please file a new bug report, noting your Windows version and steps to reproduce the problem (basically pythoscope commands you execute with comments on unexpected behavior that you experience).

Removing the project.pickle: the same as above, please file a separate bug report. This actually may be related to a comment in this bug report: https://bugs.launchpad.net/pythoscope/+bug/348136/comments/5 . There seems to be a problem with pickle files on Windows.