File tree Expand file tree Collapse file tree 6 files changed +28
-10
lines changed
src/compas/datastructures/network
tests/compas/datastructures Expand file tree Collapse file tree 6 files changed +28
-10
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -79,6 +79,17 @@ Note that installation with ``pip`` is also possible within a ``conda`` environm
7979 conda activate my-project
8080 pip install -e .
8181
82+ By default, ``planarity `` is marked as an optional requirement for installation with ``pip `` on Windows.
83+ To include ``planarity ``, add a conditional to the install command.
84+
85+ .. code-block :: bash
86+
87+ pip install compas[planarity]
88+
89+ .. code-block :: bash
90+
91+ pip install -e .[planarity]
92+
8293
8394 Update with conda
8495=================
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ networkx
1212numba
1313numpy >= 1.15.4
1414pillow
15- planarity
15+ planarity ; sys_platform != 'win32'
1616pycollada
1717schema
1818jsonschema
Original file line number Diff line number Diff 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'
Original file line number Diff line number Diff line change 88
99from itertools import product
1010
11- import compas
12-
1311from compas .geometry import angle_vectors_xy
1412from compas .geometry import is_intersection_segment_segment_xy
1513from compas .geometry import is_ccw_xy
1614from compas .geometry import subtract_vectors_xy
1715
18- if not compas .IPY :
19- import planarity
20-
2116
2217__all__ = [
2318 'network_is_crossed' ,
@@ -198,6 +193,12 @@ def network_is_planar(network):
198193 --------
199194 >>>
200195 """
196+ try :
197+ import planarity
198+ except ImportError :
199+ print ("Planarity is not installed." )
200+ raise
201+
201202 return planarity .is_planar (list (network .edges ()))
202203
203204
Original file line number Diff line number Diff line change 11import pytest
22
3- import compas
43from compas .datastructures import Network
54
65
@@ -33,15 +32,19 @@ def test_add_node():
3332
3433
3534def test_non_planar (k5_network ):
36- if compas .IPY :
35+ try :
36+ import planarity # noqa: F401
37+ except ImportError :
3738 return
3839
3940 from compas .datastructures import network_is_planar
4041 assert network_is_planar (k5_network ) is not True
4142
4243
4344def test_planar (k5_network ):
44- if compas .IPY :
45+ try :
46+ import planarity # noqa: F401
47+ except ImportError :
4548 return
4649
4750 from compas .datastructures import network_is_planar
You can’t perform that action at this time.
0 commit comments