Skip to content

Shapely 2.0: support for logging ? #998

@jorisvandenbossche

Description

@jorisvandenbossche

Cfr #983 (comment)

Currently, Shapely provides logging functionality. You can do:

import logging
logger = logging.getLogger('shapely.geos')

from

https://github.com/Toblerity/Shapely/blob/1d734def727553e271481e8cf71f9ea8ba14bab9/shapely/geos.py#L22

in geos.py, it logs:

  • debug information about which GEOS library is found and loaded
  • error/notice messages from GEOS (using GEOS' error/notice handlers that can be registered)

At the moment PyGEOS doesn't provide any logging functionality. But so we should discuss how valuable / important this logging functionality is, and whether we want to keep this functionality in Shapely 2.0 or not (I never used this logging myself, so I don't really know in what situations it is being used and hard to judge this myself).
For the two types of logged information in the list above, in pygeos/Shapely 2.0:

  • Since finding the GEOS library is no longer done with custom logic in python (but the package is built against GEOS), this type of logging might no longer be relevant?
    (eg I think fiona, which uses logging extensively to log interaction with GDAL during runtime, and which is built against GDAL and not using ctypes, doesn't do any logging related to this)
  • The error/notice messages from GEOS are already turned into python exceptions and warnings (currently in pygeos, see https://github.com/pygeos/pygeos/blob/master/src/geos.h)

So this seems to make logging superfluous for PyGEOS/Shapely 2.0?

cc @sgillies @mwtoews @caspervdw @brendan-ward

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions