Coder Social home page Coder Social logo

calysto_hy's Introduction

calysto

Gitter Travis PyPI version

Libraries and Languages for Python and Jupyter

Homepage: http://calysto.github.io/

$ pip install calysto

OR

$ pip3 install calysto

You may also need to install:

  • libcairo2
  • libXrender
  • libfontconfig

On MacOS for graphics, you may also need:

  • brew install cairo

calysto_hy's People

Contributors

atgmello avatar dsblank avatar fergusq avatar toddrme2178 avatar yuvallanger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calysto_hy's Issues

Is it possible to start up kernel with pre loaded hy libraries?

Hi,

this is a question rather than bug issue.

I'd like to require and import different macros and libraries on every kernel start up. Is it possible to define custom hy / python libraries somewhre so that they will be automaticly loaded on every start up of the calysto hy kernel?

macros not working in PR

The current PR fixes the main problems reported in other issues.

pip install git+https://github.com/fergusq/[email protected] --upgrade

You may need to add --force-reinstall but be careful as that is recursive to all dependencies ☚ī¸ The default code completion works. jedhy hasn't been updated so it won't work even if you install jedhy.

However, macros outside the default don't work. For example,

Screen Shot 2022-11-30 at 11 01 18 AM

This seems to have happened once before...

#16

but I can't figure out how this relates to the newer version (0.24+) of Hy. :(

Change colors

Hi there is a way to change the syntax colors the default blue is too dark and you can barely see it

image

I'm using alacritty with the default colors config.

Installation is broken

Presumably because of the changes in Hy?

In a venv, I followed the readme instructions,

(Python 3.9.13) ati@neptune ~/hytest > pip3 install git+https://github.com/ekaschalk/jedhy.git
[...]
(Python 3.9.13) ati@neptune ~/hytest > pip3 install git+https://github.com/Calysto/calysto_hy.git
[...]

(Python 3.9.13) ati@neptune ~/hytest > python3 -m calysto_hy install --sys-prefix
Traceback (most recent call last):
  File "/home/ati/.pyenv/versions/3.9.13/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/ati/.pyenv/versions/3.9.13/lib/python3.9/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/ati/.pyenv/versions/3.9.13/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/home/ati/hytest/.venv/x86_64-unknown-linux-gnu/Python 3.9.13/lib/python3.9/site-packages/calysto_hy/__init__.py", line 2, in <module>
    from .kernel import CalystoHy
  File "/home/ati/hytest/.venv/x86_64-unknown-linux-gnu/Python 3.9.13/lib/python3.9/site-packages/calysto_hy/kernel.py", line 17, in <module>
    from hy.lex import hy_parse
ModuleNotFoundError: No module named 'hy.lex'

%matplotlib inline does not exist

I realize this might be a metakernel issue, so feel free to redirect me if that is the case. I am trying to run a scientific Python stack with pandas, matplotlib, etc. with this notebook, but it seems like I can't plot inline.

Any directions on where to start looking? I'd be happy to help contribute a patch.

Function defs don't have return value when multiple expressions in cell

I am having the following issue:

If I run the following code in a separate cell:

