pierrepo / PBxplore

A suite of tools to explore protein structures with Protein Blocks :snake:
https://pbxplore.readthedocs.org/en/latest/
MIT License
28 stars 17 forks source link

[WIP] Packaging Pbxplore #96

Closed HubLot closed 8 years ago

HubLot commented 8 years ago

Hi,

This is a big step to package pbxplore with setuptools (#21 & #22). See setup.py.

Several things:

TODO:

jbarnoud commented 8 years ago

Yeah ! That's exiting !

Regarding the requirements, there could be extra requirements for the analysis so that pip install pbxplore[analysis] requires weblogo and matplotlib, and an extra requirements for trajectories so that pip install pbxplore[trajectries] requires MDAnalysis. Finally, there could be a pip install pbxplore[all] to install all requirements.

Would nosetest find the tests if the test directory is renamed _tests ? Is so it may be nice to have _tests, and _scripts rather than test, and script. Indeed, these two directory are not directly part of the API. Yet, they are not directly exposed either so it is no big deal.

It would be nice to have some input files in the package for the users to play with. The demo files would be ideal for that. I think they could be put in pbxplore/data, see my comment on #97. I'll try to propose something about that soon.

jbarnoud commented 8 years ago

I gave some though to the last paragraph of my last comment. It is a separate issue (in fact it is issue #97, well played @HubLot ). I will continue the discussion about demo files in the corresponding issue.

pierrepo commented 8 years ago

@HubLot great! About the version number, can we link it to the tags in git? I already started to use tags. Yes please, I would be happy to have a quick tuto about setting up pypi.

HubLot commented 8 years ago

Good idea @jbarnoud for the requirements, I will amend the PR to have these. We are ok that by default, only numpy will be installed ?

About the _tests and _scripts folder, I'm not sure it's a good idea. It's not a common practice to have a _ if you look other packages.

The data/demo files could be treated in a separated issue (#97).

@pierrepo, I'm not sure I can link the version to the git tags. I'll let you know.

Finally, the publishing on Pypi should be the last thing to do because it only accepts one version of the package at the time. It's not possible to amend a version. I'll wrote you a quick tuto @pierrepo, it's quite easy.

HubLot commented 8 years ago

I add the extra_requires in the setup.py to install optional dependencies. Now, you can:

@pierrepo, I didn't find documentation about git tags and a possible link. I don't think it's possible but we can do it manually.

I think now the PR can be merged. The demo files will be treated in a separate issue and @jbarnoud is struggling to add the doc on travis and will make a new PR.

jbarnoud commented 8 years ago

@hublot See #98 for the doc. There should be very little conflict; the only one I can see is in the .travis.yml where I did lot of changes and you added the install of the package.

jbarnoud commented 8 years ago

I tried to install the package on a clean virtualenv. The install failed because the setup imports pbxplore that imports numpy. However, at that point, numpy is not installed, and it is not even listed as a requirement yet.

Here is the full traceback:

$pip install -e .[all]
Obtaining file:///Users/jon/dev/PBtest
  Running setup.py (path:/Users/jon/dev/PBtest/setup.py) egg_info for package from file:///Users/jon/dev/PBtest
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/Users/jon/dev/PBtest/setup.py", line 9, in <module>
        import pbxplore
      File "pbxplore/__init__.py", line 23, in <module>
        from .structure.loader import *
      File "pbxplore/structure/__init__.py", line 43, in <module>
        from .PDB import PDB_EXTENSIONS, PDBx_EXTENSIONS
      File "pbxplore/structure/PDB.py", line 11, in <module>
        from .structure import Atom, Chain
      File "pbxplore/structure/structure.py", line 10, in <module>
        import numpy
    ImportError: No module named numpy
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

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

  File "/Users/jon/dev/PBtest/setup.py", line 9, in <module>

    import pbxplore

  File "pbxplore/__init__.py", line 23, in <module>

    from .structure.loader import *

  File "pbxplore/structure/__init__.py", line 43, in <module>

    from .PDB import PDB_EXTENSIONS, PDBx_EXTENSIONS

  File "pbxplore/structure/PDB.py", line 11, in <module>

    from .structure import Atom, Chain

  File "pbxplore/structure/structure.py", line 10, in <module>

    import numpy

ImportError: No module named numpy

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/jon/dev/PBtest
Storing debug log for failure in /Users/jon/.pip/pip.log
HubLot commented 8 years ago

I fixed the error had @jbarnoud.

The import pbxplore in the setup.py was just to have the version number from pbxplore.__version__. The easiest workaround was to remove this import from the setup.py and add a constant VERSION in the setup.py. This implies to have both version (in the setup.py and in pbxplore.__init__.py synced manually. Otherwise, we will need tricks like partial import or automatically generate a version.py.

Note, the command pip install -e .[all] will still fails because MDAnalysis and weblogo require to have numpy installed before installing them.

jbarnoud commented 8 years ago

An other trick would be to have the version number in a file (called VERSION for instance) and to read the version from that file as we read the README. Note that mdanalysis is working on a fix for their numpy issue. I do not know for weblogo. Le 21 oct. 2015 11:16 AM, Hub notifications@github.com a écrit :I fixed the error had @jbarnoud.

The import pbxplore in the setup.py was just to have the version number from pbxplore.version. The easiest workaround was to remove this import from the setup.py and add a constant VERSION in the setup.py. This implies to have both version (in the setup.py and in pbxplore.init.py synced manually. Otherwise, we will need tricks like partial import or automatically generate a version.py.

Note, the command pip install -e .[all] will still fails because MDAnalysis and weblogo require to have numpy installed before installing them.

—Reply to this email directly or view it on GitHub.

pierrepo commented 8 years ago

Hi guys, sorry for the delay, things are getting a bit hot here in Congo. I do not have time to review the entire PR but I trust your choices. Again thanks for the nice work.