Skip to content

Commit

Permalink
Set Python 3.10 as minimum version (#4099)
Browse files Browse the repository at this point in the history
Co-authored-by: Ajinkya Udgirkar <[email protected]>
  • Loading branch information
cristianonicolai and audgirka authored Dec 13, 2023
1 parent 96603d9 commit e586adc
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
TOXENV: pkg

steps:
- name: Switch to using Python 3.9 by default
- name: Switch to using Python 3.10 by default
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.10

- name: Install tox
run: python3 -m pip install --user "tox>=4.0.0"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ jobs:
id: generate_matrix
uses: coactions/dynamic-matrix@v1
with:
min_python: "3.9"
min_python: "3.10"
max_python: "3.12"
default_python: "3.10" # used by jobs in other_names
other_names: |
lint
docs
Expand Down Expand Up @@ -81,12 +82,12 @@ jobs:
&& virtualenv foo \
&& source foo/bin/activate \
&& ansible --version
- name: Set up Python ${{ matrix.python_version || '3.9' }}
- name: Set up Python ${{ matrix.python_version || '3.10' }}
if: "!contains(matrix.shell, 'wsl')"
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python_version || '3.9' }}
python-version: ${{ matrix.python_version || '3.10' }}

- name: Install tox
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:
skip:
- ansible-lint
default_language_version:
python: python3.9
python: python3.10
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
# keep it before yamllint
Expand Down
4 changes: 2 additions & 2 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -187,7 +187,7 @@ steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.9"
versionSpec: "3.10"
- script: python -m pip install "molecule[lint]" "python-vagrant" "molecule-vagrant" "ansible"
displayName: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Molecule.
Depending on the driver chosen, you may need to install additional OS
packages.

- Python >= 3.9 with ansible-core >= 2.12
- Python >= 3.10 with ansible-core >= 2.12

=== "CentOS"

Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"

[project]
# https://peps.python.org/pep-0621/#readme
requires-python = ">=3.9"
requires-python = ">=3.10"
dynamic = ["version", "dependencies", "optional-dependencies"]
name = "molecule"
description = "Molecule aids in the development and testing of Ansible roles"
Expand All @@ -26,7 +26,6 @@ classifiers = [
"Operating System :: MacOS",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down Expand Up @@ -77,7 +76,7 @@ profile = "black"
known_first_party = "molecule"

[tool.mypy]
python_version = 3.9
python_version = 3.10
# strict = true
color_output = true
error_summary = true
Expand Down Expand Up @@ -206,7 +205,7 @@ ignore = [
"TRY",
]
select = ["ALL"]
target-version = "py39"
target-version = "py310"
# Same as Black.
line-length = 88

Expand Down
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# See https://github.com/dependabot/dependabot-core/issues/4062
python-3.9.11
python-3.10.13
3 changes: 2 additions & 1 deletion src/molecule/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import os
import shutil
import subprocess
from typing import Any, Callable
from collections.abc import Callable
from typing import Any

import click
import wcmatch.pathlib
Expand Down
3 changes: 1 addition & 2 deletions src/molecule/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
import logging
import os
import time
from collections.abc import Iterable
from collections.abc import Callable, Iterable
from functools import wraps
from typing import Callable

from ansible_compat.ports import cache
from enrich.logging import RichHandler
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def boolean(value: Any, strict=True) -> bool:
return value

normalized_value = value
if isinstance(value, (str, bytes)):
if isinstance(value, str | bytes):
normalized_value = str(value).lower().strip()

if normalized_value in BOOLEANS_TRUE:
Expand Down
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def is_subset(subset, superset):
for key, val in subset.items()
)

if isinstance(subset, (list, set)):
if isinstance(subset, list | set):
return all(
any(is_subset(subitem, superitem) for superitem in superset)
for subitem in subset
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ allowlist_externals =
[testenv:lint]
description = Runs all linting tasks
# python pinned in order to have pip-compile output reproducible
basepython = python3.9
basepython = python3.10
commands =
# to run a single linter you can do "pre-commit run flake8"
python -m pre_commit run {posargs:--all --show-diff-on-failure}
Expand Down

0 comments on commit e586adc

Please sign in to comment.