Skip to content

Commit 9a08bfc

Browse files
authored
Drop Python 3.7 support (#885)
1 parent 4ae79ac commit 9a08bfc

File tree

5 files changed

+6
-29
lines changed

5 files changed

+6
-29
lines changed

.github/workflows/tests-and-linters.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,12 @@ on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66

7-
tests-on-legacy-versions:
8-
name: Run tests on legacy versions
9-
runs-on: ubuntu-20.04
10-
strategy:
11-
matrix:
12-
python-version: [3.7]
13-
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-python@v4
16-
with:
17-
python-version: ${{ matrix.python-version }}
18-
- run: pip install tox
19-
- run: tox
20-
env:
21-
TOXENV: ${{ matrix.python-version }}
22-
237
test-on-different-versions:
248
name: Run tests
259
runs-on: ubuntu-latest
2610
strategy:
2711
matrix:
28-
python-version: [3.8, 3.9, "3.10", 3.11, 3.12, 3.13]
12+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2913
steps:
3014
- uses: actions/checkout@v3
3115
- uses: actions/setup-python@v4

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ maintainers = [
1313
description = "Dependency injection framework for Python"
1414
readme = {file = "README.rst", content-type = "text/x-rst"}
1515
license = {file = "LICENSE.rst", content-type = "text/x-rst"}
16-
requires-python = ">=3.7"
16+
requires-python = ">=3.8"
1717
keywords = [
1818
"Dependency injection",
1919
"DI",
@@ -31,7 +31,6 @@ classifiers = [
3131
"Operating System :: OS Independent",
3232
"Programming Language :: Python",
3333
"Programming Language :: Python :: 3",
34-
"Programming Language :: Python :: 3.7",
3534
"Programming Language :: Python :: 3.8",
3635
"Programming Language :: Python :: 3.9",
3736
"Programming Language :: Python :: 3.10",

src/dependency_injector/providers.pyx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ from __future__ import absolute_import
44

55
import asyncio
66
import builtins
7-
import contextvars
87
import copy
98
import errno
109
import functools
@@ -17,6 +16,7 @@ import sys
1716
import threading
1817
import warnings
1918
from configparser import ConfigParser as IniConfigParser
19+
from contextvars import ContextVar
2020

2121
try:
2222
from inspect import _is_coroutine_mark as _is_coroutine_marker
@@ -3223,15 +3223,10 @@ cdef class ContextLocalSingleton(BaseSingleton):
32233223
:param provides: Provided type.
32243224
:type provides: type
32253225
"""
3226-
if not contextvars:
3227-
raise RuntimeError(
3228-
"Contextvars library not found. This provider "
3229-
"requires Python 3.7 or a backport of contextvars. "
3230-
"To install a backport run \"pip install contextvars\"."
3231-
)
3226+
32323227

32333228
super(ContextLocalSingleton, self).__init__(provides, *args, **kwargs)
3234-
self._storage = contextvars.ContextVar("_storage", default=self._none)
3229+
self._storage = ContextVar("_storage", default=self._none)
32353230

32363231
def reset(self):
32373232
"""Reset cached instance, if any.

tests/unit/providers/resource/test_async_resource_py35.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ async def _init():
3434

3535

3636
@mark.asyncio
37-
@mark.skipif(sys.version_info < (3, 6), reason="requires Python 3.6+")
3837
async def test_init_async_generator():
3938
resource = object()
4039

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
parallel_show_output = true
33
envlist=
4-
coveralls, pylint, flake8, pydocstyle, pydantic-v1, pydantic-v2, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, pypy3.9, pypy3.10
4+
coveralls, pylint, flake8, pydocstyle, pydantic-v1, pydantic-v2, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, pypy3.9, pypy3.10
55

66
[testenv]
77
deps=

0 commit comments

Comments
 (0)