Code Monkey home page Code Monkey logo

pythonect's Introduction

Pythonect

Latest version

Travis-CI

Number of PyPI downloads

Homepage: http://www.pythonect.org/

Pythonect is a new, experimental, general-purpose dataflow programming language based on Python. It provides both a visual programming language and a text-based scripting language. The text-based scripting language aims to combine the quick and intuitive feel of shell scripting, with the power of Python. The visual programming language is based on the idea of a diagram with “boxes and arrows”. Crazy? Most definitely. And yet, strangely enough, it works!

Hello, world

Here is the canonical "Hello, world" example program in Pythonect:

"Hello, world" -> print

Or:

image

Installation

There are a few ways to install Pythonect.

  1. You can install directly from PyPI using setuptools/easy_install or pip:

    pip install Pythonect

    or:

    easy_install Pythonect
  2. You can clone the git repository somewhere in your system:

    git clone git://github.com/ikotler/pythonect.git

    Then you should do following steps:

    cd pythonect
    python setup.py install

    Alternatively, if you use pip, you can install directly from the git repository:

    pip install \
        git+git://github.com/ikotler/pythonect.git@master#egg=pythonect \
    -r https://github.com/ikotler/pythonect/raw/master/doc/requirements.txt

For any of the above methods, if you want to do a system-wide installation, you will have to do this with root permissions (e.g. using su or sudo).

Examples

See more examples at the Pythonect Tutorial.

Documentation

Full documentation is available at http://docs.pythonect.org/.

Please Help Out

This project is still under development. Feedback and suggestions are very welcome and I encourage you to use the Issues list on GitHub to provide that feedback.

Feel free to fork this repo and to commit your additions. For a list of all contributors, please see the AUTHORS file.

Any questions, tips, or general discussion can be posted to our Google group: http://groups.google.com/group/pythonect <http://groups.google.com/group /pythonect>

Licensing

Pythonect is published under the liberal terms of the BSD 3-Clause License, see the LICENSE file. Although the BSD License does not require you to share any modifications you make to the source code, you are very much encouraged and invited to contribute back your modifications to the community, preferably in a GitHub fork, of course.

Showing Your Appreciation

The best way to show your appreciation for Pythonect remains contributing to the community. If you'd like to show your appreciation in another way, consider Flattr'ing or Gittip'ing me:

FlattrThis_ GittipThis_

pythonect's People

Contributors

guyadini avatar ikotler 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pythonect's Issues

None is printed every time the Enter key is pressed in the interpreter

if a Pythonect program is consist of only statements (i.e. None as input and None as output) the interpreter will print None after execution.

Hitting Enter key in the interpreter results in pass statement.

Thus:

>>>  <Enter>
None
>>>  <Enter>
None
>>>  <Enter>
None
>>> import os
None
>>> import sys
None
>>> 

Pythonect reports version 0.0.0.dev0

When installing Pythonect from pip or source tarball it will report the version to be 0.0.0.dev0

root:/tmp# pip install pythonect
Downloading/unpacking pythonect
  Downloading Pythonect-0.1.1.tar.gz
  Running setup.py egg_info for package pythonect

    warning: no files found matching 'AUTHORS'
    warning: no previously-included files found matching '.gitignore'
Requirement already satisfied (use --upgrade to upgrade): ply>=3.4 in /usr/local/lib/python2.7/dist-packages (from pythonect)
Installing collected packages: pythonect
  Running setup.py install for pythonect
    changing mode of build/scripts-2.7/pythonect from 644 to 755

    warning: no files found matching 'AUTHORS'
    warning: no previously-included files found matching '.gitignore'
    changing mode of /usr/local/bin/pythonect to 755
Successfully installed pythonect
Cleaning up...
root:/tmp# pythonect 
Pythonect 0.0.0.dev0
>>> 

Preprocessor breaks on a List with Function Call that contains String

[string.find('Hello world', 'world')]

Raises

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 105, in __run
    object_or_objects = python.eval(atom, globals_, locals_)
  File "<string>", line 1
    [__builtins__.expr('string.find('Hello world', 'world')')]
                                         ^
