From e151aee32c070d39edc64e9c639dcb1aa3cde144 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 29 May 2023 08:59:08 +0300 Subject: [PATCH 1/4] Drop support for Python 3.7 --- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 2 +- pyproject.toml | 4 +--- src/norwegianblue/__init__.py | 10 ++-------- tox.ini | 2 +- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b060a68..a1d26ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy3.9", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] + python-version: ["pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] os: [windows-latest, macos-latest, ubuntu-latest] steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 681fff4..31d9d00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: rev: v3.3.1 hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py38-plus] - repo: https://github.com/psf/black rev: 23.3.0 diff --git a/pyproject.toml b/pyproject.toml index ce02310..7b4da25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ keywords = [ ] license = {text = "MIT"} authors = [{name = "Hugo van Kemenade"}] -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -25,7 +25,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -39,7 +38,6 @@ dynamic = [ ] dependencies = [ "httpx>=0.19", - 'importlib-metadata; python_version < "3.8"', "platformdirs", "prettytable>=2.4", "pytablewriter[html]>=0.63", diff --git a/src/norwegianblue/__init__.py b/src/norwegianblue/__init__.py index f250682..5fd45a4 100644 --- a/src/norwegianblue/__init__.py +++ b/src/norwegianblue/__init__.py @@ -5,6 +5,7 @@ from __future__ import annotations import datetime as dt +import importlib.metadata import json import logging from functools import lru_cache @@ -14,14 +15,7 @@ from norwegianblue import _cache -try: - # Python 3.8+ - import importlib.metadata as importlib_metadata -except ImportError: - # Python 3.7 - import importlib_metadata # type: ignore - -__version__ = importlib_metadata.version(__name__) +__version__ = importlib.metadata.version(__name__) __all__ = ["__version__"] diff --git a/tox.ini b/tox.ini index c0b20e1..86bdcbb 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist = cog lint pins - py{py3, 312, 311, 310, 39, 38, 37} + py{py3, 312, 311, 310, 39, 38} [testenv] extras = From c0c605d9ca20b680e66a19f3ac3e74d3d27a3ba8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 29 May 2023 09:00:36 +0300 Subject: [PATCH 2/4] Upgrade pre-commit --- .pre-commit-config.yaml | 10 +++++----- pyproject.toml | 28 ++++++++++++++-------------- tox.ini | 6 ++++-- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 31d9d00..460a73c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.4.0 hooks: - id: pyupgrade args: [--py38-plus] @@ -37,22 +37,22 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/tox-dev/pyproject-fmt - rev: 0.9.2 + rev: 0.10.0 hooks: - id: pyproject-fmt - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.12.2 + rev: v0.13 hooks: - id: validate-pyproject - repo: https://github.com/tox-dev/tox-ini-fmt - rev: 1.0.0 + rev: 1.3.0 hooks: - id: tox-ini-fmt - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v3.0.0-alpha.9-for-vscode hooks: - id: prettier args: [--prose-wrap=always, --print-width=88] diff --git a/pyproject.toml b/pyproject.toml index 7b4da25..4832515 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,20 +18,20 @@ license = {text = "MIT"} authors = [{name = "Hugo van Kemenade"}] requires-python = ">=3.8" classifiers = [ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "Intended Audience :: End Users/Desktop", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", ] dynamic = [ "version", diff --git a/tox.ini b/tox.ini index 86bdcbb..2ec3900 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,7 @@ [tox] -envlist = +requires = + tox>=4.2 +env_list = cog lint pins @@ -26,7 +28,7 @@ commands = skip_install = true deps = pre-commit -passenv = +pass_env = PRE_COMMIT_COLOR commands = pre-commit run --all-files --show-diff-on-failure From 320d972df735a703491bab79a0bedbd1feb003eb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 29 May 2023 09:03:07 +0300 Subject: [PATCH 3/4] CI: Use '3.12' and 'allow-prereleases: true' --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1d26ad..c5de8b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] + python-version: ["pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [windows-latest, macos-latest, ubuntu-latest] steps: @@ -21,6 +21,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true cache: pip cache-dependency-path: pyproject.toml From 39c3119256b90c3e7c69470631b07f89cf88675d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 29 May 2023 09:06:03 +0300 Subject: [PATCH 4/4] Update config --- .flake8 | 2 +- .pre-commit-config.yaml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index f4546ad..2bcd70e 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,2 @@ [flake8] -max_line_length = 88 +max-line-length = 88 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 460a73c..d51de44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,15 +26,18 @@ repos: rev: v1.10.0 hooks: - id: python-check-blanket-noqa + - id: python-no-log-warn - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - - id: check-json + - id: check-case-conflict - id: check-merge-conflict + - id: check-json - id: check-toml - id: check-yaml - id: requirements-txt-fixer + - id: end-of-file-fixer - repo: https://github.com/tox-dev/pyproject-fmt rev: 0.10.0