{"action":"created","issue":{"url":"https://api.github.com/repos/numenta/nupic/issues/1579","labels_url":"https://api.github.com/repos/numenta/nupic/issues/1579/labels{/name}","comments_url":"https://api.github.com/repos/numenta/nupic/issues/1579/comments","events_url":"https://api.github.com/repos/numenta/nupic/issues/1579/events","html_url":"https://github.com/numenta/nupic/pull/1579","id":50639832,"number":1579,"title":"Pythonic build: Switch from cmake to distutils extensions for nupic installation","user":{"login":"david-ragazzi","id":3386273,"avatar_url":"https://avatars.githubusercontent.com/u/3386273?v=3","gravatar_id":"","url":"https://api.github.com/users/david-ragazzi","html_url":"https://github.com/david-ragazzi","followers_url":"https://api.github.com/users/david-ragazzi/followers","following_url":"https://api.github.com/users/david-ragazzi/following{/other_user}","gists_url":"https://api.github.com/users/david-ragazzi/gists{/gist_id}","starred_url":"https://api.github.com/users/david-ragazzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-ragazzi/subscriptions","organizations_url":"https://api.github.com/users/david-ragazzi/orgs","repos_url":"https://api.github.com/users/david-ragazzi/repos","events_url":"https://api.github.com/users/david-ragazzi/events{/privacy}","received_events_url":"https://api.github.com/users/david-ragazzi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":94,"created_at":"2014-12-02T11:26:06Z","updated_at":"2015-01-12T12:10:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/numenta/nupic/pulls/1579","html_url":"https://github.com/numenta/nupic/pull/1579","diff_url":"https://github.com/numenta/nupic/pull/1579.diff","patch_url":"https://github.com/numenta/nupic/pull/1579.patch"},"body":"Fixes https://github.com/numenta/nupic/issues/1573.\r\nDepends https://github.com/numenta/nupic/issues/1676\r\n\r\nThis PR aims to help we have Nupic \"pip installable\". For this it tries to leave the build/install process the more \"pythonic\" as possible using:\r\na) native support from Distutils/SetupTools to build all C++ extensions (https://github.com/numenta/nupic/issues/1573) \r\nb) Python scripts to perform jobs that were being performed by C++ executables (https://github.com/numenta/nupic/issues/1576).\r\n\r\nThe motivation of B is because it's very tricky install all current cpp executables and libraries using A solution. Some of these libraries (like `bindings`) are inevitable to be build as extensions, however c++ extensions like `htmtest` and `compare_nupic_core_version` can be replaced to python scripts. Different than bindings, these 2 extensions are complicating the process as they should be installed into souce repository (`bin` folder, to be exact) and not into `nupic` package install folder like the other modules. \r\n\r\nOnce that all extensions now can be build in a natural way, we can remove CMakeLists.txt from NuPIC Pyhton. This makes that CMake becomes essential only to build the NuPIC Core library: as this is an optional job, we could bypass CMake/Git use during PIP process decreasing the number of build/install steps and dependencies.\r\n\r\nI still am working on the pythonic version of `HtmTest`. Thus it's normal that some tests fail, because Travis still is referencing its c++ version. \r\n\r\n* * *\r\n\r\n## TODO:\r\n- [X] Figure out the `ARCHFLAGS=\"-arch x86_64\"` requirement on darwin64. Update: There's not way, distutils take the flags which python was build. So we cannot set this variable inside `setup.py`. \r\n- [X] Update supporting documentation (README, wikis) with any build changes. Update: README updated with ARCHFLAGS instructions.\r\n- [X] Simplification of this PR by move bindings refactoring to a new PR. Solved by https://github.com/numenta/nupic/pull/1610\r\n- [X] Simplification of this PR by move Travis scripts, CMakeLists.txt, and README update (replacement of `make` commands to python instructions and `custom_targets` remotion) to a new PR. Solved by https://github.com/numenta/nupic/pull/1622\r\n- [X] Simplification of this PR by move HtmTest to nupic.core on a new PR. Solved by https://github.com/numenta/nupic/pull/1676 and numenta/nupic.core#282"},"comment":{"url":"https://api.github.com/repos/numenta/nupic/issues/comments/69561259","html_url":"https://github.com/numenta/nupic/pull/1579#issuecomment-69561259","issue_url":"https://api.github.com/repos/numenta/nupic/issues/1579","id":69561259,"user":{"login":"david-ragazzi","id":3386273,"avatar_url":"https://avatars.githubusercontent.com/u/3386273?v=3","gravatar_id":"","url":"https://api.github.com/users/david-ragazzi","html_url":"https://github.com/david-ragazzi","followers_url":"https://api.github.com/users/david-ragazzi/followers","following_url":"https://api.github.com/users/david-ragazzi/following{/other_user}","gists_url":"https://api.github.com/users/david-ragazzi/gists{/gist_id}","starred_url":"https://api.github.com/users/david-ragazzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-ragazzi/subscriptions","organizations_url":"https://api.github.com/users/david-ragazzi/orgs","repos_url":"https://api.github.com/users/david-ragazzi/repos","events_url":"https://api.github.com/users/david-ragazzi/events{/privacy}","received_events_url":"https://api.github.com/users/david-ragazzi/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T12:10:14Z","updated_at":"2015-01-12T12:10:14Z","body":"> You might hate this because there's no more OO, but I think it's significantly simpler this way.\r\n\r\nNo strong opinion about OO. I simply use it because some local variables used the same names than module variables:\r\n\r\n```\r\nplatform = \"\"\r\n\r\ndef getPlatform():\r\n  platform = (code to find platform)\r\n  return platform\r\n\r\nplatform = getPlatform()\r\n```\r\n\r\nwith Setup class, I workaound this with:\r\n\r\n```\r\nself.platform = \"\"\r\n\r\ndef getPlatform(self):\r\n  platform = (code to find platform)\r\n  return platform\r\n\r\nself.platform = getPlatform()\r\n```\r\n"}}