Skip to content

Commit

Permalink
Merge pull request #1114 from gboeing/http
Browse files Browse the repository at this point in the history
rename private _downloader module, remove unneeded _api module, and fix unreachable code
  • Loading branch information
gboeing authored Jan 20, 2024
2 parents d8939e1 + a3b3dc7 commit 389cc96
Show file tree
Hide file tree
Showing 19 changed files with 228 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: SKIP=no-commit-to-branch pre-commit run --all-files

- name: Test docs
run: make -C ./docs html
run: make -C ./docs html SPHINXOPTS="-W --keep-going"

- name: Test code
run: pytest --maxfail=1 --typeguard-packages=osmnx --cov=./osmnx --cov-report=xml --cov-report=term-missing --verbose
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Test docs
run: |
make -C ./docs html
make -C ./docs html SPHINXOPTS="-W --keep-going"
python -m sphinx -b linkcheck ./docs/source ./docs/build/linkcheck
- name: Test code
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ repos:
rev: "v1.8.0"
hooks:
- id: mypy
additional_dependencies: [matplotlib, pandas-stubs, types-requests]
additional_dependencies:
[matplotlib, pandas-stubs, pytest, types-requests]
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

## 2.0.0 (Unreleased)

- add type annotations throughout the package for user type hinting and type checking (#1107)
- add type annotations to all public and private functions throughout the package (#1107)
- remove functionality previously deprecated in v1 (#1113)
- drop Python 3.8 support (#1106)
- make which_result function parameter consistently able to accept a list throughout package (#1113)
- make utils_geo.bbox_from_point function return a tuple of floats for consistency with rest of package (#1113)
- fix bug in \_downloader.\_save_to_cache function usage (#1107)
- fix bug in handling requests ConnectionError when querying Overpass status endpoint (#1113)
- minor fixes throughout to address inconsistencies revealed by type enforcement (#1107 #1114)
- rename osm_xml module to \_osm_xml to make it private, as all its functions are private (#1113)
- rename private \_downloader module to \_http (#1114)
- remove unnecessary private \_api module (#1114)

## 1.9.0 (Unreleased)

Expand Down
24 changes: 8 additions & 16 deletions docs/source/internals-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ Internals Reference

This is the complete OSMnx internals reference for developers, including private internal modules and functions. If you are instead looking for a user guide to OSMnx's public API, see the :doc:`user-reference`.

osmnx._api module
-----------------

.. automodule:: osmnx._api
:members:
:private-members:
:noindex:

osmnx.bearing module
--------------------

Expand All @@ -27,14 +19,6 @@ osmnx.distance module
:private-members:
:noindex:

osmnx._downloader module
------------------------

.. automodule:: osmnx._downloader
:members:
:private-members:
:noindex:

osmnx.elevation module
----------------------

Expand Down Expand Up @@ -75,6 +59,14 @@ osmnx.graph module
:private-members:
:noindex:

osmnx._http module
------------------

.. automodule:: osmnx._http
:members:
:private-members:
:noindex:

osmnx.io module
---------------

Expand Down
226 changes: 112 additions & 114 deletions docs/source/user-reference.rst
Original file line number Diff line number Diff line change
@@ -1,114 +1,112 @@
User Reference
==============

This is the User Reference for the OSMnx package. If you are looking for an introduction to OSMnx, read the :doc:`getting-started` guide.

This guide describes the usage of OSMnx's public API. Every function can be accessed via ``ox.module_name.function_name()`` and many can also be accessed directly via ``ox.function_name()`` as a shortcut.

osmnx.bearing module
--------------------

.. automodule:: osmnx.bearing
:members:

osmnx.distance module
---------------------

.. automodule:: osmnx.distance
:members:

osmnx.elevation module
----------------------

.. automodule:: osmnx.elevation
:members:

osmnx.features module
---------------------

.. automodule:: osmnx.features
:members:

osmnx.geocoder module
---------------------

.. automodule:: osmnx.geocoder
:members:

osmnx.graph module
------------------

.. automodule:: osmnx.graph
:members:

osmnx.io module
---------------

.. automodule:: osmnx.io
:members:

osmnx.plot module
-----------------

.. automodule:: osmnx.plot
:members:

osmnx.projection module
-----------------------

.. automodule:: osmnx.projection
:members:

osmnx.routing module
-----------------------

.. automodule:: osmnx.routing
:members:

osmnx.settings module
---------------------

.. automodule:: osmnx.settings
:members:

osmnx.simplification module
---------------------------

.. automodule:: osmnx.simplification
:members:

osmnx.speed module
------------------

.. automodule:: osmnx.speed
:members:

osmnx.stats module
------------------

.. automodule:: osmnx.stats
:members:

osmnx.truncate module
---------------------

.. automodule:: osmnx.truncate
:members:

osmnx.utils module
------------------

.. automodule:: osmnx.utils
:members:

osmnx.utils_geo module
----------------------

.. automodule:: osmnx.utils_geo
:members:

osmnx.utils_graph module
------------------------

.. automodule:: osmnx.utils_graph
:members:
User Reference
==============

This is the User Reference for the OSMnx package. If you are looking for an introduction to OSMnx, read the :doc:`getting-started` guide. This guide describes the usage of OSMnx's public API.

osmnx.bearing module
--------------------

.. automodule:: osmnx.bearing
:members:

osmnx.distance module
---------------------

.. automodule:: osmnx.distance
:members:

osmnx.elevation module
----------------------

.. automodule:: osmnx.elevation
:members:

osmnx.features module
---------------------

.. automodule:: osmnx.features
:members:

osmnx.geocoder module
---------------------

.. automodule:: osmnx.geocoder
:members:

osmnx.graph module
------------------

.. automodule:: osmnx.graph
:members:

osmnx.io module
---------------

.. automodule:: osmnx.io
:members:

osmnx.plot module
-----------------

.. automodule:: osmnx.plot
:members:

osmnx.projection module
-----------------------

.. automodule:: osmnx.projection
:members:

osmnx.routing module
-----------------------

.. automodule:: osmnx.routing
:members:

osmnx.settings module
---------------------

.. automodule:: osmnx.settings
:members:

osmnx.simplification module
---------------------------

.. automodule:: osmnx.simplification
:members:

osmnx.speed module
------------------

.. automodule:: osmnx.speed
:members:

osmnx.stats module
------------------

.. automodule:: osmnx.stats
:members:

osmnx.truncate module
---------------------

.. automodule:: osmnx.truncate
:members:

osmnx.utils module
------------------

.. automodule:: osmnx.utils
:members:

osmnx.utils_geo module
----------------------

.. automodule:: osmnx.utils_geo
:members:

osmnx.utils_graph module
------------------------

.. automodule:: osmnx.utils_graph
:members:
58 changes: 55 additions & 3 deletions osmnx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,56 @@
"""OSMnx init."""
# ruff: noqa: F401,PLC0414
"""Define the OSMnx package's namespace."""

from ._api import * # noqa: F401, F403
from ._version import __version__ # noqa: F401
# expose the package version
from ._version import __version__ as __version__

# expose the old pre-v2 API for backwards compatibility. this allows common
# functionality to be accessed directly via the ox.function_name() shortcut
# by exposing these functions directly in the package's namespace.
from .bearing import add_edge_bearings as add_edge_bearings
from .bearing import orientation_entropy as orientation_entropy
from .distance import nearest_edges as nearest_edges
from .distance import nearest_nodes as nearest_nodes
from .elevation import add_edge_grades as add_edge_grades
from .elevation import add_node_elevations_google as add_node_elevations_google
from .elevation import add_node_elevations_raster as add_node_elevations_raster
from .features import features_from_address as features_from_address
from .features import features_from_bbox as features_from_bbox
from .features import features_from_place as features_from_place
from .features import features_from_point as features_from_point
from .features import features_from_polygon as features_from_polygon
from .features import features_from_xml as features_from_xml
from .geocoder import geocode as geocode
from .geocoder import geocode_to_gdf as geocode_to_gdf
from .graph import graph_from_address as graph_from_address
from .graph import graph_from_bbox as graph_from_bbox
from .graph import graph_from_place as graph_from_place
from .graph import graph_from_point as graph_from_point
from .graph import graph_from_polygon as graph_from_polygon
from .graph import graph_from_xml as graph_from_xml
from .io import load_graphml as load_graphml
from .io import save_graph_geopackage as save_graph_geopackage
from .io import save_graph_xml as save_graph_xml
from .io import save_graphml as save_graphml
from .plot import plot_figure_ground as plot_figure_ground
from .plot import plot_footprints as plot_footprints
from .plot import plot_graph as plot_graph
from .plot import plot_graph_route as plot_graph_route
from .plot import plot_graph_routes as plot_graph_routes
from .plot import plot_orientation as plot_orientation
from .projection import project_gdf as project_gdf
from .projection import project_graph as project_graph
from .routing import k_shortest_paths as k_shortest_paths
from .routing import shortest_path as shortest_path
from .simplification import consolidate_intersections as consolidate_intersections
from .simplification import simplify_graph as simplify_graph
from .speed import add_edge_speeds as add_edge_speeds
from .speed import add_edge_travel_times as add_edge_travel_times
from .stats import basic_stats as basic_stats
from .utils import citation as citation
from .utils import log as log
from .utils import ts as ts
from .utils_graph import get_digraph as get_digraph
from .utils_graph import get_undirected as get_undirected
from .utils_graph import graph_from_gdfs as graph_from_gdfs
from .utils_graph import graph_to_gdfs as graph_to_gdfs
Loading

0 comments on commit 389cc96

Please sign in to comment.