Skip to content

Commit

Permalink
Support and test python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
MrThearMan committed Oct 10, 2024
1 parent a7b8c6f commit 1a558af
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
test:
uses: MrThearMan/CI/.github/workflows/[email protected]
with:
python-version: '["3.10", "3.11", "3.12"]'
python-version: '["3.10", "3.11", "3.12", "3.13"]'
16 changes: 16 additions & 0 deletions env_config/decorators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from typing import Any, Callable, Generic, TypeVar

__all__ = [
"classproperty",
]


R = TypeVar("R")


class classproperty(Generic[R]): # noqa: N801
def __init__(self, func: Callable[[type], Any]) -> None:
self.func = func

def __get__(self, instance: object, owner: type) -> Any:
return self.func(owner)
16 changes: 14 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
Expand Down Expand Up @@ -247,8 +248,18 @@ banned-from = [
"yaml",
]

[tool.ruff.lint.pep8-naming]
classmethod-decorators = [
"classproperty",
]

[tool.ruff.lint.pydocstyle]
property-decorators = [
"env_config.decorators.classproperty",
]

[tool.mypy]
python_version = "3.12"
python_version = "3.13"
warn_return_any = "True"
warn_unused_configs = "True"
ignore_missing_imports = "True"
Expand Down Expand Up @@ -283,14 +294,15 @@ addopts = "-vv -s --disable-warnings"
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{310, 311, 312}-django{42, 50, 51}
envlist = py{310, 311, 312, 313}-django{42, 50, 51}
isolated_build = true
[gh-actions]
python =
3.10: py310
3.11: py311
3.12: py312
3.13: py313
[testenv]
allowlist_externals =
Expand Down
4 changes: 2 additions & 2 deletions tests/test_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from env_config import Environment, values
from env_config.constants import Undefined
from env_config.decorators import classproperty
from env_config.errors import MissingEnvValueError
from tests.helpers import set_dotenv, set_environ

Expand Down Expand Up @@ -56,8 +57,7 @@ def test_environment__set_globals__classproperty():
class Test(Environment):
FOO = values.StringValue()

@classmethod
@property
@classproperty
def BAR(cls):
return f"{cls.FOO.upper()}"

Expand Down

0 comments on commit 1a558af

Please sign in to comment.