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

Add Python 3.13, drop Python 3.8 #262

Merged
merged 3 commits into from
Oct 24, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

name: Python ${{ matrix.python-version}}
steps:
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ test: devenv

# Format files
format: devenv
uv run tox exec -e py38-lint -- ruff format
uv run tox exec -e py39-lint -- ruff format

# Lint files
lint: devenv
uv run tox -e py38-lint
uv run tox -e py39-lint

# Wipe devenv and build artifacts
clean:
Expand Down
31 changes: 15 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ readme = "README.rst"
keywords = ["conf", "config", "configuration", "ini", "env", "yaml"]
authors = [{name = "Will Kahn-Greene"}]
license = {text = "MPLv2"}
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = []
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Natural Language :: English",
"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 :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand Down Expand Up @@ -47,8 +47,7 @@ dev = [
"tox-uv",
"twine",
"types-PyYAML",
"Sphinx==7.2.6; python_version > '3.8'",
"Sphinx==6.2.1; python_version <= '3.8'",
"Sphinx==7.2.6",
"sphinx_rtd_theme",
]

Expand All @@ -59,7 +58,7 @@ build-backend = "setuptools.build_meta"


[tool.ruff]
target-version = "py38"
target-version = "py39"
src = ["src"]
line-length = 88

Expand All @@ -76,7 +75,7 @@ docstring-quotes = "double"


[tool.mypy]
python_version = "3.8"
python_version = "3.9"
disallow_untyped_defs = true

[[tool.mypy.overrides]]
Expand All @@ -103,41 +102,41 @@ filterwarnings = [
legacy_tox_ini = """
[tox]
envlist =
py38
py38-doctest
py38-lint
py38-typecheck
py39
py39-doctest
py39-lint
py39-typecheck
py310
py311
py312
py313
uv_python_preference = only-managed

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313

[testenv]
extras = dev,ini,sphinx,yaml
commands = pytest {posargs} tests/

[testenv:py38-doctest]
[testenv:py39-doctest]
commands = pytest --doctest-modules src/

[testenv:py38-lint]
[testenv:py39-lint]
allowlist_externals = ruff
basepython = python3.8
basepython = python3.9
changedir = {toxinidir}
commands =
ruff format --check tests docs examples
ruff check src tests docs examples

[testenv:py38-typecheck]
basepython = python3.8
[testenv:py39-typecheck]
basepython = python3.9
changedir = {toxinidir}
commands =
mypy src/everett/
Expand Down
4 changes: 2 additions & 2 deletions src/everett/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
version as importlib_version,
PackageNotFoundError,
)
from typing import Callable, List, Union
from typing import Callable, Union


try:
Expand Down Expand Up @@ -60,7 +60,7 @@ class DetailedConfigurationError(ConfigurationError):
"""Base class for configuration errors that have a msg, namespace, key, and parser."""

def __init__(
self, msg: str, namespace: Union[List[str], None], key: str, parser: Callable
self, msg: str, namespace: Union[list[str], None], key: str, parser: Callable
):
self.msg = msg
self.namespace = namespace
Expand Down
10 changes: 5 additions & 5 deletions src/everett/ext/inifile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import logging
import os
from typing import Dict, List, Optional, Union
from typing import Optional, Union

from configobj import ConfigObj

Expand Down Expand Up @@ -124,7 +124,7 @@ class ConfigIniEnv:

"""

def __init__(self, possible_paths: Union[str, List[str]]) -> None:
def __init__(self, possible_paths: Union[str, list[str]]) -> None:
"""
:param possible_paths: either a single string with a file path (e.g.
``"/etc/project.ini"`` or a list of strings with file paths
Expand All @@ -147,11 +147,11 @@ def __init__(self, possible_paths: Union[str, List[str]]) -> None:
if not self.path:
logger.debug("No INI file found: %s", possible_paths)

def parse_ini_file(self, path: str) -> Dict:
def parse_ini_file(self, path: str) -> dict:
"""Parse ini file at ``path`` and return dict."""
cfgobj = ConfigObj(path, list_values=False)

def extract_section(namespace: List[str], d: Dict) -> Dict:
def extract_section(namespace: list[str], d: dict) -> dict:
cfg = {}
for key, val in d.items():
if isinstance(d[key], dict):
Expand All @@ -164,7 +164,7 @@ def extract_section(namespace: List[str], d: Dict) -> Dict:
return extract_section([], cfgobj.dict())

def get(
self, key: str, namespace: Optional[List[str]] = None
self, key: str, namespace: Optional[list[str]] = None
) -> Union[str, NoValue]:
"""Retrieve value for key."""
if not self.path:
Expand Down
12 changes: 6 additions & 6 deletions src/everett/ext/yamlfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import logging
import os
from typing import Dict, List, Optional, Union
from typing import Optional, Union

import yaml

Expand Down Expand Up @@ -109,7 +109,7 @@ class ConfigYamlEnv:

"""

def __init__(self, possible_paths: Union[str, List[str]]) -> None:
def __init__(self, possible_paths: Union[str, list[str]]) -> None:
"""
:param possible_paths: either a single string with a file path (e.g.
``"/etc/project.yaml"`` or a list of strings with file paths
Expand All @@ -132,15 +132,15 @@ def __init__(self, possible_paths: Union[str, List[str]]) -> None:
if not self.path:
logger.debug("No YAML file found: %s", possible_paths)

def parse_yaml_file(self, path: str) -> Dict:
def parse_yaml_file(self, path: str) -> dict:
"""Parse yaml file at ``path`` and return a dict."""
with open(path, "r") as fp:
with open(path) as fp:
data = yaml.safe_load(fp)

if not data:
return {}

def traverse(namespace: List[str], d: Dict) -> Dict:
def traverse(namespace: list[str], d: dict) -> dict:
cfg = {}
for key, val in d.items():
if isinstance(val, dict):
Expand All @@ -161,7 +161,7 @@ def traverse(namespace: List[str], d: Dict) -> Dict:
return traverse([], data)

def get(
self, key: str, namespace: Optional[List[str]] = None
self, key: str, namespace: Optional[list[str]] = None
) -> Union[str, NoValue]:
"""Retrieve value for key."""
if not self.path:
Expand Down
Loading