Browse Source

drop compatibility with python3.6

https://github.com/fphammerle/ical2vdir/commit/2b32144312b59398a91d4814ea1d3981076b3238
https://github.com/fphammerle/acpi-backlight/commit/6bcb9e76e45fc9564ad78feb8d211e6ac950bc65
Fabian Peter Hammerle 4 months ago
parent
commit
537da19ebc
4 changed files with 16 additions and 15 deletions
  1. 0 1
      .github/workflows/python.yml
  2. 1 1
      CHANGELOG.md
  3. 11 9
      location_guessing_game_telegram_bot/__init__.py
  4. 4 4
      setup.py

+ 0 - 1
.github/workflows/python.yml

@@ -34,7 +34,6 @@ jobs:
     strategy:
       matrix:
         python-version:
-        - '3.6'
         - '3.7'
         - '3.8'
         - '3.9'

+ 1 - 1
CHANGELOG.md

@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   (by manually setting build argument `SETUPTOOLS_SCM_PRETEND_VERSION`)
 
 ### Removed
-- compatibility with `python3.5`
+- compatibility with `python3.5` & `python3.6`
 
 ## [0.1.1] - 2021-02-14
 ### Fixed

+ 11 - 9
location_guessing_game_telegram_bot/__init__.py

@@ -15,7 +15,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
+from __future__ import annotations
+
 import argparse
+import dataclasses
 import json
 import logging
 import os
@@ -30,20 +33,19 @@ import telegram.update
 _LOGGER = logging.getLogger(__name__)
 
 
+@dataclasses.dataclass
 class _Photo:
-    def __init__(
-        self, *, photo_url: str, description_url: str, latitude: float, longitude: float
-    ) -> None:
-        self.photo_url = photo_url
-        self.description_url = description_url
-        self.latitude = latitude
-        self.longitude = longitude
+
+    photo_url: str
+    description_url: str
+    latitude: float
+    longitude: float
 
     def __str__(self) -> str:
         return "photo " + self.description_url
 
     @classmethod
-    def from_wikimap_export(cls, data: dict) -> "_Photo":
+    def from_wikimap_export(cls, data: dict) -> _Photo:
         if isinstance(data["coordinates"], list):
             coords = data["coordinates"][0]
         else:
@@ -168,7 +170,7 @@ def _run(
     updater.start_polling()
 
 
-def _main():
+def _main() -> None:
     argparser = _EnvDefaultArgparser()
     argparser.add_argument(
         "--telegram-token-path",

+ 4 - 4
setup.py

@@ -47,13 +47,12 @@ setuptools.setup(
     ],
     classifiers=[
         # https://pypi.org/classifiers/
-        "Development Status :: 3 - Alpha",
+        "Development Status :: 4 - Beta",
         "Intended Audience :: End Users/Desktop",
         "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
         "Operating System :: OS Independent",
         "Topic :: Games/Entertainment",
         # .github/workflows/python.yml
-        "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
@@ -64,8 +63,9 @@ setuptools.setup(
             "location-guessing-game-telegram-bot = location_guessing_game_telegram_bot:_main",
         ]
     },
-    # f-strings & force kwargs with *
-    python_requires=">=3.6",
+    # >=3.6 f-strings & force kwargs with *
+    # >=3.7 postponed evaluation of type annotations (PEP563) & dataclass
+    python_requires=">=3.7",
     install_requires=[
         # >=13.0 provides telegram.chat.Chat.send_location shortcut
         # https://github.com/python-telegram-bot/python-telegram-bot/commit/fc5844c13da3b3fb20bb2d0bfcdf1efb1a826ba6#diff-2590f2bde47ea3730442f14a3a029ef77d8f2c8f3186cf5edd7e18bcc7243c39R381