SyntaxError: invalid syntax

dict() as a switch statement

Python's built-in dict() can be used as a switch statement (without fall through)

e.g.

1 -> {1: 'One', 2: 'Two'}

will output:

'One'

Interpreter prints Strings without quotes

Pythonect 0.1.1
>>> "Hello, world"
Hello, world
>>> 

SHOULD BE:

Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "Hello, world"
'Hello, world'
>>> 

Linear growth of termination time

For some reason, _after_ iterating through a list, pythonect hangs for an amount of time that correlates with the number of iterations that have been done.
Benchmarks performed on a 2.2GHz Core2Duo Windows 7 machine.

[[range(1)]] -> [sys.stdout.write(str(x)) for x in _[0]] (2.2816 seconds)
[[range(2)]] -> [sys.stdout.write(str(x)) for x in _[0]] (3.2782 seconds)
[[range(3)]] -> [sys.stdout.write(str(x)) for x in _[0]] (4.3306 seconds)
[[range(4)]] -> [sys.stdout.write(str(x)) for x in _[0]] (5.2891 seconds)
[[range(5)]] -> [sys.stdout.write(str(x)) for x in _[0]] (6.3092 seconds)
[[range(100)]] -> [sys.stdout.write(str(x)) for x in _[0]] (101.3167 seconds)

Pythonect Exception Trace contains irrelevant details

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 97, in __run
    raise e
NameError: name 'j' is not defined

SHOULD BE MORE LIKE:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'j' is not defined

Multi-processing is not working with multi-threading

"Hello, world" -> [print, print &]

Yields:

<MainProcess:Thread-2> : Hello, world
['Hello, world', <pythonect.lang.attributedcode object at 0x7fb963a66d10>]

Should Yield:

<MainProcess:Thread-2> : Hello, world
<PID #15638> : Hello, world
['Hello, world', 'Hello, world']

Print does not act as a pass-through statement

range(1,10) -> print("Thread A")

RETURN:

['Thread A', 'Thread A', 'Thread A', 'Thread A', 'Thread A', 'Thread A', 'Thread A', 'Thread A', 'Thread A']

SHOULD RETURN:

[1, 2, 3, 4, 5, 6, 7, 8, 9]

Preprocessor incorrectly process non-String literals in List

[1,2,3] -> print

Results in:

<MainProcess:Thread-2> : 1
<MainProcess:Thread-3> : 1
<MainProcess:Thread-4> : 2
<MainProcess:Thread-5> : 3
[1, 1, 2, 3]

Should be:

<MainProcess:Thread-2> : 1
<MainProcess:Thread-3> : 2
<MainProcess:Thread-4> : 3
[1, 2, 3]

No Synchronous/Asynchronous Check

When output is callable and iterable (e.g. function returned back a list) there is no check if the operator is Synchronous/Asynchronous before calling resource/provider.

Not all Python implementations supports the multiprocessing module

SEE:

Jython 2.7a2 (default:9c148a201233, May 24 2012, 15:49:00) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_24
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named multiprocessing
>>> 

AND

IronPython 2.7.3 (2.7.0.40) on .NET 4.0.30319.1 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named multiprocessing
>>>

Installation warnings

Installation warnings in Pythonect 0.4.1:

