Skip to content

Drop Python 3.7 support #885

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

Merged
merged 1 commit into from
May 18, 2025
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
18 changes: 1 addition & 17 deletions .github/workflows/tests-and-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,12 @@ on: [push, pull_request, workflow_dispatch]

jobs:

tests-on-legacy-versions:
name: Run tests on legacy versions
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install tox
- run: tox
env:
TOXENV: ${{ matrix.python-version }}

test-on-different-versions:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", 3.11, 3.12, 3.13]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ maintainers = [
description = "Dependency injection framework for Python"
readme = {file = "README.rst", content-type = "text/x-rst"}
license = {file = "LICENSE.rst", content-type = "text/x-rst"}
requires-python = ">=3.7"
requires-python = ">=3.8"
keywords = [
"Dependency injection",
"DI",
Expand All @@ -31,7 +31,6 @@ classifiers = [
"Operating System :: OS Independent",
"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
11 changes: 3 additions & 8 deletions src/dependency_injector/providers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ from __future__ import absolute_import

import asyncio
import builtins
import contextvars
import copy
import errno
import functools
Expand All @@ -17,6 +16,7 @@ import sys
import threading
import warnings
from configparser import ConfigParser as IniConfigParser
from contextvars import ContextVar

try:
from inspect import _is_coroutine_mark as _is_coroutine_marker
Expand Down Expand Up @@ -3224,15 +3224,10 @@ cdef class ContextLocalSingleton(BaseSingleton):
:param provides: Provided type.
:type provides: type
"""
if not contextvars:
raise RuntimeError(
"Contextvars library not found. This provider "
"requires Python 3.7 or a backport of contextvars. "
"To install a backport run \"pip install contextvars\"."
)


super(ContextLocalSingleton, self).__init__(provides, *args, **kwargs)
self._storage = contextvars.ContextVar("_storage", default=self._none)
self._storage = ContextVar("_storage", default=self._none)

def reset(self):
"""Reset cached instance, if any.
Expand Down
1 change: 0 additions & 1 deletion tests/unit/providers/resource/test_async_resource_py35.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ async def _init():


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

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
parallel_show_output = true
envlist=
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
coveralls, pylint, flake8, pydocstyle, pydantic-v1, pydantic-v2, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, pypy3.9, pypy3.10

[testenv]
deps=
Expand Down