geopy v2.0.0 Release Notes

Release Date: 2020-06-27 // over 1 year ago
  • ๐Ÿš€ geopy 2.0 is a major release with lots of cleanup and inner refactorings.
    The public interface of the library is mostly the same, and the set
    ๐Ÿ‘ of supported geocoders didn't change.

    ๐Ÿš€ If you have checked your code on the latest 1.x release with enabled
    โš  warnings (i.e. with -Wd key of the python command) and fixed
    โฌ†๏ธ all of them, then it should be safe to upgrade.

    ๐Ÿ†• New Features

    geopy.adapters module. Previously all geocoders used urllib
    ๐Ÿ‘ for HTTP requests, which doesn't support keepalives. Adapters is
    a new mechanism which allows to use other HTTP client implementations.

    There are 3 implementations coming out of the box:

    • geopy.adapters.RequestsAdapter -- uses requests library
      ๐Ÿ‘ which supports keepalives (thus it is significantly more effective
      ๐Ÿ“ฆ than urllib). It is used by default if requests package
      is installed.
    • geopy.adapters.URLLibAdapter -- uses urllib, basically
      0๏ธโƒฃ it provides the same behavior as in geopy 1.x. It is used by default if
      ๐Ÿ“ฆ requests package is not installed.

    - geopy.adapters.AioHTTPAdapter -- uses aiohttp library.

    โž• Added optional asyncio support in all geocoders via
    ๐Ÿ‘€ .AioHTTPAdapter, see the new Async Mode
    doc section.

    .AsyncRateLimiter -- an async counterpart of .RateLimiter.

    .RateLimiter is now thread-safe.

    Packaging Changes

    โฌ‡๏ธ Dropped support for Python 2.7 and 3.4.

    ๐Ÿ†• New extras:

    • geopy[requests] for geopy.adapters.RequestsAdapter.
    • geopy[aiohttp] for geopy.adapters.AioHTTPAdapter.

    ๐Ÿ’ฅ Breaking Changes

    • geopy.distance algorithms now raise ValueError for points with
      different altitudes, because altitude is ignored in calculations.
    • โœ‚ Removed geopy.distance.vincenty, use geopy.distance.geodesic instead.
    • โฑ timeout=None now disables request timeout, previously
      0๏ธโƒฃ a default timeout has been used in this case.
    • โœ‚ Removed GoogleV3.timezone, use .GoogleV3.reverse_timezone instead.
    • โœ‚ Removed format_string param from all geocoders.
      ๐Ÿ‘€ See Specifying Parameters Once doc section for alternatives.
    • 0๏ธโƒฃ exactly_one's default is now True for all geocoders
      and methods.
    • Removed service-specific request params from all __init__ methods
      of geocoders. Pass them to the corresponding geocode/reverse
      methods instead.
    • All bounding box arguments now must be passed as a list of two Points.
      Previously some geocoders accepted unique formats like plain strings
      and lists of 4 coordinates -- these values are not valid anymore.
    • .GoogleV3.reverse_timezone used to allow numeric at_time value.
      Pass datetime instances instead.
    • ๐Ÿ“œ reverse methods used to bypass the query if it couldn't be parsed
      as a .Point. Now a ValueError is raised in this case.
    • .Location and .Timezone classes no longer accept None
      for point and raw args.
    • ๐Ÿ”ง .Nominatim now raises geopy.exc.ConfigurationError when
      0๏ธโƒฃ used with a default or sample user-agent.
    • .Point now raises a ValueError if constructed from a single number.
      A zero longitude must be explicitly passed to avoid the error.
    • Most of the service-specific arguments of geocoders now must be passed
      as kwargs, positional arguments are not accepted.
    • โœ‚ Removed default value None for authentication key arguments of
      .GeoNames, .OpenMapQuest and .Yandex.
    • ๐Ÿ›  parse_* methods in geocoders have been prefixed with _
      to explicitly mark that they are private.

    ๐Ÿ—„ Deprecations

    • ๐Ÿšš .Nominatim has been moved from geopy.geocoders.osm module
      to geopy.geocoders.nominatim. The old module is still present for
      ๐Ÿšš backwards compatibility, but it will be removed in geopy 3.