zip_safe flag not set; analyzing archive contents...
pythonect.test.__init__: module references __file__```

Multiprocessing

"Hello, world" -> print &

LIKE:

cat /dev/urandom > /dev/console &

Autloading is not working in a statement

x = os.getcwd()

RAISE:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "build/bdist.linux-x86_64/egg/pythonect/eval.py", line 174, in __run
    output = output(globals_, locals_)
  File "build/bdist.linux-x86_64/egg/pythonect/lang.py", line 94, in __call__
    exec self.__statement in globals_, locals_
  File "<string>", line 1, in <module>
NameError: name 'os' is not defined

_version pollutes Pythonect namespace

>>> import pythonect
>>> dir(pythonect)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__version__', '_version']
>>> 

SHOULD BE:

>>> import pythonect
>>> dir(pythonect)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__version__']
>>> 

["Hello, world"] breaks preprocessor

["Hello, world"]
RAISE:

Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/pythonect/eval.py", line 310, in eval
    for expression in parser.parse(source):
  File "build/bdist.linux-x86_64/egg/pythonect/internal/parser.py", line 114, in parse
    return self.parser.parse(lexer=self.lexer.lexer, debug=logging.getLogger('parse'))
  File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 261, in parse
    return self.parsedebug(input,lexer,debug,tracking,tokenfunc)
  File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 343, in parsedebug
    lookahead = get_token()     # Get the next token
  File "/usr/local/lib/python2.7/dist-packages/ply/lex.py", line 348, in token
    newtok = func(tok)
  File "build/bdist.linux-x86_64/egg/pythonect/internal/lexer.py", line 123, in t_SOURCE
    t.type, t.value = preprocessor.preprocessor(t.value[:token_lexpos].rstrip(), stmt_as_is=t.lexer.stmt_as_is)
  File "build/bdist.linux-x86_64/egg/pythonect/internal/preprocessor.py", line 320, in preprocessor
    return preprocessor(new_buffer, stmt_as_is, tries + 1)
  File "build/bdist.linux-x86_64/egg/pythonect/internal/preprocessor.py", line 320, in preprocessor
    return preprocessor(new_buffer, stmt_as_is, tries + 1)
  File "build/bdist.linux-x86_64/egg/pythonect/internal/preprocessor.py", line 232, in preprocessor
    raise e
  File "<unknown>", line 1
    "Hello
         ^
SyntaxError: EOL while scanning string literal

NameError Exception overrides TypeError, AttributeError and ImportError

"Hello, world" -> string.split()

Raises

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 302, in __run
    __run(expression[1:], copy.copy(globals_), copy.copy(locals_), return_value_queue, True)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 125, in __run
    raise e
NameError: name 'string' is not defined

Should Raise:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/PROJECTS/Git/pythonect/pythonect/eval.py", line 333, in __run
    __run(expression[1:], copy.copy(globals_), copy.copy(locals_), return_value_queue, True)
  File "/PROJECTS/Git/pythonect/pythonect/eval.py", line 124, in __run
    raise e1
TypeError: split() takes at least 1 argument (0 given)

accidentally reverted wiki page ... sorry

Hi ... this is an embarrassing issue, but I accidentally clicked revert when I was looking at your wiki (here) and I can't figure out how to undo it.

I'm really sorry for causing you more work!

Autoloading

Make

"Hello, world" -> sys.stdout.write

equivalent to:

import sys -> "Hello, world" -> sys.stdout.write

Windows support for the pythonect interpreter script

https://groups.google.com/forum/?fromgroups=#!topic/pythonect/2uiyZUEuhU8

(PythonDir)\Scripts\pythonect currently does not work on Windows.

'pythonect' is not recognized as an internal or external command, operable program or batch file. 

Furthermore, it uses a shebang line and redirects execution to another internal script ((PythonDir)\lib\site-packages\pythonect-0.4.0-py2.7.egg\EGG-INFO\scripts\pythonect) that uses the readline module which is unavailable for Windows.

first install on Mac OSx 10.7.3

when first installing pythonect on a fresh mac a dependency is required:
here is the command line output:

Laplinker:pythonect laplinker$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 10, in
import pythonect.internal.version
File "/Users/laplinker/Desktop/pythonect/pythonect/init.py", line 16, in
from .eval import eval
File "/Users/laplinker/Desktop/pythonect/pythonect/eval.py", line 10, in
import internal.parser
File "/Users/laplinker/Desktop/pythonect/pythonect/internal/parser.py", line 1, in
import ply.yacc as yacc
ImportError: No module named ply.yacc

'print "B" in "ABC"' and 'print 2 is 2' throw exception

>>> print "B" in "ABC"

Exception in thread Thread-1:
Traceback (most recent call last):
  File "*snip*\Python27\lib\threading.py", line 552, in __bootstrap_inner
    self.run()
  File "*snip*\Python27\lib\threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "build\bdist.win32\egg\pythonect\internal\eval.py", line 106, in __run
    object_or_objects = python.eval(atom, globals_, locals_)
  File "<string>", line 1
    __builtins__.print_( (<_ast.Str object at 0x0186C450> in %'ABC'))
                          ^
SyntaxError: invalid syntax

The is operator produces similar results:

>>> print 2 is 2
*snip*
    __builtins__.print_( (<_ast.Num object at 0x018E94B0> is %2))
                          ^
SyntaxError: invalid syntax

Stateful Interpreter

>>> 1
>>> _ -> print

SHOULD PRINT: 1

AND

>>> x = 5
>>> x -> print

SHOULD PRINT: 5

Backslash is not working in Pythonect script

# cat foobar
"Hello, world" \
    -> print
# ./bin/pythonect foobar
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/PROJECTS/Git/pythonect.bak/pythonect/eval.py", line 105, in __run
    object_or_objects = python.eval(atom, globals_, locals_)
  File "<string>", line 1
    "Hello, world" \
                   ^
SyntaxError: unexpected character after line continuation character

TypeError Exceptions are being muted

socket.socket(socket.AF_INET, socket.SOCK_STREAM) -> _.connect('A','B')

SHOULD RAISE:

TypeError: connect() takes exactly one argument (2 given)

Single quote within Double quote (and vice versa) breaks lexer Token

"Where's Waldo" -> print

Raises

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 418, in eval
    for expression in parser.parse(source):
  File "/usr/local/lib/python2.7/dist-packages/pythonect/internal/parser.py", line 114, in parse
    return self.parser.parse(lexer=self.lexer.lexer, debug=logging.getLogger('parse'))
  File "build/bdist.linux-x86_64/egg/ply/yacc.py", line 261, in parse
    return self.parsedebug(input,lexer,debug,tracking,tokenfunc)
  File "build/bdist.linux-x86_64/egg/ply/yacc.py", line 343, in parsedebug
    lookahead = get_token()     # Get the next token
  File "build/bdist.linux-x86_64/egg/ply/lex.py", line 348, in token
    newtok = func(tok)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/internal/lexer.py", line 123, in t_SOURCE
    t.type, t.value = preprocessor.preprocessor(t.value[:token_lexpos].rstrip(), stmt_as_is=t.lexer.stmt_as_is)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/internal/preprocessor.py", line 344, in preprocessor
    return preprocessor(new_buffer, stmt_as_is, tries + 1)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/internal/preprocessor.py", line 344, in preprocessor
    return preprocessor(new_buffer, stmt_as_is, tries + 1)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/internal/preprocessor.py", line 244, in preprocessor
    raise e
  File "<unknown>", line 1
    "Where's Waldo" -> print
                     ^
SyntaxError: invalid syntax

Pythonect Autoload parse modules incorrectly, if names surround with brackets

>>> "Hello, world" -> [string.split, _ + "and welcome"]
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 250, in __run
    __run(expression[1:], copy.copy(globals_), copy.copy(locals_), return_value_queue, True)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 97, in __run
    raise e
ImportError: No module named [string

False
>>> 

Pythonect script can't accept args

# ./bin/pythonect helloworld foobar
usage: ['./bin/pythonect', 'helloworld', 'foobar'] [-h] [--verbose]
                                                   [--version]
                                                   [file]
['./bin/pythonect', 'helloworld', 'foobar']: error: unrecognized arguments: foobar

Pythonect won't autoload local (current working directory) modules

ikotler:/tmp$ cat foobar.py 
def foobar(x):
    return x+1
ikotler:/tmp$ pythonect
Pythonect 0.2.0
>>> 1 -> foobar.foobar
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 250, in __run
    __run(expression[1:], copy.copy(globals_), copy.copy(locals_), return_value_queue, True)
  File "/usr/local/lib/python2.7/dist-packages/pythonect/eval.py", line 97, in __run
    raise e
ImportError: No module named foobar

False
>>> 

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.