{"action":"opened","issue":{"url":"https://api.github.com/repos/Syntaf/travis-sphinx/issues/14","repository_url":"https://api.github.com/repos/Syntaf/travis-sphinx","labels_url":"https://api.github.com/repos/Syntaf/travis-sphinx/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/Syntaf/travis-sphinx/issues/14/comments","events_url":"https://api.github.com/repos/Syntaf/travis-sphinx/issues/14/events","html_url":"https://github.com/Syntaf/travis-sphinx/issues/14","id":152352344,"number":14,"title":"Require ghp_import in setup.py?","user":{"login":"tomschr","id":1312925,"avatar_url":"https://avatars.githubusercontent.com/u/1312925?v=3","gravatar_id":"","url":"https://api.github.com/users/tomschr","html_url":"https://github.com/tomschr","followers_url":"https://api.github.com/users/tomschr/followers","following_url":"https://api.github.com/users/tomschr/following{/other_user}","gists_url":"https://api.github.com/users/tomschr/gists{/gist_id}","starred_url":"https://api.github.com/users/tomschr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomschr/subscriptions","organizations_url":"https://api.github.com/users/tomschr/orgs","repos_url":"https://api.github.com/users/tomschr/repos","events_url":"https://api.github.com/users/tomschr/events{/privacy}","received_events_url":"https://api.github.com/users/tomschr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-01T19:01:45Z","updated_at":"2016-05-01T19:01:45Z","closed_at":null,"body":"I observed you use the `ghp_import.py` script from the [`ghp_import`](https://github.com/davisp/ghp-import) repository.\r\n\r\nThe interesting part is line 49 where you clone the repository with git and execute it (function `deploy_docs`). I'm not sure what the story behind this design decision is, but this is a bit, well... unusual. ;-)\r\n\r\nThe problem with this approach is:\r\n\r\n* It's not pythonic. ;-)\r\n* When you install it, it doesn't retrieve all requirements. Pip doesn't install `ghp_import` automatically.\r\n* Other programs which read `setup.py` and check for requirements cannot get the \"full\" list of requirements (because `ghp_import` is \"hidden\" inside your script).\r\n\r\nIs there a reason why you don't require this in the project? I would propose the following changes:\r\n\r\n* State clearly in `setup.py` that this project requires `ghp_import`:\r\n\r\n   ```python\r\ninstall_requires=[\r\n        'sphinx', 'ghp_import',\r\n    ],\r\n```\r\n\r\n* If possible, don't clone the repo and run the script. Instead import it and use it as follows:\r\n\r\n   ```python\r\nimport ghp_import\r\n\r\n# This is unfortunately needed by ghp_import\r\nimport optparse as op\r\n\r\ndef deploy_docs(target_dir, branches, pr_flag):\r\n      #...\r\n      # Not sure about this; I consider it a hack to use `check_repo()`.\r\n      # Maybe send a pull request to improve it?\r\n      parser = op.OptionParser(usage=ghp_import.__usage__, option_list=ghp_import.options())\r\n      # Only needed when you want to check the repo:\r\n      ghp_import.check_repo(parser)\r\n  \r\n      # Replace the following line with the \r\n      #   run('./ghp-import/ghp_import.py', '-n', 'target/doc/build')\r\n      gh_import.run_import('target/doc/build', # source directory\r\n               'gh-pages', # branch\r\n               'Updated documentation with travis-sphinx', # commit message\r\n               nojekyll=True):\r\n```\r\n\r\nProbably the `ghp_import.py` wasn't meant to be a library but a script. Maybe the upstream project should split the script into a library part and a script part. That would make things easier for you.\r\n\r\nIf the last entry from the above list doesn't work, you could just run the `ghp_import.py` script.\r\n\r\nHow does it sound? :-)\r\n\r\n\r\n"}}