Previous changes from v2.0.0.rc1

  • ๐Ÿš€ geopy 2.0 is a major release with lots of cleanup and inner refactorings.
    The public interface of the library is mostly the same, and the set
    ๐Ÿ‘ of supported geocoders didn't change.

    ๐Ÿš€ If you have checked your code on the latest 1.x release with enabled
    โš  warnings (i.e. with -Wd key of the python command) and fixed
    โฌ†๏ธ all of them, then it should be safe to upgrade.

    ๐Ÿ†• New features

    geopy.adapters module. Previously all geocoders used urllib
    ๐Ÿ‘ for HTTP requests, which doesn't support keepalives. Adapters is
    a new mechanism which allows to use other HTTP client implementations.

    There are 3 implementations coming out of the box:

    • geopy.adapters.RequestsAdapter -- uses requests library
      ๐Ÿ‘ which supports keepalives (thus it is significantly more effective
      ๐Ÿ“ฆ than urllib). It is used by default if requests package
      is installed.
    • geopy.adapters.URLLibAdapter -- uses urllib, basically
      0๏ธโƒฃ it provides the same behavior as in geopy 1.x. It is used by default if
      ๐Ÿ“ฆ requests package is not installed.

    - geopy.adapters.AioHTTPAdapter -- uses aiohttp library.

    โž• Added optional asyncio support in all geocoders via
    ๐Ÿ‘€ .AioHTTPAdapter, see the new Async Mode
    doc section.

    .AsyncRateLimiter -- an async counterpart of .RateLimiter.

    .RateLimiter is now thread-safe.

    Packaging changes

    โฌ‡๏ธ Dropped support for Python 2.7 and 3.4.

    ๐Ÿ†• New extras:

    • geopy[requests] for geopy.adapters.RequestsAdapter.
    • geopy[aiohttp] for geopy.adapters.AioHTTPAdapter.

    Chores

    • geopy.distance algorithms now raise ValueError for points with
      different altitudes, because altitude is ignored in calculations.
    • โœ‚ Removed geopy.distance.vincenty, use geopy.distance.geodesic instead.
    • โฑ timeout=None now disables request timeout, previously
      0๏ธโƒฃ a default timeout has been used in this case.
    • โœ‚ Removed GoogleV3.timezone, use .GoogleV3.reverse_timezone instead.
    • โœ‚ Removed format_string param from all geocoders.
      ๐Ÿ‘€ See Specifying Parameters Once doc section for alternatives.
    • 0๏ธโƒฃ exactly_one's default is now True for all geocoders
      and methods.
    • Removed service-specific request params from all __init__ methods
      of geocoders. Pass them to the corresponding geocode/reverse
      methods instead.
    • All bounding box arguments now must be passed as a list of two Points.
      Previously some geocoders accepted unique formats like plain strings
      and lists of 4 coordinates -- these values are not valid anymore.
    • .GoogleV3.reverse_timezone used to allow numeric at_time value.
      Pass datetime instances instead.
    • ๐Ÿ“œ reverse methods used to bypass the query if it couldn't be parsed
      as a .Point. Now a ValueError is raised in this case.
    • .Location and .Timezone classes no longer accept None
      for point and raw args.
    • ๐Ÿ”ง .Nominatim now raises geopy.exc.ConfigurationError when
      0๏ธโƒฃ used with a default or sample user-agent.
    • .Point now raises a ValueError if constructed from a single number.
      A zero longitude must be explicitly passed to avoid the error.
    • Most of the service-specific arguments of geocoders now must be passed
      as kwargs, positional arguments are not accepted.
    • โœ‚ Removed default value None for authentication key arguments of
      .GeoNames, .OpenMapQuest and .Yandex.
    • ๐Ÿ›  parse_* methods in geocoders have been prefixed with _
      to explicitly mark that they are private.