Skip to main content

Minimalistic C kernel for Jupyter

Project description

ViewCount GitHub Clones

MyC kernel for Jupyter

Example

  • Make sure you have the following requirements installed:
    • C
    • jupyter
    • zerorpc
    • python 3
    • pip

Step-by-step

pip install zerorpc
git clone https://github.com/nufeng1999/jupyter-MyC-kernel.git
cd jupyter-MyC-kernel
pip install -e . 
cd jupyter_MyC_kernel && python3 install_MyC_kernel --user
# now you can start the notebook
jupyter notebook

This is a very simplified exploration and development work, which is suitable for beginners and experts, especially for the development of computer system maintenance code.
My minification kelnel of jupyter

MyBash MyC
MyDart MyGjs
MyGo MyGroovy
MyJava MyKotlin
MyNodejs MyPython
MyVala MyVBScript
MyWolframScript MyHtml
MyTypeScript MyPowerShell
MyBatch MyLua
MyPerl MyLua
MyPHP MyR
MyMake MyRust
MyRuby MyTcl
MyVimscript MyM4
MyDot Mermaid

Support label

Label

Label prefix is ##% or //%
Example1:
##%overwritefile
##%file:../src/do_execute.c
##%noruncode
Example2:
##%runprg:ls
##%runprgargs:-al
Example3:
##//%outputtype:text/html
##%runprg:bash
##%runprgargs:test.sh
##%overwritefile
##%file:test.sh
echo "shell cmd test"
ls

Compile and run code

label value annotation
cflags: Specifies the compilation parameters for C language compilation
ldflags: Specify the link parameters for C language connection
args: Specifies the parameters for the code file runtime
switches Specifies the parameters for Swiftc
options Specifies the parameters for Perl,Lua
coptions: Code compilation time parameters of JVM platform
joptions: Code runtime parameters for the JVM platform
runprg: The code content will be run by the execution file specified by runprg
runprgargs: runprg Parameters of the specified executable ,You can put the name specified by file into the parameter string.
outputtype: text/plain mime-type
outencode: UTF-8 set stdout encode
runinterm Run the code in the terminal
term: gnome-terminal linux:gnome-terminal windows:c:\Windows\System32\cmd.exe /c start
cwd : The working directory in which the program runs
cleartest clear test code

Interactive running code

label value annotation
runmode: repl The code will run in interactive mode.
replcmdmode (repl interactive mode) to send stdin information to the specified process (repl child PID)
replsetip: "\r\n" Set (repl interactive mode) the prompt string when waiting for input
replchildpid: (repl interactive mode) specifies the running process number
repllistpid Lists the interactive process PIDs that are running

Interactive running GDB

label value annotation
rungdb Run GDB and send commands to GDB (repl interactive mode)

Save code and include file

label value annotation
noruncode Do not run code content
overwritefile Overwrite existing files
fileencode: UTF-8 code file encode
file: The code can be saved to multiple files
fndict: Dictionary for file names
filefordict: Replace $key of fndict with a string from the fndict when save file
fnlist: List for file names
fileforlist: Replace $fnlist with a string from the list when save file
include: Places the specified file contents in the label location

Templates and testing

label
Define a macro
define:Define a macro锛孴he content is jinja2 template. example:##%define:M1 this is {{name}}
##$Macroname聽or //$Macroname Replace with macro
##$M1 name='jinja2 content' This line will be replaced by this is jinja2 content
templatefile:
Define template code area
##jj2_begin or //jj2_begin
##jj2_end or //jj2_end
Put template code between ##jj2_begin and ##jj2_end 锛宩j2_begin Followed by parameters example: name='jinja2 content'.example: ##jj2_begin:name=www
Define test code area
## test_begin or // test_begin
## test_end or // test_end
test_Begin and test_End is the test code锛學ill not be saved to the file
##%cleartest clear test code
##mdf: or //mdf:
##mdfend or //mdfend
##mdf and ##mdfend content锛學ill be saved to the file

Commands and environment variables

label value annotation
command: shell command or executable
pycmd: python parameter command
dartcmd: dart parameter command
fluttercmd: flutter parameter command
kcmd: jupyter kernel command
env: Setting environment variables for code file runtime.example: name=xxx name2='dddd'

Behavior control

label value annotation
noruncode Do not run code content
onlycsfile Generate code files only
onlyruncmd Run the label command only
onlycompile Compile code content only

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_MyC_kernel-0.0.1.tar.gz (388.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupyter_MyC_kernel-0.0.1-py3-none-any.whl (65.9 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_MyC_kernel-0.0.1.tar.gz.

File metadata

  • Download URL: jupyter_MyC_kernel-0.0.1.tar.gz
  • Upload date:
  • Size: 388.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for jupyter_MyC_kernel-0.0.1.tar.gz
Algorithm Hash digest
SHA256 64e789a2f4a98b62fe576f4cf9cd90f4dd19316dff312daa1e29a5b70c5f4a8f
MD5 1013447dec431035c152cd43d7f30754
BLAKE2b-256 7b9397c8a00be9e9529d3b2bb9866ff9943dd67a895499a628f0bf51a3fe0f59

See more details on using hashes here.

File details

Details for the file jupyter_MyC_kernel-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: jupyter_MyC_kernel-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 65.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for jupyter_MyC_kernel-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c609d534157c0520e5c2f606f57cec5f27957b9141c850376227b4f244eaca90
MD5 b3fa04c4621b60cb4a62f5c824561c14
BLAKE2b-256 9bb41d72987c5e0613509728123d37befea3594d96cfa33dce5e36462d68b3f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page