Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2.6: ordereddict from PyPI? #124

Closed
delirious-lettuce opened this issue Jul 28, 2017 · 4 comments
Closed

Python 2.6: ordereddict from PyPI? #124

delirious-lettuce opened this issue Jul 28, 2017 · 4 comments

Comments

@delirious-lettuce
Copy link
Contributor

I was looking at Raymond Hettinger's script on ActiveState (in this repo as ordereddict.py) and noticed in the comments that it was available on PyPI. It seems to be an updated version of the original script.

I guess I'm just wondering if it wouldn't be easier to just pip install ordereddict (by adding it to requirements.txt)?

@eliangcs
Copy link
Contributor

I didn't add it to requirements.txt because I couldn't find a way to tell pip to install ordereddict only for Python 2.6. I don't want users to install ordereddict if they are using Python 2.7-3.6. Do you happen to know how to do it?

@delirious-lettuce
Copy link
Contributor Author

delirious-lettuce commented Jul 31, 2017

@eliangcs ,

My original thought was that it was kind of "installed" for Python 2.7-3.6 users anyways (in the form ordereddict.py), so why not just pip install it. But you make a good point, having it installed only when needed (Python 2.6 users) seems like the better option.

I came across a few links while looking for solutions (I was googling "conditional dependencies python"):


EDIT:

I haven't tested this yet but maybe something like this in setup.py?

def read_requirements(filename):
    try:
        with open(filename) as f:
            result = f.read().splitlines()
    except IOError:
        raise IOError(os.getcwd())
    else:
        if sys.version_info < (2, 7):
            result.append('ordereddict>=1.1')
        return result

@eliangcs
Copy link
Contributor

eliangcs commented Aug 1, 2017

@delirious-lettuce I think that works 👍. Feel free to create a pull request if you want to. Thanks a lot!

@delirious-lettuce
Copy link
Contributor Author

delirious-lettuce commented Aug 1, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants