Skip to content

Commit

Permalink
DOC: use mock for rtd (pysal#117)
Browse files Browse the repository at this point in the history
* make readthedocs lightweight

* import momepy

* mock

* mock osgeo?

* try osgeo

* matplotlib

* exclude from codecov

* comment

* clean
  • Loading branch information
martinfleis committed Nov 10, 2019
1 parent 431c495 commit 429f7b9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ exclude_lines =
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
except ModuleNotFoundError:
print("rtd")
ignore_errors = True
omit =
tests/*
Expand Down
25 changes: 21 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,27 @@
import sys
import sphinx_bootstrap_theme

import momepy

# sys.path.insert(0, os.path.abspath('../../'))

sys.path.insert(0, os.path.abspath("../.."))

import momepy # noqa

autodoc_mock_imports = [
"geopandas",
"networkx",
"numpy",
"pandas",
"rtree",
"scipy",
"scipy.spatial" "shapely",
"shapely.geometry",
"shapely.wkt",
"shapely.ops",
"libpysal",
"tqdm",
"mapclassify",
"osmnx",
"inequality",
]

# -- Project information -----------------------------------------------------

Expand Down
11 changes: 1 addition & 10 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,8 @@ channels:
dependencies:
- sphinx_bootstrap_theme=0.6.4
- python=3.7
- geopandas
- libpysal
- networkx
- tqdm
- mapclassify
- momepy
- matplotlib
- rtree
- osmnx
- pip
- matplotlib
- pip:
- inequality
- sphinxcontrib.bibtex
- numpydoc
7 changes: 6 additions & 1 deletion momepy/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
from shapely.geometry import MultiPolygon, Point, Polygon
from shapely.wkt import loads
from tqdm import tqdm
from osgeo import ogr

# nothing - temporary solution for readthedocs fail. - cannot mock osgeo
try:
from osgeo import ogr
except ModuleNotFoundError:
print("rtd")

__all__ = ["buffered_limit", "Tessellation", "Blocks", "get_network_id", "get_node_id"]

Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ versionfile_source = momepy/_version.py
versionfile_build = momepy/_version.py
tag_prefix = v
parentdir_prefix = momepy-

[flake8]
# Black enforces 88 characters line length
max_line_length = 88

0 comments on commit 429f7b9

Please sign in to comment.