forked from lihaoyi/macropy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
81 lines (61 loc) · 2.05 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"""
MacroPy is an implementation of Macros in the Python Programming Language.
MacroPy provides a mechanism for user-defined functions (macros) to perform
transformations on the abstract syntax tree(AST) of Python code at module
import time. This is an easy way to modify the semantics of a python program
Python like you've never seen before
------------------------------------
MacroPy allows you to create constructs which are impossible to have in normal
python code, such as:
Tracing
```````
.. code:: python
with trace:
sum([x + 5 for x in range(3)])
# sum([x + 5 for x in range(3)])
# range(3) -> [0, 1, 2]
# x + 5 -> 5
# x + 5 -> 6
# x + 5 -> 7
# [x + 5 for x in range(3)] -> [5, 6, 7]
# sum([x + 5 for x in range(3)]) -> 18
Quick Lambdas
`````````````
.. code:: python
print map(f[_[0]], ['omg', 'wtf', 'bbq'])
# ['o', 'w', 'b']
print reduce(f[_ + _], ['omg', 'wtf', 'bbq'])
# 'omgwtfbbq
Case Classes
````````````
.. code:: python
@case
class Point(x, y): pass
p = Point(1, 2)
print str(p) #Point(1, 2)
print p.x #1
print p.y #2
print Point(1, 2) == Point(1, 2) # True
And more! All this runs perfectly on vanilla Python 2.7 or PyPy 2.0. For more
details, see the `GitHub page <https://github.com/lihaoyi/macropy#macropy>`_.
or ask in the `Google Group <https://groups.google.com/forum/#!forum/macropy>`_.
"""
from setuptools import find_packages, setup
from macropy import __version__
setup(
name='MacroPy',
version=__version__,
description='Macros for Python: Quasiquotes, Case Classes, LINQ and more!',
long_description=__doc__,
license='MIT',
author='Li Haoyi, Justin Holmgren',
author_email='[email protected], [email protected]',
url='https://github.com/lihaoyi/macropy',
packages=find_packages(exclude=["*.test", "*.test.*"]),
extras_require = {
'pyxl': ["pyxl"],
'pinq': ["SQLAlchemy"],
'js_snippets': ["selenium", "pjs"],
},
classifiers=['Programming Language :: Python :: 2.7']
)