Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Drop python 3.7 support #343

Merged
merged 2 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.11"]
python-version: ["3.8", "3.11"]
steps:
- uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
poetry 1.5.0
python 3.11.0 3.10.7 3.9.13 3.8.13 3.7.12
python 3.11.0 3.10.7 3.9.13 3.8.13
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

<!-- Maintainers, insert changes / features for the next release here -->

### Breaking

- Drop python 3.7 support (#343)

EOL June 27th, 2023

## cihai 0.19.0 (2023-05-28)

_Maintenance only, no bug fixes or features_
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ $ cd cihai/
- [Datasets](https://cihai.git-pull.com/datasets.html) a full list of current and future data sets
- Python [API](https://cihai.git-pull.com/api.html)
- [Roadmap](https://cihai.git-pull.com/design-and-planning/)
- Python support: >= 3.7, pypy
- Python support: >= 3.8, pypy
- Source: <https://github.com/cihai/cihai>
- Docs: <https://cihai.git-pull.com>
- Changelog: <https://cihai.git-pull.com/history.html>
Expand Down
129 changes: 41 additions & 88 deletions poetry.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down Expand Up @@ -54,7 +53,7 @@ Repository = "https://github.com/cihai/cihai"
"Q & A" = "https://github.com/cihai/cihai/discussions"

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"
appdirs = "*"
PyYAML = "~6.0"
sqlalchemy = "<1.4"
Expand All @@ -68,8 +67,8 @@ furo = "*"
gp-libs = "*"
sphinx-autobuild = "*"
sphinx-autodoc-typehints = "*"
sphinx-inline-tabs = "<2023.4.21" # For Python 3.7 support
sphinxext-opengraph = "<0.8" # https://github.com/wpilibsuite/sphinxext-opengraph/issues/100
sphinx-inline-tabs = "*" # For Python 3.7 support
sphinxext-opengraph = "<0.8" # https://github.com/wpilibsuite/sphinxext-opengraph/issues/100
sphinx-copybutton = "*"
sphinxext-rediraffe = "*"
myst_parser = ">=0.18.1"
Expand Down
2 changes: 1 addition & 1 deletion src/cihai/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def expand_config(d, dirs):
d[k] = d[k].format(**context)


class Configurator(object):
class Configurator:
def __init__(self, namespace=""):
"""
Manage config. Provides facilities for loading / writing configs.
Expand Down
4 changes: 2 additions & 2 deletions src/cihai/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def kuten_to_gb2312(kuten):
zone, point = int(kuten[:2]), int(kuten[2:])
hi, lo = hexd(zone + 0x20), hexd(point + 0x20)

gb2312 = "%s%s" % (hi, lo)
gb2312 = "{}{}".format(hi, lo)

assert isinstance(gb2312, bytes)
return gb2312
Expand All @@ -91,7 +91,7 @@ def gb2312_to_euc(gb2312hex):
hi, lo = int(gb2312hex[:2], 16), int(gb2312hex[2:], 16)
hi, lo = hexd(hi + 0x80), hexd(lo + 0x80)

euc = "%s%s" % (hi, lo)
euc = "{}{}".format(hi, lo)
assert isinstance(euc, bytes)
return euc

Expand Down
6 changes: 3 additions & 3 deletions src/cihai/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
log = logging.getLogger(__name__)


class Cihai(object):
class Cihai:
"""
Central application object.

Expand Down Expand Up @@ -133,11 +133,11 @@ def from_file(cls, config_path=None, *args, **kwargs):
if config_path:
if not os.path.exists(config_path):
raise exc.CihaiException(
"{0} does not exist.".format(os.path.abspath(config_path))
f"{os.path.abspath(config_path)} does not exist."
)
if config_path.suffix not in [".json", ".yml", ".yaml"]:
raise exc.CihaiException(
"{0} does not have a yaml, yml, json extension.".format(
"{} does not have a yaml, yml, json extension.".format(
os.path.abspath(config_path)
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/cihai/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sqlalchemy.orm import Session


class Database(object):
class Database:
"""
Cihai SQLAlchemy instance
"""
Expand Down
8 changes: 4 additions & 4 deletions src/cihai/extend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from . import utils


class ConfigMixin(object):
class ConfigMixin:
"""
This piggybacks cihai's global config state, as well as your datasets.

Expand Down Expand Up @@ -47,7 +47,7 @@ class ConfigMixin(object):
"""


class SQLAlchemyMixin(object):
class SQLAlchemyMixin:
"""Your dataset can use any backend you'd like, we provide a backend for you, that
automatically piggybacks on cihai's zero-config, XDG / SQLAchemy configuration. So
it's preconfigured for the user.
Expand Down Expand Up @@ -75,7 +75,7 @@ class SQLAlchemyMixin(object):
base = None


class Dataset(object):
class Dataset:
"""
Cihai dataset, e.g. UNIHAN.

Expand All @@ -100,7 +100,7 @@ def add_plugin(self, _cls, namespace, bootstrap=True):
plugin.bootstrap()


class DatasetPlugin(object):
class DatasetPlugin:
"""
Extend the functionality of datasets with custom methods, actions, etc.

Expand Down
2 changes: 1 addition & 1 deletion src/cihai/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def format(self, record):
try:
record.message = record.getMessage()
except Exception as e:
record.message = "Bad message (%r): %r" % (e, record.__dict__)
record.message = "Bad message ({!r}): {!r}".format(e, record.__dict__)

date_format = "%H:%m:%S"
record.asctime = time.strftime(date_format, self.converter(record.created))
Expand Down
5 changes: 1 addition & 4 deletions tests/data/unihan/test_bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# -*- coding: utf8 - *-
from cihai.core import Cihai
from cihai.data.unihan import bootstrap


def test_reflect_db(tmpdb_file, unihan_options):
c = Cihai(
{"database": {"url": "sqlite:///{tmpdb_file}".format(tmpdb_file=tmpdb_file)}}
)
c = Cihai({"database": {"url": f"sqlite:///{tmpdb_file}"}})
assert not c.unihan.is_bootstrapped
bootstrap.bootstrap_unihan(c.sql.metadata, unihan_options)
assert not hasattr(c.sql.base.classes, "Unihan")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def test_str():
c1 = "(same as U+7A69 穩) firm; stable; secure"
c2 = str()
c2 = ""

assert isinstance(c1, str)
assert isinstance(c2, str)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_middleware/simple/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class DatasetExample(object):
class DatasetExample:

"""Sample dataset to demonstrate a simple extension with Cihai.

Expand Down