Skip to content
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

Drop support of Python 3.8 #736

Merged
merged 4 commits into from
Nov 13, 2024
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
14 changes: 14 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ exclude =
build
dist
venv
per-file-ignores =
./iib/workers/tasks/build_regenerate_bundle.py: E713
./iib/workers/tasks/utils.py: E203,E702
./iib/workers/tasks/build_add_deprecations.py: E713
./iib/web/api_v1.py: E226
./iib/web/migrations/versions/*: D103
./tests/*: D103
./tests/test_web/test_models.py: D103
./tests/test_web/test_s3_utils.py: D103
./tests/test_web/test_api_v1.py: D103
./tests/test_workers/test_tasks/test_build.py: D103,E231
./tests/test_workers/test_tasks/test_build_regenerate_bundle.py: D103,E241,E222
./tests/test_web/test_migrations.py: E231,D103
extend-ignore = E231
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"constraints": {
"python": "==3.9"
"python": "==3.12"
},
"enabled": true,
"enabledManagers": ["docker-compose", "dockerfile", "github-actions", "pip_requirements", "pyenv"],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
python-version: ["3.8", "3.9"]
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The testing environment is managed by [tox](https://tox.readthedocs.io/en/latest
If you'd like to run a specific unit test, you can do the following:

```bash
tox -e py38 tests/test_web/test_api_v1.py::test_add_bundle_invalid_param
tox -e py312 tests/test_web/test_api_v1.py::test_add_bundle_invalid_param
```

## Development Environment
Expand Down
10 changes: 5 additions & 5 deletions docker/Dockerfile-api
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ RUN dnf -y install \
libpq-devel \
mod_auth_gssapi \
mod_ssl \
python38-mod_wsgi \
python3.12-mod_wsgi \
openssl-devel \
python38-devel \
python38-pip \
python38-wheel \
python3.12-devel \
python3.12-pip \
python3.12-wheel \
&& dnf update -y \
&& dnf clean all
RUN update-alternatives --set python3 $(which python3.8)
RUN update-alternatives --set python3 $(which python3.12)
COPY . .
COPY ./docker/iib-httpd.conf /etc/httpd/conf/httpd.conf

Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile-workers
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ RUN dnf -y install \
libpq-devel \
openssl-devel \
podman \
python38-devel \
python38-pip \
python38-wheel \
python3.12-devel \
python3.12-pip \
python3.12-wheel \
runc \
skopeo \
&& dnf update -y \
Expand All @@ -36,7 +36,7 @@ RUN cd /usr/bin && tar -xf /src/grpcurl_1.8.5_linux_x86_64.tar.gz grpcurl && rm
ADD https://github.com/operator-framework/operator-sdk/releases/download/v1.15.0/operator-sdk_linux_amd64 /usr/bin/operator-sdk
RUN chmod +x /usr/bin/operator-sdk

RUN update-alternatives --set python3 $(which python3.8)
RUN update-alternatives --set python3 $(which python3.12)

# Adjust storage.conf to enable Fuse storage.
RUN sed -i -e 's|^#mount_program|mount_program|g' /etc/containers/storage.conf
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ python-qpid-proton
recommonmark
requests
ruamel.yaml
setuptools
sphinx==6.2.1
sphinx_rtd_theme
tenacity
Expand Down
1,426 changes: 701 additions & 725 deletions requirements-test.txt

Large diffs are not rendered by default.

1,279 changes: 637 additions & 642 deletions requirements.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
],
classifiers=[
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
],
entry_points={'console_scripts': ['iib=iib.web.manage:cli']},
license="GPLv3+",
Expand Down
12 changes: 4 additions & 8 deletions tests/test_workers/test_tasks/test_build_merge_index_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
@mock.patch('iib.workers.tasks.build_merge_index_image.create_dockerfile')
@mock.patch('iib.workers.tasks.build._get_index_database')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_migrate')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_registry_add_fbc')
@mock.patch('iib.workers.tasks.build_merge_index_image._push_image')
@mock.patch('iib.workers.tasks.build_merge_index_image._build_image')
@mock.patch('iib.workers.tasks.build_merge_index_image.deprecate_bundles_fbc')
Expand Down Expand Up @@ -66,7 +65,6 @@ def test_handle_merge_request(
mock_dep_b_fbc,
mock_bi,
mock_pi,
mock_oraf,
mock_om,
mock_gid,
mock_ogd,
Expand Down Expand Up @@ -135,8 +133,8 @@ def side_effect(*args, base_dir, **kwargs):
binary_image_config=binary_image_config,
)

mock_om.called_once()
mock_oraf.called_once()
if target_fbc:
mock_om.assert_called_once()

assert mock_cleanup.call_count == 2
mock_prfb.assert_called_once_with(
Expand Down Expand Up @@ -193,7 +191,6 @@ def side_effect(*args, base_dir, **kwargs):
@mock.patch('iib.workers.tasks.build_merge_index_image.create_dockerfile')
@mock.patch('iib.workers.tasks.build._get_index_database')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_migrate')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_registry_add_fbc')
@mock.patch('iib.workers.tasks.build_merge_index_image._create_and_push_manifest_list')
@mock.patch('iib.workers.tasks.build_merge_index_image._push_image')
@mock.patch('iib.workers.tasks.build_merge_index_image._build_image')
Expand Down Expand Up @@ -232,7 +229,6 @@ def test_handle_merge_request_no_deprecate(
mock_bi,
mock_pi,
mock_capml,
mock_oraf,
mock_om,
mock_gid,
mock_ogd,
Expand Down Expand Up @@ -282,8 +278,8 @@ def test_handle_merge_request_no_deprecate(
distribution_scope='stage',
)

mock_om.called_once()
mock_oraf.called_once()
if target_fbc:
mock_om.assert_called_once()

assert mock_cleanup.call_count == 2
mock_prfb.assert_called_once_with(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_workers/test_tasks/test_fbc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_merge_catalogs_dirs(mock_enforce_json, mock_rc, mock_opm, tmpdir):

merge_catalogs_dirs(src_config=source_dir, dest_config=destination_dir)
mock_enforce_json.assert_called_once_with(destination_dir)
mock_rc.called_once_with(
mock_rc.assert_called_once_with(
[mock_opm.opm_version, 'validate', destination_dir],
exc_msg=f'Failed to validate the content from config_dir {destination_dir}',
)
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_merge_catalogs_dirs_raise(mock_isdir, mock_cpt, tmpdir):
with pytest.raises(IIBError, match=f"config directory does not exist: {source_dir}"):
merge_catalogs_dirs(src_config=source_dir, dest_config=destination_dir)

mock_cpt.not_called()
mock_cpt.assert_not_called()


def test_enforce_json_config_dir(tmpdir):
Expand Down
28 changes: 14 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
min_version = 4.0
skip_missing_interpreters = true
envlist = black,docs,flake8,py38,py39,safety,yamllint,bandit, mypy
envlist = black,docs,flake8,py312,py312,safety,yamllint,bandit, mypy
downloadcache = {toxworkdir}/_download/
labels =
test = unit_tests
Expand All @@ -11,18 +11,17 @@ labels =

[gh-actions]
python =
3.8: py38, black, flake8, mypy, yamllint, bandit, safety, docs, unit_tests
3.9: py39, black, flake8, mypy, yamllint, bandit, safety, docs, unit_tests
3.12: py312, black, flake8, mypy, yamllint, bandit, safety, docs, unit_tests
3.13: py312, black, flake8, mypy, yamllint, bandit, safety, docs, unit_tests

[testenv]
usedevelop = true
# 3.8 is the current suppported version
# 3.9 is the latest version available on RHEL8
# 3.12 is the current supported version on RHEL 8.10
basepython =
py38: python3.8
py39: python3.9
migrate-db: python3.8
pip-compile: python3.8
py312: python3.12
lipoja marked this conversation as resolved.
Show resolved Hide resolved
py313: python3.13
migrate-db: python3.12
pip-compile: python3.12
setenv =
IIB_TESTING=true
pytest_command =
Expand Down Expand Up @@ -63,18 +62,19 @@ deps =
commands =
yamllint .

[testenv:py38]
description = Python 3.8 unit tests [Mandatory]
[testenv:py312]
lipoja marked this conversation as resolved.
Show resolved Hide resolved
description = Python 3.12 unit tests [Mandatory]
commands =
{[testenv]pytest_command}
deps =
-rrequirements-test.txt

[testenv:py39]
description = Python 3.9 unit tests [Mandatory]

[testenv:py313]
description = Python 3.13 unit tests
commands =
{[testenv]pytest_command}
deps =
deps =
-rrequirements-test.txt

[testenv:unit_tests]
Expand Down