Skip to content

Commit 68f877c

Browse files
authored
Version 1.3.0 release (#528)
* Version 1.3.0 release * Fix CI * Fix CI
1 parent 520946c commit 68f877c

File tree

15 files changed

+681
-736
lines changed

15 files changed

+681
-736
lines changed

.github/workflows/test.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python-version: ['3.8', '3.9', '3.10']
16+
python-version: ['3.10', '3.11', '3.12']
1717
django-version:
18-
- 'Django~=3.2.0'
19-
- 'Django~=4.1.0'
2018
- 'Django~=4.2.0'
19+
- 'Django~=5.0.0'
2120
include:
22-
- python-version: '3.11'
23-
django-version: 'Django~=4.2.0'
21+
- python-version: '3.9'
22+
django-version: 'Django~=4.1.0'
23+
- python-version: '3.12'
24+
django-version: 'Django~=4.1.0'
2425

2526
steps:
2627
- uses: actions/checkout@v4

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
We follow Semantic Version.
44

55

6+
## 1.3.0
7+
8+
### Features
9+
10+
- Drops `python3.8` support
11+
- Adds `python3.11` and `python3.12` support
12+
- Adds `django5.0` support
13+
- Uses `OSError` instead of `IOError` alias
14+
- Converts `include(*args, **kwargs)` to `include(*args, scope=...)`,
15+
because other kwargs were not supported anyway
16+
17+
618
## 1.2.0
719

820
### Features

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Also, check this [example project](https://github.com/wemake-services/wemake-dja
2727

2828
While this package will most likely work with the most versions of `django`, we [officially support](https://github.com/sobolevn/django-split-settings/blob/master/.github/workflows/test.yml):
2929

30-
- 3.2
31-
- 4.1
3230
- 4.2
31+
- 5.0
32+
- 5.1
3333

3434
This package has no dependencies itself.
3535

docs/conf.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# Configuration file for the Sphinx documentation builder.
42
#
53
# This file does only contain a selection of the most common options. For a

poetry.lock

+614-678
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-split-settings"
3-
version = "1.2.0"
3+
version = "1.3.0"
44
description = "Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards and optional settings files."
55
authors = [
66
"sobolevn <[email protected]>",
@@ -32,6 +32,7 @@ classifiers = [
3232
"Framework :: Django :: 4.0",
3333
"Framework :: Django :: 4.1",
3434
"Framework :: Django :: 4.2",
35+
"Framework :: Django :: 5.0",
3536
"Intended Audience :: Developers",
3637
"License :: OSI Approved :: BSD License",
3738
"Operating System :: OS Independent",
@@ -44,20 +45,23 @@ classifiers = [
4445
"Funding" = "https://github.com/sponsors/wemake-services"
4546

4647
[tool.poetry.dependencies]
47-
python = "^3.8"
48+
python = "^3.9"
4849

49-
[tool.poetry.group.test.dependencies]
50-
django = "^4.2"
50+
[tool.poetry.group.dev.dependencies]
51+
django = [
52+
{ version = "^4.2", python = "<3.10" },
53+
{ version = "^5.0", python = ">=3.10" },
54+
]
5155

52-
mypy = "^1.4"
53-
wemake-python-styleguide = "^0.17"
56+
mypy = "^1.9"
57+
wemake-python-styleguide = "^0.18"
5458
flake8-pytest-style = "^1.5"
55-
nitpick = ">=0.33,<0.36"
59+
nitpick = "^0.35"
5660

5761
doc8 = "^1.1"
5862

59-
pytest = ">=7.3,<9.0"
60-
pytest-cov = "^4.0"
63+
pytest = "^8.0"
64+
pytest-cov = "^4.1"
6165
pytest-randomly = "^3.12"
6266

6367
[tool.poetry.group.docs]
@@ -71,7 +75,7 @@ tomli = "^2.0"
7175

7276

7377
[build-system]
74-
requires = ["poetry-core>=1.6.0"]
78+
requires = ["poetry-core>=1.9.0"]
7579
build-backend = "poetry.masonry.api"
7680

7781

setup.cfg

+17-21
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
# Base flake8 configuration:
77
# https://flake8.pycqa.org/en/latest/user/configuration.html
88
format = wemake
9-
show-source = True
10-
statistics = False
11-
doctests = True
9+
show-source = true
10+
doctests = true
1211

1312
# darglint configuration:
1413
# https://github.com/terrencepreilly/darglint
@@ -62,24 +61,21 @@ addopts =
6261

6362
[mypy]
6463
# The mypy configurations: http://bit.ly/2zEl9WI
65-
allow_redefinition = False
66-
check_untyped_defs = True
67-
disallow_untyped_decorators = True
68-
disallow_any_explicit = True
69-
disallow_any_generics = True
70-
disallow_untyped_calls = True
71-
ignore_errors = False
72-
ignore_missing_imports = True
73-
implicit_reexport = False
74-
strict_optional = True
75-
strict_equality = True
76-
local_partial_types = True
77-
no_implicit_optional = True
78-
warn_unused_ignores = True
79-
warn_redundant_casts = True
80-
warn_unused_configs = True
81-
warn_unreachable = True
82-
warn_no_return = True
64+
enable_error_code =
65+
truthy-bool,
66+
truthy-iterable,
67+
redundant-expr,
68+
unused-awaitable,
69+
ignore-without-code,
70+
possibly-undefined,
71+
redundant-self,
72+
73+
ignore_missing_imports = true
74+
strict = true
75+
warn_unreachable = true
76+
77+
[mypy-tests.*]
78+
disable_error_code = no-untyped-def
8379

8480

8581
[doc8]

split_settings/tools.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
settings files.
66
"""
77

8+
from __future__ import annotations
9+
810
import glob
911
import inspect
1012
import os
@@ -39,11 +41,14 @@ class _Optional(str): # noqa: WPS600
3941
"""
4042
Wrap a file path with this class to mark it as optional.
4143
42-
Optional paths don't raise an :class:`IOError` if file is not found.
44+
Optional paths don't raise an :class:`OSError` if file is not found.
4345
"""
4446

4547

46-
def include(*args: str, **kwargs) -> None: # noqa: WPS210, WPS231, C901
48+
def include( # noqa: WPS210, WPS231, C901
49+
*args: str,
50+
scope: dict[str, typing.Any] | None = None,
51+
) -> None:
4752
"""
4853
Used for including Django project settings from multiple files.
4954
@@ -52,7 +57,7 @@ def include(*args: str, **kwargs) -> None: # noqa: WPS210, WPS231, C901
5257
**kwargs: Settings context: ``scope=globals()`` or ``None``.
5358
5459
Raises:
55-
IOError: if a required settings file is not found.
60+
OSError: if a required settings file is not found.
5661
5762
Usage example:
5863
@@ -71,10 +76,10 @@ def include(*args: str, **kwargs) -> None: # noqa: WPS210, WPS231, C901
7176
"""
7277
# we are getting globals() from previous frame
7378
# globals - it is caller's globals()
74-
scope = kwargs.pop('scope', inspect.stack()[1][0].f_globals)
79+
scope = scope or inspect.stack()[1][0].f_globals
7580

7681
scope.setdefault('__included_files__', [])
77-
included_files = scope.get('__included_files__')
82+
included_files = scope.get('__included_files__', [])
7883

7984
including_file = scope.get(
8085
_INCLUDED_FILE,
@@ -90,7 +95,7 @@ def include(*args: str, **kwargs) -> None: # noqa: WPS210, WPS231, C901
9095
# (unless file is optional)
9196
files_to_include = glob.glob(pattern)
9297
if not files_to_include and not isinstance(conf_file, _Optional):
93-
raise IOError('No such file: {0}'.format(pattern))
98+
raise OSError('No such file: {0}'.format(pattern))
9499

95100
for included_file in files_to_include:
96101
included_file = os.path.abspath(included_file) # noqa: WPS440
@@ -114,7 +119,9 @@ def include(*args: str, **kwargs) -> None: # noqa: WPS210, WPS231, C901
114119
)
115120

116121
spec = spec_from_file_location(module_name, included_file)
117-
module = module_from_spec(spec) # type: ignore
122+
# This is only needed for mypy:
123+
assert spec is not None # noqa: S101
124+
module = module_from_spec(spec)
118125
sys.modules[module_name] = module
119126
if saved_included_file:
120127
scope[_INCLUDED_FILE] = saved_included_file

tests/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

tests/settings/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

tests/settings/merged/components/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Django settings for example project.
32

43
DEBUG = True

tests/settings/merged/components/locale.py

-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,5 @@
1212
# to load the internationalization machinery.
1313
USE_I18N = True
1414

15-
# If you set this to False, Django will not format dates, numbers and
16-
# calendars according to the current locale.
17-
USE_L10N = True
18-
1915
# If you set this to False, Django will not use timezone-aware datetimes.
2016
USE_TZ = True

tests/settings/stacked/db/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

tests/test_tools.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99

1010
def test_missing_file_error(scope):
11-
"""This test covers the IOError, when file does not exist."""
12-
with pytest.raises(IOError, match='does-not-exist.py'):
11+
"""This test covers the OSError, when file does not exist."""
12+
with pytest.raises(OSError, match='does-not-exist.py'):
1313
include('does-not-exist.py', scope=scope)
1414

1515

0 commit comments

Comments
 (0)