{"id":13606469,"url":"https://github.com/Calysto/metakernel","last_synced_at":"2025-04-12T08:31:17.137Z","repository":{"id":20024638,"uuid":"23292534","full_name":"Calysto/metakernel","owner":"Calysto","description":"Jupyter/IPython Kernel Tools","archived":false,"fork":false,"pushed_at":"2025-04-07T17:41:31.000Z","size":3717,"stargazers_count":355,"open_issues_count":37,"forks_count":87,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-08T00:39:02.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Calysto.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2014-08-24T20:53:45.000Z","updated_at":"2025-04-07T17:41:33.000Z","dependencies_parsed_at":"2023-01-13T20:44:02.076Z","dependency_job_id":"eedd0d4f-7682-428a-a208-d99460605be2","html_url":"https://github.com/Calysto/metakernel","commit_stats":{"total_commits":1002,"total_committers":33,"mean_commits":"30.363636363636363","dds":0.4660678642714571,"last_synced_commit":"69210445c10c34d621068c1589f783b39f7fd019"},"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calysto%2Fmetakernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calysto%2Fmetakernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calysto%2Fmetakernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calysto%2Fmetakernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Calysto","download_url":"https://codeload.github.com/Calysto/metakernel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755560,"owners_count":20990620,"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":[],"created_at":"2024-08-01T19:01:09.418Z","updated_at":"2025-04-12T08:31:12.126Z","avatar_url":"https://github.com/Calysto.png","language":"Python","funding_links":[],"categories":["Jupyter Kernels","Jupyter内核"],"sub_categories":[],"readme":"A Jupyter kernel base class in Python which includes core magic functions (including help, command and file path completion, parallel and distributed processing, downloads, and much more).\n\n.. image:: https://badge.fury.io/py/metakernel.png/\n    :target: http://badge.fury.io/py/metakernel\n\n.. image:: https://coveralls.io/repos/Calysto/metakernel/badge.png?branch=main\n  :target: https://coveralls.io/r/Calysto/metakernel\n\n.. image:: https://github.com/Calysto/metakernel/actions/workflows/tests.yml/badge.svg?query=branch%3Amain++\n  :target: https://github.com/Calysto/metakernel/actions/workflows/tests.yml\n\n.. image:: https://anaconda.org/conda-forge/metakernel/badges/version.svg\n    :target: https://anaconda.org/conda-forge/metakernel\n\n.. image:: https://anaconda.org/conda-forge/metakernel/badges/downloads.svg\n    :target: https://anaconda.org/conda-forge/metakernel\n\n\nSee Jupyter's docs on `wrapper kernels\n\u003chttp://jupyter-client.readthedocs.io/en/stable/wrapperkernels.html\u003e`_.\n\nAdditional magics can be installed within the new kernel package under a `magics` subpackage.\n\n\nFeatures\n-------------\n- Basic set of line and cell magics for all kernels.\n    - Python magic for accessing python interpreter.\n    - Run kernels in parallel.\n    - Shell magics.\n    - Classroom management magics.\n- Tab completion for magics and file paths.\n- Help for magics using ? or Shift+Tab.\n- Plot magic for setting default plot behavior.\n\nKernels based on Metakernel\n---------------------------\n\n- matlab_kernel, https://github.com/Calysto/matlab_kernel\n- octave_kernel, https://github.com/Calysto/octave_kernel\n- calysto_scheme, https://github.com/Calysto/calysto_scheme\n- calysto_processing, https://github.com/Calysto/calysto_processing\n- java9_kernel, https://github.com/Bachmann1234/java9_kernel\n- xonsh_kernel, https://github.com/Calysto/xonsh_kernel\n- calysto_hy, https://github.com/Calysto/calysto_hy\n- gnuplot_kernel, https://github.com/has2k1/gnuplot_kernel\n- spylon_kernel, https://github.com/mariusvniekerk/spylon-kernel\n- wolfram_kernel, https://github.com/mmatera/iwolfram\n- sas_kernel, https://github.com/sassoftware/sas_kernel\n- pysysh_kernel, https://github.com/Jaesin/psysh_kernel\n- calysto_bash, https://github.com/Calysto/calysto_bash\n\n... and many others.\n\nInstallation\n----------------\nYou can install Metakernel through ``pip``:\n\n.. code:: bash\n\n pip install metakernel --upgrade\n\nInstalling `metakernel` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with:\n\n.. code:: bash\n\n conda config --add channels conda-forge\n\nOnce the `conda-forge` channel has been enabled, `metakernel` can be installed with:\n\n.. code:: bash\n\n conda install metakernel\n\nIt is possible to list all of the versions of `metakernel` available on your platform with:\n\n.. code:: bash\n\n conda search metakernel --channel conda-forge\n\n\nUse MetaKernel Magics in IPython\n--------------------------------\n\nAlthough MetaKernel is a system for building new kernels, you can use a subset of the magics in the IPython kernel.\n\n.. code:: python\n\n from metakernel import register_ipython_magics\n register_ipython_magics()\n\nPut the following in your (or a system-wide) ``ipython_config.py`` file:\n\n.. code:: python\n\n # /etc/ipython/ipython_config.py\n c = get_config()\n startup = [\n    'from metakernel import register_ipython_magics',\n    'register_ipython_magics()',\n ]\n c.InteractiveShellApp.exec_lines = startup\n\nUse MetaKernel Languages in Parallel\n\nTo use a MetaKernel language in parallel, do the following:\n\n1. Make sure that the Python module `ipyparallel` is installed. In the shell, type:\n\n.. code:: bash\n\n  pip install ipyparallel\n\n\n2. To enable the extension in the notebook, in the shell, type:\n\n.. code:: bash\n\n  ipcluster nbextension enable\n\n\n3. To start up a cluster, with 10 nodes, on a local IP address, in the shell, type:\n\n.. code:: bash\n\n  ipcluster start --n=10 --ip=192.168.1.108\n\n\n4. Initialize the code to use the 10 nodes, inside the notebook from a host kernel ``MODULE`` and ``CLASSNAME`` (can be any metakernel kernel):\n\n.. code:: bash\n\n  %parallel MODULE CLASSNAME\n\n\nFor example:\n\n.. code:: bash\n\n  %parallel calysto_scheme CalystoScheme\n\n\n5. Run code in parallel, inside the notebook, type:\n\nExecute a single line, in parallel:\n\n.. code:: bash\n\n  %px (+ 1 1)\n\n\nOr execute the entire cell, in parallel:\n\n.. code:: bash\n\n  %%px\n  (* cluster_rank cluster_rank)\n\n\nResults come back in a Python list (Scheme vector), in ``cluster_rank`` order. (This will be a JSON representation in the future).\n\nTherefore, the above would produce the result:\n\n.. code:: bash\n\n  #10(0 1 4 9 16 25 36 49 64 81)\n\nYou can get the results back in any of the parallel magics (``%px``, ``%%px``, or ``%pmap``) in the host kernel by accessing the variable ``_`` (single underscore), or by using the ``--set_variable VARIABLE`` flag, like so:\n\n.. code:: bash\n\n  %%px --set_variable results\n  (* cluster_rank cluster_rank)\n\n\nThen, in the next cell, you can access ``results``.\n\nNotice that you can use the variable ``cluster_rank`` to partition parts of a problem so that each node is working on something different.\n\nIn the examples above, use ``-e`` to evaluate the code in the host kernel as well. Note that ``cluster_rank`` is not defined on the host machine, and that this assumes the host kernel is the same as the parallel machines.\n\n\nConfiguration\n-------------\n``Metakernel`` subclasses can be configured by the user.  The\nconfiguration file name is determined by the ``app_name`` property of the subclass.\nFor example, in the ``Octave`` kernel, it is ``octave_kernel``.  The user of the kernel can add an ``octave_kernel_config.py`` file to their\n``jupyter`` config path.  The base ``MetaKernel`` class offers ``plot_settings`` as a configurable trait.  Subclasses can define other traits that they wish to make\nconfigurable.\n\nAs an example:\n\n.. code:: bash\n\n    cat ~/.jupyter/octave_kernel_config.py\n    # use Qt as the default backend for plots\n    c.OctaveKernel.plot_settings = dict(backend='qt')\n\n\nDocumentation\n-----------------------\n\nExample notebooks can be viewed here_.\n\nDocumentation is available online_. Magics have interactive help_ (and online).\n\nFor version information, see the Changelog_.\n\n\n.. _here: http://nbviewer.jupyter.org/github/Calysto/metakernel/tree/main/examples/\n\n.. _help: https://github.com/Calysto/metakernel/blob/main/metakernel/magics/README.md\n\n.. _online: http://Calysto.github.io/metakernel/\n\n.. _Changelog: https://github.com/Calysto/metakernel/blob/main/CHANGELOG.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCalysto%2Fmetakernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCalysto%2Fmetakernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCalysto%2Fmetakernel/lists"}