ceumicrodata / mETL

mito ETL tool
161 stars 41 forks source link

installing mETL tries to install another xml2dict from pypi (not the right package) #12

Closed e3krisztian closed 11 years ago

e3krisztian commented 11 years ago

Installing current master with

~/projects/mETL$ pip install -e .

fails with this:

...
Downloading/unpacking xml2dict (from mETL==0.1.6.10dev)
  Downloading XML2Dict-0.2.1.tar.gz
  Storing download in cache at /home/kr/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FX%2FXML2Dict%2FXML2Dict-0.2.1.tar.gz
  Running setup.py egg_info for package xml2dict
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/home/kr/.virtualenvs/metl/build/xml2dict/setup.py", line 14, in <module>
        long_description=open('README.md').read())
    IOError: [Errno 2] No such file or directory: 'README.md'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/home/kr/.virtualenvs/metl/build/xml2dict/setup.py", line 14, in <module>

    long_description=open('README.md').read())

IOError: [Errno 2] No such file or directory: 'README.md'

apparently it tries to install

https://pypi.python.org/pypi/XML2Dict/0.2.1 (https://github.com/mcspring/XML2Dict)

instead of

https://github.com/bfaludi/XML2Dict

Proposed solutions:

e3krisztian commented 11 years ago

It turns out, that setup.py already directly links to the proper place:

    dependency_links = [
        'https://github.com/ceumicrodata/tarr/archive/tarr-0.1.1.zip',
        'https://github.com/bfaludi/XML2Dict/archive/master.zip#egg=xml2dict-0.1'
    ],

after pip install https://github.com/bfaludi/XML2Dict/archive/master.zip#egg=xml2dict-0.1 and pinpointing xml2dict to version 0.1 in setup.py xml2dict==0.1

Without pinpointing to the exact version, the install fails as previously.

pip install -e . works. May it be that, the other version is newer (0.2.1)?

bfaludi commented 11 years ago

No, the current xml2dict version is 0.1 what the mETL is using. I think the problem You have an another xml2dict package installed on your computer, because many package available with the same name.

e3krisztian commented 11 years ago

I am using virtualenvs, so I am isolated from any unknown installed packages, so no, I do not have any other xml2dict installed. It is pip that installs it based on setup.py and searching PyPI.

I was running pip 1.3.1 (2013-03-08) and 1.4.1 (2013-08-07) (with current setuptools 1.1), neither works. It turned out, that pip does not do proper dependency resolution:

https://github.com/pypa/pip/issues/1134 https://github.com/pypa/pip/issues/988

https://devcenter.heroku.com/articles/python-pip

I have tried to create a requirements.txt file pinpointing the exact versions, but dependencies from setup.py still make pip pull in the wrong XML2Dict.

mkvirtualenv metl
pip install https://github.com/ceumicrodata/mETL/tarball/master

or better

mkvirtualenv metl
pip install mETL

should work without previously downloading/cloning anything and without polluting any user visible directory with python files - they are of help only for developers.

This issue also prevents mETL being released to PyPI (I do not know if there is such a plan, but it would make it more visible/used), as there is already a different (and probably broken) XML2Dict there.

Can XML2Dict be renamed (and possibly released to PyPI)?

bfaludi commented 11 years ago

Yes, the package will be released to PyPI. I will found an another name for the package but I have not got any naming idea. Do you have any proposal?

e3krisztian commented 11 years ago

I have glanced over it - it is pretty simple & nice package!

At first I though that XML2Dict is about the right name, it just need a differentiating word prefix, but not anymore: although it is a dict, that is created, but that dict is usually not a flat dict.

It somehow resembles JSON, except that the output is not a string, so XML2JSON is also discarded.

XML2Native is about the most correct variant in the above family.


What about naming it xmlsquash? Its a pretty unique name! https://www.google.com/search?q=xmlsquash


There is one thing that I spotted as potential problem: attributes are treated as sub-elements (probably intentionally), but what would be the result of parsing

<item x="3">
  <x>4</x>
</item>

?

bfaludi commented 11 years ago

I renamed it, the xmlsquash is quite good idea, thank you. :) You have right, this case was wrong. I fixed it. Current result of parsing for your example:

{u'x': {u'text': u'4'}, u'x:attr': u'3'}