Skip to content

Commit dbe69f5

Browse files
author
Denis Navarro
committed
chore(*): Remove Python 3.7 and Python 3.8 support and add Python 3.11, Python 3.12 and Python 3.13 support
1 parent c648813 commit dbe69f5

File tree

18 files changed

+122
-96
lines changed

18 files changed

+122
-96
lines changed

.github/workflows/cd.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
env:
1616
VERSION: ${{ github.event.inputs.release_version }}
1717
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions/setup-python@v4
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
2020
with:
21-
python-version: '3.12'
21+
python-version: '3.13'
2222
- name: version
2323
run: sed -i "s/__version__ = '.*'/__version__ = '$VERSION'/g" aiodi/__init__.py
2424
- name: deps

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ ubuntu-latest ]
17-
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
17+
python-version: [ 3.9', '3.10', '3.11', '3.12', '3.13 ]
1818
steps:
19-
- uses: actions/checkout@v3
20-
- uses: actions/setup-python@v4
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323
- name: deps

Containerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM docker.io/library/python:3.9-slim AS production
2+
3+
WORKDIR /app
4+
5+
RUN apt update -y && apt upgrade -y
6+
RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install --upgrade pip
7+
8+
COPY LICENSE README.md pyproject.toml ./
9+
COPY aiodi ./aiodi/
10+
11+
RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install .
12+
13+
ENTRYPOINT ["python3"]
14+
CMD []
15+
16+
FROM production AS development
17+
18+
RUN apt install -y gcc
19+
20+
COPY .pre-commit-config.yaml run-script ./
21+
22+
RUN --mount=type=cache,target=/root/.cache/pip python3 run-script dev-install
23+
24+
COPY docs_src ./docs_src
25+
COPY tests ./tests
26+
27+
ENTRYPOINT ["python3", "run-script"]

Dockerfile

Lines changed: 0 additions & 27 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 - 2023 aiopy
3+
Copyright (c) 2022 - 2024 aiopy
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ if __name__ == '__main__':
167167

168168
## Requirements
169169

170-
- Python >= 3.8
170+
- Python >= 3.9
171171

172172
## Contributing
173173

aiodi/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(
5555
'variable': VariableResolver(),
5656
}
5757
self._decoders = {
58-
'toml': lambda path: (toml_decoder or lazy_toml_decoder())(path).get('tool', {}).get(tool_key, {}), # type: ignore
58+
'toml': lambda path: (toml_decoder or lazy_toml_decoder())(path).get('tool', {}).get(tool_key, {}),
5959
}
6060

6161
def map_items(items: Dict[str, Dict[str, Any]]) -> List[Tuple[str, Any, Dict[str, Any]]]:

