Skip to content

Commit 8e4dbbb

Browse files
authored
Merge pull request #96 from telefonicasc/update-python12-prelanding
Update python12 prelanding
2 parents 0a46397 + ad04f67 commit 8e4dbbb

File tree

5 files changed

+40
-23
lines changed

5 files changed

+40
-23
lines changed

.github/workflows/unit-testing.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,33 @@ name: Unit testing
44

55
on:
66
push:
7-
branches: [ "master" ]
7+
branches: ["master"]
88
pull_request:
9-
branches: [ "master" ]
9+
branches: ["master"]
1010

1111
permissions:
1212
contents: read
1313

1414
jobs:
1515
build:
16-
1716
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: [3.8, 3.12]
1820

1921
# FIXME: it would be great to use cache to avoid re-creating the virtualenv
20-
# and installing dependencies every time. We know the syphar/restore-virtualenv@v1 and
22+
# and installing dependencies every time. We know the syphar/restore-virtualenv@v1 and
2123
# syphar/restore-pip-download-cache@v1 actions, but it seems it only works if
2224
# dependencies are in requeriments.txt file (and in this case we have them in setup.py)
2325
steps:
24-
- uses: actions/checkout@v3
25-
- name: Set up Python 3.8
26-
uses: actions/setup-python@v3
27-
with:
28-
python-version: "3.8"
29-
- name: Install pytest tool
30-
run: pip install pytest==7.2.0
31-
- name: Install library dependencies
32-
run: pip install -e python-lib/tc_etl_lib
33-
- name: Test with pytest
34-
run: pytest -v python-lib/tc_etl_lib/
26+
- uses: actions/checkout@v3
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v3
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install pytest tool
32+
run: pip install pytest==8.3.4
33+
- name: Install library dependencies
34+
run: pip install -e python-lib/tc_etl_lib
35+
- name: Test with pytest
36+
run: pytest -v python-lib/tc_etl_lib/

python-lib/tc_etl_lib/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,15 +449,15 @@ $ (venv)$ pip install -e python-lib/tc_etl_lib # directorio en el que está set
449449
Adicionalmente, instalar las herramientas necesarias para ejecutar los tests:
450450

451451
```
452-
pip install pytest==7.2.0 coverage==7.0.5
452+
pip install pytest==8.3.4 coverage==7.6.9
453453
```
454454

455455
Para ejecutar un solo fichero de tests:
456456

457457
```
458458
$ (venv)$ pytest python-lib/tc_etl_lib/tc_etl_lib/test_store.py
459459
================================================================ test session starts =================================================================
460-
platform linux -- Python 3.9.2, pytest-7.2.0, pluggy-1.0.0
460+
platform linux -- Python 3.9.2, pytest-8.3.4, pluggy-1.0.0
461461
rootdir: /home/fermin/src/etl-framework/python-lib/tc_etl_lib
462462
collected 7 items
463463
@@ -471,7 +471,7 @@ Para ejecutar todos los tests se puede utilizar `pytest` sin parámetros:
471471
```
472472
$ (venv)$ pytest
473473
================================================================ test session starts =================================================================
474-
platform linux -- Python 3.9.2, pytest-7.2.0, pluggy-1.0.0
474+
platform linux -- Python 3.9.2, pytest-8.3.4, pluggy-1.0.0
475475
rootdir: /home/fermin/src/etl-framework/python-lib/tc_etl_lib
476476
collected 7 items
477477
@@ -508,6 +508,10 @@ TOTAL 403 221 45%
508508

509509
## Changelog
510510

511+
- Add: support for Python 3.12 (keeping also compatibility with Python 3.8)
512+
- Fix: upgrade requests from 2.21.0 to 2.25.1 (for Python 3.8 case)
513+
- Fix: upgrade urllib3 from 1.24.1 to 1.26.16 (for Python 3.8 case)
514+
511515
0.13.0 (Jun 26th, 2024)
512516

513517
- Fix: anchor numpy version to 1.24.4 (latest compatible with python 3.8 and pandas < 2.2.2) ([#89](https://github.com/telefonicasc/etl-framework/issues/89))

python-lib/tc_etl_lib/setup.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
LONG_DESC_TYPE = "text/markdown"
3636

3737
#Paquetes necesarios para que funcione la librería. Se instalarán a la vez si no lo tuvieras ya instalado
38+
#Dos listas separadas (para Python >=3.12 y para Python <3.12)
3839
INSTALL_REQUIRES = [
39-
'requests==2.21.0',
40-
'urllib3==1.24.1',
40+
'requests==2.25.1',
41+
'urllib3==1.26.16',
4142
'psycopg2-binary>=2.9.5',
4243
'pandas==2.0.3',
4344
# Pandas < 2.2.2 requiere numpy < 2.0.0, ver https://pandas.pydata.org/docs/whatsnew/v2.2.2.html
@@ -47,6 +48,13 @@
4748
# La última release de numpy compatible con python 3.8 es 1.24.4
4849
'numpy==1.24.4'
4950
]
51+
INSTALL_REQUIRES_PYTHON_3_12 = [
52+
'requests==2.28.2',
53+
'urllib3==1.26.16',
54+
'psycopg2-binary>=2.9.5',
55+
'pandas==2.2.2',
56+
'numpy==2.2.0'
57+
]
5058

5159
setup(
5260
name=PACKAGE_NAME,
@@ -57,7 +65,10 @@
5765
author=AUTHOR,
5866
author_email=AUTHOR_EMAIL,
5967
url=URL,
60-
install_requires=INSTALL_REQUIRES,
68+
extras_require={
69+
':python_version<"3.12"': INSTALL_REQUIRES,
70+
':python_version>="3.12"': INSTALL_REQUIRES_PYTHON_3_12
71+
},
6172
license=LICENSE,
6273
packages=find_packages(),
6374
include_package_data=True

python-lib/tc_etl_lib/tc_etl_lib/cb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def __batch_creation(self, *, service: str = None, subservice: str = None, auth:
403403
read=self.post_retry_connect,
404404
backoff_factor=self.post_retry_backoff_factor,
405405
status_forcelist=(429, 500, 502, 503, 504),
406-
method_whitelist=('HEAD', 'GET', 'OPTIONS', 'POST')
406+
allowed_methods=('HEAD', 'GET', 'OPTIONS', 'POST')
407407
)
408408

409409
adapter = HTTPAdapter(max_retries=retry_strategy)

python-lib/tc_etl_lib/tc_etl_lib/iota.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def send_http(self,
102102
read=self.post_retry_connect,
103103
backoff_factor=self.post_retry_backoff_factor,
104104
status_forcelist=(429, 500, 502, 503, 504),
105-
method_whitelist=('HEAD', 'GET', 'OPTIONS', 'POST')
105+
allowed_methods=('HEAD', 'GET', 'OPTIONS', 'POST')
106106
)
107107

108108
adapter = HTTPAdapter(max_retries=retry_strategy)

0 commit comments

Comments
 (0)