Commit 94338f8d authored by Sumit Sahrawat's avatar Sumit Sahrawat Committed by GitHub

Merge pull request #666 from sumitsahrawat/ipython-replyto-config

Fix issue #665: Make EasyKernel more configurable
parents c783897d 6659dd83
...@@ -72,6 +72,9 @@ script: ...@@ -72,6 +72,9 @@ script:
cd "$TOP"; cd "$TOP";
done done
# Ensure that ipython-kernel examples build successfully.
stack build ipython-kernel --flag ipython-kernel:examples
# Ensure that IHaskell notebook remains unchanged. # Ensure that IHaskell notebook remains unchanged.
# Run the notebook to regenerate the outputs, then compare the new notebook to the old one. # Run the notebook to regenerate the outputs, then compare the new notebook to the old one.
stack install --stack-yaml=stack-full.yaml stack install --stack-yaml=stack-full.yaml
......
...@@ -233,6 +233,10 @@ mkConfig var = KernelConfig ...@@ -233,6 +233,10 @@ mkConfig var = KernelConfig
, inspectInfo = langInfo , inspectInfo = langInfo
, run = parseAndRun , run = parseAndRun
, debug = False , debug = False
, kernelBanner = "Expanded Hutton's Razor"
, kernelProtocolVersion = "5.0"
, kernelImplName = "expanded_huttons_razor"
, kernelImplVersion = "0.0"
} }
where where
displayRes (Left err) = displayRes (Left err) =
......
...@@ -130,6 +130,10 @@ simpleConfig = KernelConfig ...@@ -130,6 +130,10 @@ simpleConfig = KernelConfig
, inspectInfo = languageInspect , inspectInfo = languageInspect
, run = languageRun , run = languageRun
, debug = False , debug = False
, kernelBanner = "Simple Arithmetic Expressions"
, kernelProtocolVersion = "5.0"
, kernelImplName = "funcalc"
, kernelImplVersion = "0.0"
} }
main :: IO () main :: IO ()
......
...@@ -77,6 +77,14 @@ data KernelConfig m output result = ...@@ -77,6 +77,14 @@ data KernelConfig m output result =
-- should be handled by defining an appropriate error constructor in your result type. -- should be handled by defining an appropriate error constructor in your result type.
, run :: T.Text -> IO () -> (output -> IO ()) -> m (result, ExecuteReplyStatus, String) , run :: T.Text -> IO () -> (output -> IO ()) -> m (result, ExecuteReplyStatus, String)
, debug :: Bool -- ^ Whether to print extra debugging information to , debug :: Bool -- ^ Whether to print extra debugging information to
-- | A One-line description of the kernel
, kernelBanner :: String
-- | The version of the messaging specification used by the kernel
, kernelProtocolVersion :: String
-- | Name of the kernel implementation
, kernelImplName :: String
-- | Version of the kernel implementation
, kernelImplVersion :: String
} }
-- Install the kernelspec, using the `writeKernelspec` field of the kernel configuration. -- Install the kernelspec, using the `writeKernelspec` field of the kernel configuration.
...@@ -160,9 +168,12 @@ replyTo config _ _ KernelInfoRequest{} replyHeader = ...@@ -160,9 +168,12 @@ replyTo config _ _ KernelInfoRequest{} replyHeader =
KernelInfoReply KernelInfoReply
{ header = replyHeader { header = replyHeader
, languageInfo = kernelLanguageInfo config , languageInfo = kernelLanguageInfo config
, implementation = "ipython-kernel.EasyKernel" , implementation = kernelImplName config
, implementationVersion = "0.0" , implementationVersion = kernelImplVersion config
, banner = kernelBanner config
, protocolVersion = kernelProtocolVersion config
} }
replyTo config _ interface ShutdownRequest { restartPending = pending } replyHeader = do replyTo config _ interface ShutdownRequest { restartPending = pending } replyHeader = do
liftIO $ writeChan (shellReplyChannel interface) $ ShutdownReply replyHeader pending liftIO $ writeChan (shellReplyChannel interface) $ ShutdownReply replyHeader pending
liftIO exitSuccess liftIO exitSuccess
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment