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

Fix dependency specification in setup.py #28

Closed
shaded-enmity opened this issue Apr 20, 2016 · 4 comments · Fixed by #29
Closed

Fix dependency specification in setup.py #28

shaded-enmity opened this issue Apr 20, 2016 · 4 comments · Fixed by #29

Comments

@shaded-enmity
Copy link

The correct key name that is picked up by pip in setup.py is install_requires:
https://github.com/pazz/urwidtrees/blob/master/setup.py#L15

Trying to install urwidtrees without having urwid installed results in:

> $ pip install urwidtrees                                                                                    [±master ●]
Collecting urwidtrees
  Using cached urwidtrees-1.0.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-VGDG1V/urwidtrees/setup.py", line 4, in <module>
        import urwidtrees.version as v
      File "urwidtrees/__init__.py", line 6, in <module>
        from .decoration import DecoratedTree, CollapsibleTree
      File "urwidtrees/decoration.py", line 4, in <module>
        import urwid
    ImportError: No module named urwid

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-VGDG1V/urwidtrees/
@pazz
Copy link
Owner

pazz commented Apr 20, 2016

I think this could be fixed with an

install_requires=['urwid']

in the setup.py. I am not maintaining the pip version myself, but would accept a
PR for this.

@lucc
Copy link
Collaborator

lucc commented Jul 20, 2016

I am not sure if this will solve it:

git clone https://github.com/pazz/urwidtrees
cd urwidtrees
virtualenv foo
source foo/bin/activate
sed -i 's/)$/install_requires=["urwid"])/' setup.py
pip install .

still gives the import error.

The question is rather: I think it would be better to either put the version definition somewhere else or remove all these imports from init. Then we can import the version during install without importing the complete package (which I hope is not used during install, just the version number).

@lucc
Copy link
Collaborator

lucc commented Jul 20, 2016

After some tests I conclude that you should either hard code the version and other meta info into setup.py or not import everything into init.py . Becasue init will be loaded no matter which submodule of a package you import so the import error will persist.

@lucc
Copy link
Collaborator

lucc commented Jul 20, 2016

This is also relevant to pazz/alot#886.

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

Successfully merging a pull request may close this issue.

3 participants