Skip to content

Commit ce87e99

Browse files
committed
change planarity to requires extra for pip installs
1 parent d659253 commit ce87e99

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2828
* `compas_blender.artists.RobotModelArtist.collection` can be assigned as a Blender collection or a name.
2929
* Generalized the parameter `color` of `compas_blender.draw_texts` and various label drawing methods.
3030
* Changed `compas.IPY` to `compas.RHINO` in `orientation_rhino`.
31+
* Changed `planarity` to `requires_extra` for pip installations.
3132

3233
### Removed
3334

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ networkx
1212
numba
1313
numpy >= 1.15.4
1414
pillow
15-
planarity
1615
pycollada
1716
schema
1817
jsonschema

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ def read(*names, **kwargs):
6666
zip_safe=False,
6767
install_requires=requirements,
6868
python_requires='>=2.7',
69-
extras_require=optional_requirements,
69+
extras_require={
70+
'planarity': ['planarity'],
71+
},
7072
entry_points={
7173
'console_scripts': [
7274
'compas_rpc=compas.rpc.__main__:main'

src/compas/datastructures/network/planarity.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
from itertools import product
1010

11-
import compas
11+
# import compas
1212

1313
from compas.geometry import angle_vectors_xy
1414
from compas.geometry import is_intersection_segment_segment_xy
1515
from compas.geometry import is_ccw_xy
1616
from compas.geometry import subtract_vectors_xy
1717

18-
if not compas.IPY:
19-
import planarity
18+
# if not compas.IPY:
19+
# import planarity
2020

2121

2222
__all__ = [
@@ -198,6 +198,12 @@ def network_is_planar(network):
198198
--------
199199
>>>
200200
"""
201+
try:
202+
import planarity
203+
except ImportError:
204+
print("Planarity is not installed.")
205+
raise
206+
201207
return planarity.is_planar(list(network.edges()))
202208

203209

0 commit comments

Comments
 (0)