(def a '(+ (+ 2 3) (* 3 4)))
(def b "bbb")
a

Out[]: displays nothing.

Then I run it like this:

(def a '(+ (+ 2 3) (* 3 4)))
(def b "bbb")
a
b

Out[]: displays ('+' ('+' 2 3) ('*' 3 4))

And the following code:

(def a '(+ (+ 2 3) (* 3 4)))
(def b "bbb")
a
b
a

Evaluates to:
'bbb'

This behaviour is not present in a raw Hy interpreter opened in console.

The version is... the last, I suppose. Python version is 3.5.2.

ImportError: cannot import name '_hy_macros'

During the last step of the installation of calysto_hy, an error raised:

python -m calysto_hy install
Traceback (most recent call last):
  File "/home/leo/apps/miniconda3/envs/hylang/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/leo/apps/miniconda3/envs/hylang/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/leo/apps/miniconda3/envs/hylang/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/leo/apps/miniconda3/envs/hylang/lib/python3.6/site-packages/calysto_hy/__init__.py", line 2, in <module>
    from .kernel import CalystoHy
  File "/home/leo/apps/miniconda3/envs/hylang/lib/python3.6/site-packages/calysto_hy/kernel.py", line 13, in <module>
    from hy.macros import _hy_macros, load_macros
ImportError: cannot import name '_hy_macros'

I searched in ~/apps/miniconda3/envs/hylang/lib/python3.6/site-packages/hy/macros.py, there isn't _hy_macros in this module.

Environment:

$ conda list|ag anaconda
anaconda                  custom           py36hbbc8b67_0  
anaconda-client           1.7.2                    py36_0  
anaconda-project          0.8.2                    py36_0  

$ conda list|ag python  
ipython                   7.2.0            py36h39e3cac_0  
ipython_genutils          0.2.0            py36hb52b0d5_0  
msgpack-python            0.5.6            py36h6bb024c_1  
python                    3.6.6             hd21baee_1003    conda-forge
python-dateutil           2.7.5                    py36_0  
python-libarchive-c       2.8                      py36_6  

$ conda list|ag hy    
# packages in environment at /home/leo/apps/miniconda3/envs/hylang:
calysto-hy                0.1.1                     <pip>
cryptography              2.3.1           py36hb7f436b_1000    conda-forge
hy                        0.15.0+64.ga42e17a           <pip>
jedhy                     1                         <pip>

Ubuntu 16.04.

Tagged release + PyPI upload?

Any reason not to do this? I've been using the kernel and apart from lacking %matplotlib inline support (which means I sadly can't use it for plotting on Jupyterhub) it seems stable and functional.

I'm not personally familiar with the PyPI release process, but I'd be happy to take it on if you think it's ready.

Can't evaluate python from Hy

The following doesn't seem to work in calysto_hy:

(py "print('hello')")

Stacktrace:

Traceback (most recent call last):
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1779, in compile_expression
    self, expr, unmangle(sroot), *parse_tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1727, in compile_inline_python
    'exec' if exec_mode else 'eval').body
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: expected str, bytes or os.PathLike object, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/calysto_hy/kernel.py", line 143, in do_execute_direct
    _ast = hy_compile(tokens, '', root=ast.Interactive, compiler=self.compiler)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 2168, in hy_compile
    result = compiler.compile(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1968, in compile_list
    elts, ret, _ = self._compile_collect(expression)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 498, in _compile_collect
    ret += self.compile(expr)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 451, in compile
    reraise(HyCompileError, HyCompileError(exc_msg), sys.exc_info()[2])
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/_compat.py", line 13, in reraise
    raise value.with_traceback(traceback)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1779, in compile_expression
    self, expr, unmangle(sroot), *parse_tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1727, in compile_inline_python
    'exec' if exec_mode else 'eval').body
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
hy.errors.HyCompileError: Internal Compiler Bug 😱
⤡ Traceback (most recent call last):
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 435, in compile
    ret = self.compile_atom(tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 429, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1779, in compile_expression
    self, expr, unmangle(sroot), *parse_tree)
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/site-packages/hy/compiler.py", line 1727, in compile_inline_python
    'exec' if exec_mode else 'eval').body
  File "/home/pavel/Programs/miniconda3/envs/hy/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: expected str, bytes or os.PathLike object, not NoneType

The following, however, does work:

(hy.eval '(py "print('hello')"))

Looks like a problem with the kernel rather than with my particular setup.

Ipywidgets support

Good day for everyone!

It would be great if one was able to use ipywidgets in Calysto. As far as I understand, the side responsible for displaying widgets is jupyter kernel and this feature is not implemented yet in Calysto (though I might be missing something).

Here's what I get when trying to display a widget object:
image

While the same code (literally translated) in python works perfectly fine for me.

Thanks for your attension!

Some code does not run

Sorry for this very general issue title. I just tried your kernel with some examples from the Hy language documentation and I thought it might be most useful, if I shared that notebook with you, where it prints the errors in red as an output to a code cell. I don't really know what the problem is with it or with what code it happens and with what code it doesn't.

So here is the repo for the test notebook: https://github.com/ZelphirKaltstahl/hy-kernels-test-notebook

Cannot open Tutorial notebook in Jupyter

I downloaded the Tutorial notebook from your repo, but I cannot open it in my Jupyter. A modal is shown with the following message:

Unreadable Notebook: /home/xiaolong/development/Hy/Tutorial.ipynb NotJSONError('Notebook does not appear to be JSON: '\n\n\n\n\n<html lang="en...',)

Cannot import name `_compile_table`

With Hy version 0.15.0 and Metakernel version 0.20.14:

$ python -m calysto_hy install --help
ImportError: cannot import name '_compile_table' from 'hy.compiler'

I went into hy.compiler.py file, and I don't see anything named _compile_table. Was this a recent breaking change to Hy?

edit: I see that _compile_table is present in Hy 0.14.x, so yes it looks like an API change

Hylang Test.ipynb - In [32]: Show users how to properly unpack keyword arguments

In Hylang Test.ipynb:

In [31]:
(defn optional-arg
  [pos1 pos2 &optional keyword1 [keyword2 42]]
  [pos1 pos2 keyword1 keyword2])
  ...
In [32]:
(setv args [1 2])
(setv kwargs {"keyword2" 3 "keyword1" 4})
(optional-arg args kwargs)
Out[32]:
[[1, 2], {'keyword2': 3, 'keyword1': 4}, None, 42]

Which is fine, but probably not what the user wants. Can we add an input after this that will show them how to properly unpack these arguments?

In [32]:
(setv args [1 2])
(setv kwargs {"keyword2" 3 "keyword1" 4})
(optional-arg (unpack-iterable args) (unpack-mapping kwargs))
Out[32]:
[1, 2, 4, 3]

I can make a pull request if you approve.

P.S. Thank you for this work. I threw this into a JupyterLab 3.0 notebook on something called myBinder.org 40 minutes ago and the experience has been ridiculously smooth and enjoyable. Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.