aiodi/container.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def resolve_parameter(self, fn: Callable[['Container'], Any]) -> Tuple[int, Call
4747
return len(self._parameter_resolvers) - 1, fn
4848

4949
def resolve(self, items: List[Union[ContainerKey, Tuple[ContainerKey, _T, Dict[str, Any]]]]) -> None:
50-
items_ = list(map(self._sanitize_item_before_resolve, items))
50+
items_: List[Any] = list(map(self._sanitize_item_before_resolve, items))
5151
while items_:
5252
for index, item in enumerate(items_):
5353
# Check if already exist
@@ -68,7 +68,7 @@ def resolve(self, items: List[Union[ContainerKey, Tuple[ContainerKey, _T, Dict[s
6868
if kwargs is not None:
6969
if self.debug:
7070
logger.debug('Resolving {0}'.format(item[1]))
71-
inst = item[1](**kwargs) # type: ignore
71+
inst = item[1](**kwargs)
7272
if self.debug:
7373
logger.debug('Adding {0} - {1}'.format(item[0], item[1]))
7474
self.set(item[0], inst)
@@ -162,7 +162,7 @@ def _sanitize_item_before_resolve(
162162
if length == 2:
163163
return item[0], item[1], {}
164164
if length >= 3:
165-
return item[:3] # type: ignore
165+
return item[:3]
166166
raise ValueError('Tuple must be at least of one item')
167167

168168
def _resolve_or_postpone_item(

docker-compose.yml renamed to compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ services:
22
aiodi:
33
build:
44
context: .
5-
dockerfile: Dockerfile
5+
dockerfile: Containerfile
66
target: development
77
image: ghcr.io/aiopy/python-aiodi:${VERSION:-latest}
88
volumes:
99
- .:/app
10-
11-
version: "3.8"

docs_src/docs/en/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Key Features:
1010

1111
## Requirements
1212

13-
- Python 3.8+
13+
- Python 3.9+
1414

1515
## Installation
1616

docs_src/docs/es/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Funcionalidades clave:
1010

1111
## Requisitos
1212

13-
- Python 3.8+
13+
- Python 3.9+
1414

1515
## Instalación
1616

docs_src/generated/en/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ <h1 id="aiodi">AIODI</h1>
418418
</ul>
419419
<h2 id="requirements">Requirements</h2>
420420
<ul>
421-
<li>Python 3.8+</li>
421+
<li>Python 3.9+</li>
422422
</ul>
423423
<h2 id="installation">Installation</h2>
424424
<div class="highlight"><pre><span></span><code>python3 -m pip install aiodi
@@ -609,4 +609,4 @@ <h2 id="license">License</h2>
609609

610610

611611
</body>
612-
</html>
612+
</html>

docs_src/generated/en/search/search_index.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"docs": [
1212
{
1313
"location": "",
14-
"text": "AIODI A modern Python Dependency Injection library that allows you to standardize and centralize the way objects are constructed in your application highly inspired on PHP Symfony's DependencyInjection Component . Key Features: Standard-based : Implements PEP 621 storing project metadata in pyproject.toml . Dual mode : Setting dependencies using Python and using configuration files . Clean : Wherever you want just use it, no more decorators and defaults everywhere . Requirements Python 3.8+ Installation python3 -m pip install aiodi Example using Configuration Files # sample/pyproject.toml [tool.aiodi.variables] name = \"%env(str:APP_NAME, 'sample')%\" version = \"%env(int:APP_VERSION, '1')%\" log_level = \"%env(APP_LEVEL, 'INFO')%\" [tool.aiodi.services.\"_defaults\"] project_dir = \"../../..\" [tool.aiodi.services.\"logging.Logger\"] class = \"sample.libs.utils.get_simple_logger\" arguments = { name = \"%var(name)%\" , level = \"%var(log_level)%\" } [tool.aiodi.services.\"UserLogger\"] type = \"sample.libs.users.infrastructure.in_memory_user_logger.InMemoryUserLogger\" arguments = { commands = \"@logging.Logger\" } [tool.aiodi.services.\"*\"] _defaults = { autoregistration = { resource = \"sample/libs/*\" , exclude = \"sample/libs/users/{domain,infrastructure/in_memory_user_logger.py,infrastructure/*command.py}\" } } # sample/apps/settings.py from typing import Optional from aiodi import Container , ContainerBuilder def container ( filename : str , cwd : Optional [ str ] = None ) -> Container : return ContainerBuilder ( filenames = [ filename ], cwd = cwd ) . load () # sample/apps/cli/main.py from sample.apps.settings import container from logging import Logger def main () -> None : di = container ( filename = '../../pyproject.toml' ) di . get ( Logger ) . info ( 'Just simple call get with the type' ) di . get ( 'UserLogger' ) . logger () . info ( 'Just simple call get with the service name' ) Example using Python from abc import ABC , abstractmethod from logging import Logger , getLogger , NOTSET , StreamHandler , Formatter from os import getenv from aiodi import Container from typing import Optional , Union _CONTAINER : Optional [ Container ] = None def get_simple_logger ( name : Optional [ str ] = None , level : Union [ str , int ] = NOTSET , fmt : str = '[ %(asctime)s ] - %(name)s - %(levelname)s - %(message)s ' , ) -> Logger : logger = getLogger ( name ) logger . setLevel ( level ) handler = StreamHandler () handler . setLevel ( level ) formatter = Formatter ( fmt ) handler . setFormatter ( formatter ) logger . addHandler ( handler ) return logger class GreetTo ( ABC ): @abstractmethod def __call__ ( self , who : str ) -> None : pass class GreetToWithPrint ( GreetTo ): def __call__ ( self , who : str ) -> None : print ( 'Hello ' + who ) class GreetToWithLogger ( GreetTo ): _logger : Logger def __init__ ( self , logger : Logger ) -> None : self . _logger = logger def __call__ ( self , who : str ) -> None : self . _logger . info ( 'Hello ' + who ) def container () -> Container : global _CONTAINER if _CONTAINER : return _CONTAINER di = Container ({ 'env' : { 'name' : getenv ( 'APP_NAME' , 'aiodi' ), 'log_level' : getenv ( 'APP_LEVEL' , 'INFO' ), }}) di . resolve ([ ( Logger , get_simple_logger , { 'name' : di . resolve_parameter ( lambda di_ : di_ . get ( 'env.name' , typ = str )), 'level' : di . resolve_parameter ( lambda di_ : di_ . get ( 'env.log_level' , typ = str )), }, ), ( GreetTo , GreetToWithLogger ), # -> (GreetTo, GreetToWithLogger, {}) GreetToWithPrint , # -> (GreetToWithPrint, GreetToWithPrint, {}) ]) di . set ( 'who' , 'World!' ) # ... _CONTAINER = di return di def main () -> None : di = container () di . get ( Logger ) . info ( 'Just simple call get with the type' ) for greet_to in di . get ( GreetTo , instance_of = True ): greet_to ( di . get ( 'who' )) if __name__ == '__main__' : main () License MIT",
14+
"text": "AIODI A modern Python Dependency Injection library that allows you to standardize and centralize the way objects are constructed in your application highly inspired on PHP Symfony's DependencyInjection Component . Key Features: Standard-based : Implements PEP 621 storing project metadata in pyproject.toml . Dual mode : Setting dependencies using Python and using configuration files . Clean : Wherever you want just use it, no more decorators and defaults everywhere . Requirements Python 3.9+ Installation python3 -m pip install aiodi Example using Configuration Files # sample/pyproject.toml [tool.aiodi.variables] name = \"%env(str:APP_NAME, 'sample')%\" version = \"%env(int:APP_VERSION, '1')%\" log_level = \"%env(APP_LEVEL, 'INFO')%\" [tool.aiodi.services.\"_defaults\"] project_dir = \"../../..\" [tool.aiodi.services.\"logging.Logger\"] class = \"sample.libs.utils.get_simple_logger\" arguments = { name = \"%var(name)%\" , level = \"%var(log_level)%\" } [tool.aiodi.services.\"UserLogger\"] type = \"sample.libs.users.infrastructure.in_memory_user_logger.InMemoryUserLogger\" arguments = { commands = \"@logging.Logger\" } [tool.aiodi.services.\"*\"] _defaults = { autoregistration = { resource = \"sample/libs/*\" , exclude = \"sample/libs/users/{domain,infrastructure/in_memory_user_logger.py,infrastructure/*command.py}\" } } # sample/apps/settings.py from typing import Optional from aiodi import Container , ContainerBuilder def container ( filename : str , cwd : Optional [ str ] = None ) -> Container : return ContainerBuilder ( filenames = [ filename ], cwd = cwd ) . load () # sample/apps/cli/main.py from sample.apps.settings import container from logging import Logger def main () -> None : di = container ( filename = '../../pyproject.toml' ) di . get ( Logger ) . info ( 'Just simple call get with the type' ) di . get ( 'UserLogger' ) . logger () . info ( 'Just simple call get with the service name' ) Example using Python from abc import ABC , abstractmethod from logging import Logger , getLogger , NOTSET , StreamHandler , Formatter from os import getenv from aiodi import Container from typing import Optional , Union _CONTAINER : Optional [ Container ] = None def get_simple_logger ( name : Optional [ str ] = None , level : Union [ str , int ] = NOTSET , fmt : str = '[ %(asctime)s ] - %(name)s - %(levelname)s - %(message)s ' , ) -> Logger : logger = getLogger ( name ) logger . setLevel ( level ) handler = StreamHandler () handler . setLevel ( level ) formatter = Formatter ( fmt ) handler . setFormatter ( formatter ) logger . addHandler ( handler ) return logger class GreetTo ( ABC ): @abstractmethod def __call__ ( self , who : str ) -> None : pass class GreetToWithPrint ( GreetTo ): def __call__ ( self , who : str ) -> None : print ( 'Hello ' + who ) class GreetToWithLogger ( GreetTo ): _logger : Logger def __init__ ( self , logger : Logger ) -> None : self . _logger = logger def __call__ ( self , who : str ) -> None : self . _logger . info ( 'Hello ' + who ) def container () -> Container : global _CONTAINER if _CONTAINER : return _CONTAINER di = Container ({ 'env' : { 'name' : getenv ( 'APP_NAME' , 'aiodi' ), 'log_level' : getenv ( 'APP_LEVEL' , 'INFO' ), }}) di . resolve ([ ( Logger , get_simple_logger , { 'name' : di . resolve_parameter ( lambda di_ : di_ . get ( 'env.name' , typ = str )), 'level' : di . resolve_parameter ( lambda di_ : di_ . get ( 'env.log_level' , typ = str )), }, ), ( GreetTo , GreetToWithLogger ), # -> (GreetTo, GreetToWithLogger, {}) GreetToWithPrint , # -> (GreetToWithPrint, GreetToWithPrint, {}) ]) di . set ( 'who' , 'World!' ) # ... _CONTAINER = di return di def main () -> None : di = container () di . get ( Logger ) . info ( 'Just simple call get with the type' ) for greet_to in di . get ( GreetTo , instance_of = True ): greet_to ( di . get ( 'who' )) if __name__ == '__main__' : main () License MIT",
1515
"title": "aiodi"
1616
},
1717
{
@@ -21,7 +21,7 @@
2121
},
2222
{
2323
"location": "#requirements",
24-
"text": "Python 3.8+",
24+
"text": "Python 3.9+",
2525
"title": "Requirements"
2626
},
2727
{
@@ -45,4 +45,4 @@
4545
"title": "License"
4646
}
4747
]
48-
}
48+
}

docs_src/generated/es/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ <h1 id="aiodi">AIODI</h1>
418418
</ul>
419419
<h2 id="requisitos">Requisitos</h2>
420420
<ul>
421-
<li>Python 3.8+</li>
421+
<li>Python 3.9+</li>
422422
</ul>
423423
<h2 id="instalacion">Instalación</h2>
424424
<div class="highlight"><pre><span></span><code>python3 -m pip install aiodi
@@ -609,4 +609,4 @@ <h2 id="licencia">Licencia</h2>
609609

610610

611611
</body>
612-
</html>
612+
</html>

0 commit comments

Comments
 (0)