Opened 5 years ago

Closed 4 years ago

#7244 closed defect (fixed)

Stem no longer supports python versions less than 2.7

Reported by: eoinof Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Since the addition of OrderedDict usage 2 months ago
https://gitweb.torproject.org/stem.git/commitdiff/d30a628e5da06699d8533f92c4b1c496510213b8

the library no longer supports versions of python less that 2.7 !
The OrderedDict was only added in python 2.7

There are several solutions I guess :)

1) decide to only support 2.7 ?
2) implement an alternative OrderedDict

e.g. http://code.activestate.com/recipes/576693/

3) stop using the OrderedDict ?

Eoin.

Child Tickets

Change History (9)

comment:1 follow-up: Changed 5 years ago by atagar

Hi eoinof, thanks for the catch! I'm planning to set up a continuing testing infrastructure for 2.5, 2.7, and 3.3 so we can catch these compatibility issues sooner but that's still a ways down the road.

The OrderedDict was only added in python 2.7

Damn, that's annoying. I'll look into making our own.

comment:2 in reply to: ↑ description Changed 5 years ago by cypherpunks

How were you using Stem (and Python<2.7)?

comment:3 Changed 5 years ago by atagar

How were you using Stem (and Python<2.7)?

I don't understand your question. Copies of python 2.5 are still floating around. Iirc CentOS is actually still on 2.4 (though that's backward enough that I'm not supporting it).

comment:4 Changed 5 years ago by eoinof

In my case I downloaded stem to osx and tried to run the unit tests. I'm just looking around tor a bit.. :D

The reason I filed a bug report was that the code 'suggests' that stem supports
python versions 2.5 and above..
https://gitweb.torproject.org/stem.git/blob/refs/heads/master:/stem/prereq.py

comment:6 in reply to: ↑ 1 Changed 5 years ago by eoinof

I was actually gonna ask if you were planning to support python 3 as well as 2.x ?
You'll need to do some work on exceptions..

comment:7 Changed 5 years ago by atagar

I was actually gonna ask if you were planning to support python 3 as well as 2.x ?

Yup, I am. Look for "Arc from Python" on...

http://www.atagar.com/arm/log.php

You'll need to do some work on exceptions..

Not necessary. By including a 2to3 conversion as part of the build we can support both the 2.x and 3.x series. Here's the setup.py that I wrote during the summit...

#!/usr/bin/env python

from stem import __version__, \
                 __author__, \
                 __contact__, \
                 __url__, \
                 __license__

from distutils.core import setup

try:
  from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
  from distutils.command.build_py import build_py

setup(name = 'stem',
      version = __version__,
      description = 'Controller library for tor',
      license = __license__,
      author = __author__,
      author_email = __contact__,
      url = __url__,
      packages = ['stem', 'stem.descriptor', 'stem.response', 'stem.util'],
      cmdclass = {'build_py': build_py},
)

It seems to work (I'm able to use stem via python 3 with the build output), but I haven't pushed this setup.py yet since I haven't tied in to stem's tests yet. I'd like to do that first to better validate the results...

comment:8 Changed 5 years ago by atagar

Just pushed the spelling corrections that I mentioned on 'https://trac.torproject.org/7245' along with an overhaul of stem's API docs. You might find them to be a bit more readable now...

https://stem.readthedocs.org/en/latest/

comment:9 Changed 4 years ago by atagar

  • Resolution set to fixed
  • Status changed from new to closed

Python 2.5 is unavailable in my apt repositories, but snagged 2.6 and fixed both this and another compatibility issue...

https://gitweb.torproject.org/stem.git/commitdiff/b09de10
https://gitweb.torproject.org/stem.git/commitdiff/aac44fe

Thanks for the catch! -Damian

Note: See TracTickets for help on using tickets.