Skip to content

Commit c628be9

Browse files
committed
Cythonize screen.py if cython is available
1 parent c1f2bc5 commit c628be9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.egg-info/
22
__pycache__
3+
neovim/ui/screen.c
4+
neovim/ui/screen.so

setup.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@
1313
# trollius is just a backport of 3.4 asyncio module
1414
install_requires.append('trollius')
1515

16+
has_cython = False
1617
if not platform.python_implementation() == 'PyPy':
1718
# pypy already includes an implementation of the greenlet module
1819
install_requires.append('greenlet')
20+
try:
21+
# Cythonizing screen.py to improve scrolling/clearing speed. Maybe the
22+
# performance can be improved even further by writing a screen.pxd with
23+
# static type information
24+
from Cython.Build import cythonize
25+
has_cython = True
26+
except ImportError:
27+
pass
1928

2029
setup(name='neovim',
2130
version='0.0.25',
@@ -28,6 +37,7 @@
2837
packages=['neovim', 'neovim.api', 'neovim.msgpack_rpc', 'neovim.ui',
2938
'neovim.msgpack_rpc.event_loop', 'neovim.plugin'],
3039
install_requires=install_requires,
40+
ext_modules=cythonize('neovim/ui/screen.py') if has_cython else None,
3141
entry_points='''
3242
[console_scripts]
3343
pynvim=neovim.ui.cli:main

0 commit comments

Comments
 (0)