{"id":13719405,"url":"https://github.com/Yuki-Inoue/jupyter_on_rails","last_synced_at":"2025-05-07T11:31:37.506Z","repository":{"id":37818857,"uuid":"167176782","full_name":"Yuki-Inoue/jupyter_on_rails","owner":"Yuki-Inoue","description":"Integrate Rails and Jupyter","archived":false,"fork":false,"pushed_at":"2024-03-19T00:25:46.000Z","size":949,"stargazers_count":84,"open_issues_count":9,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T09:07:38.911Z","etag":null,"topics":["iruby","jupyter"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yuki-Inoue.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Yuki-Inoue","issuehunt":"yuki-inoue"}},"created_at":"2019-01-23T12:06:17.000Z","updated_at":"2025-02-18T19:10:50.000Z","dependencies_parsed_at":"2024-06-21T14:12:25.732Z","dependency_job_id":"e88d5cc3-2d20-4814-8e96-ee2967fa73a2","html_url":"https://github.com/Yuki-Inoue/jupyter_on_rails","commit_stats":{"total_commits":109,"total_committers":11,"mean_commits":9.909090909090908,"dds":"0.45871559633027525","last_synced_commit":"ee08bfd0e023f3ce943fa54de136de7bfe298fdb"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yuki-Inoue%2Fjupyter_on_rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yuki-Inoue%2Fjupyter_on_rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yuki-Inoue%2Fjupyter_on_rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yuki-Inoue%2Fjupyter_on_rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yuki-Inoue","download_url":"https://codeload.github.com/Yuki-Inoue/jupyter_on_rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252868889,"owners_count":21816933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iruby","jupyter"],"created_at":"2024-08-03T01:00:48.133Z","updated_at":"2025-05-07T11:31:36.660Z","avatar_url":"https://github.com/Yuki-Inoue.png","language":"Ruby","funding_links":["https://github.com/sponsors/Yuki-Inoue","https://issuehunt.io/r/yuki-inoue"],"categories":["Interactive Computing","Ruby"],"sub_categories":[],"readme":"# JupyterOnRails\n\nIntegrate Rails and Jupyter\n\n![Alt text](the_screenshot.png?raw=true \"Title\")\n\n## Motivation\n\nAlthough it was already possible to run `jupyter` + `iruby` and `require app_full_path` to load Rails application context,\nit is a bit tiring to each time copy all the `require` statements.\n\nMoreover, since Rails Way works in keeping (generally) everything under the project directory,\nmanaging the jupyter configuration installed in user global area (the iruby kernel register thing) is again a bit awkward.\n\nWith this gem, these awkwardness is to solved by following instruments:\n  * `rake jupyter:notebook` Railtie command which invokes jupyter at your project root, and\n  * This rake task automatically creates two `iruby` kernels to load your application in Jupyter:\n    * one for normal operation\n    * one for sandbox mode in which everything you do is wrapped in a database transaction that is rolled back when the\n      kernel exits (equivalent to `rails console --sandbox`)\n\n\n## Prerequisites\n\n* iruby's prerequisites must be met.\n  * Refer: https://github.com/SciRuby/iruby\n    * Either `cztop` or `ffi-rzmq` gem must be installable.\n\n* `jupyter` command must be somehow available.\n  * Either\n    * `jupyter` command (pip global install, anaconda, etc), or\n    * `pipenv run jupyter` command (managed by Pipfile at project root)\n\n## Installation\n\nAdd these lines to your application's Gemfile:\n\n```ruby\ngem 'jupyter_on_rails'\n\n# For sessions pick either:\ngem 'ffi-rzmq'\n# Or\ngem 'cztop'\n```\n\nAnd then execute:\n\n    $ bundle install\n\n## Usage\n\nStarting the jupyter server is available as a rake command.\n\nJust execute:\n\n```sh\nrake jupyter:notebook\n```\n\nEventually, you'll have jupyter opened, and the kernel being available.\n\n\n### ApplicationRecord.to_df/#to_df\n\n```ruby\nUser.to_df # =\u003e Daru::DataFrame is returned\nuser.to_df # =\u003e Daru::DataFrame for single record\n```\n\n### Daru::DataFrame#write_model\n\nFor each row, call `to_h` and pass it to `model.new`.\nAnd then, imports them using `model.insert_all` on Rails \u003e= 6, or `model.import` (requires adding\n`activerecord-import` to your `Gemfile`).\n\n```ruby\ndf.write_model(User)\n```\n\n## Development\n\nThis is a railtie gem, so you'd probably want to do something like:\n\n```\ngem 'jupyter_on_rails', git: 'GIT_URL_OF_YOUR_REPO',\n                        branch: 'the-work-branch'\n```\n\nor\n\n```\ngem `jupyter_on_rails`, path: 'jupyter_on_rails_as_sub_project'\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Yuki-Inoue/jupyter_on_rails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYuki-Inoue%2Fjupyter_on_rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYuki-Inoue%2Fjupyter_on_rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYuki-Inoue%2Fjupyter_on_rails/lists"}