Skip to content

Commit eb3571e

Browse files
committed
Remove numpy as a mandatory dependency for starting setup.py
1 parent 07983ea commit eb3571e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

NEWS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
Scrapely release notes
22
======================
33

4+
0.13.1 (2016-12-21)
5+
-------------------
6+
7+
- Remove numpy as a mandatory import in setup.py
8+
49
0.13.0 (2016-12-21)
5-
------------
10+
-------------------
611

712
- Python 3 support;
813
- fixed incorrect webpage encoding detection;

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33
import platform
44
from setuptools import setup, find_packages
55
from setuptools.extension import Extension
6-
import numpy as np
76

87

98
USE_CYTHON = 'CYTHONIZE' in os.environ
109
IS_PYPY = platform.python_implementation() == 'PyPy'
1110
ext = '.pyx' if USE_CYTHON else '.c'
11+
try:
12+
import numpy as np
13+
include_dirs = [np.get_include()]
14+
except ImportError:
15+
include_dirs = []
1216
extensions = [
1317
Extension("scrapely._htmlpage",
1418
["scrapely/_htmlpage%s" % ext],
15-
include_dirs=[np.get_include()]),
19+
include_dirs=include_dirs),
1620
Extension("scrapely.extraction._similarity",
1721
["scrapely/extraction/_similarity%s" % ext],
18-
include_dirs=[np.get_include()]),
22+
include_dirs=include_dirs),
1923
]
2024
if USE_CYTHON and not IS_PYPY:
2125
from Cython.Build import cythonize

0 commit comments

Comments
 (0)