diff --git a/.gitignore b/.gitignore index f6d6332..dcb9eb1 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ dist/ *.py[cod] .vscode .dmypy.json +.python-version diff --git a/shapefile.py b/shapefile.py index 12af74d..6e8b2f2 100644 --- a/shapefile.py +++ b/shapefile.py @@ -14,7 +14,9 @@ import os import sys import tempfile +import textwrap import time +import warnings import zipfile from datetime import date from struct import Struct, calcsize, error, pack, unpack @@ -93,6 +95,31 @@ from urllib2 import HTTPError, Request, urlopen from urlparse import urlparse, urlunparse +if sys.version_info < (3, 9): + message = textwrap.dedent("""\ + Warning! + + It is proposed to drop support for Pythons 3.8 and earlier, including Python 2. + Thereafter, Python version support will follow the official Python release + cycle: https://devguide.python.org/versions/. This will make Python 3.9 the + earliest supported version until October 2025. + + For more information, and to send the developers your feedback please + see the following discussion: + https://github.com/GeospatialPython/pyshp/discussions/290 + + Many thanks, + """) + logger.warning(message) + warning = UserWarning(message) + warnings.warn(warning) + # warnings.showwarning( + # message, + # category=UserWarning, + # filename=__name__, + # lineno=115, + # ) + # Helpers