Skip to content

Commit

Permalink
Maintenance: Update to Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl authored and tomach committed Dec 16, 2024
1 parent bb8ddc2 commit 6212b21
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip pre-commit
Expand All @@ -46,7 +46,7 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install ".[docs]"
Expand All @@ -65,7 +65,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade -e ".[testing]"
Expand Down
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.770"
rev: "v0.981"
hooks:
- id: mypy
additional_dependencies:
- types-docutils
- types-PyYAML
- repo: https://github.com/adrienverge/yamllint
rev: "v1.25.0"
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build:
os: "ubuntu-22.04"
tools:
python: "3.9"
python: "3.10"

python:
install:
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Unreleased

* Change sql_exporter ``min_interval`` to 60s to avoid scraping every 15s.

* Updated Python version to ``3.10``.

2.42.0 (2024-10-02)
-------------------

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build container
FROM python:3.8-slim AS build
FROM python:3.10-slim AS build

RUN mkdir -pv /src

Expand All @@ -14,7 +14,7 @@ RUN python -m pip install -U setuptools==70.3.0 && \


# Run container
FROM python:3.8-slim
FROM python:3.10-slim

LABEL license="Apache License 2.0" \
maintainer="Crate.IO GmbH <office@crate.io>" \
Expand Down
2 changes: 1 addition & 1 deletion crate/operator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def env(self, name: str, *, default=UNDEFINED) -> str:
if default is UNDEFINED:
# raise from None - so that the traceback of the original
# exception (KeyError) is not printed
# https://docs.python.org/3.8/reference/simple_stmts.html#the-raise-statement
# https://docs.python.org/3.10/reference/simple_stmts.html#the-raise-statement
raise ConfigurationError(
f"Required environment variable '{full_name}' is not set."
) from None
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
"bitmath": ("https://bitmath.readthedocs.io/en/stable/", None),
"cratedb": ("https://crate.io/docs/crate/reference/en/stable/", None),
"kopf": ("https://kopf.readthedocs.io/en/stable/", None),
"python": ("https://docs.python.org/3.8/", None),
"python": ("https://docs.python.org/3.10/", None),
}
always_document_param_types = True
2 changes: 1 addition & 1 deletion docs/source/crate_operator_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run_apidoc(_):

def missing_reference(
app: Sphinx, env: BuildEnvironment, node: pending_xref, contnode: Element
) -> Element:
) -> None:
"""
Remove or resolve references to third party packages.
Expand Down
6 changes: 3 additions & 3 deletions docs/source/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Working on the operator
Local installation
------------------

The ``crate-operator`` package requires **Python 3.8**.
The ``crate-operator`` package requires **Python 3.10**.

It is recommended to use a virtual environment to the operator and its
dependencies for local development.
Expand All @@ -17,7 +17,7 @@ dependencies for local development.

.. code-block:: console
$ python3.8 -m venv env
$ python3.10 -m venv env
$ source env/bin/activate
(env)$ python -m pip install -e .
Expand Down Expand Up @@ -57,7 +57,7 @@ test dependencies. This is typically done inside a Python virtual environment:

.. code-block:: console
$ python3.8 -m venv env
$ python3.10 -m venv env
$ source env/bin/activate
(env)$ python -m pip install -e '.[testing]'
Successfully installed ... crate-operator ...
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ universal = 1
[mypy]
ignore_missing_imports = true
namespace_packages = true
mypy_path = .
explicit_package_bases = True

[flake8]
max-line-length = 88
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def read(path: str) -> str:
"prometheus_client==0.21.0",
"aiohttp==3.10.10",
"wrapt==1.17.0",
"python-json-logger==2.0.7",
],
extras_require={
"docs": [
Expand All @@ -76,15 +77,15 @@ def read(path: str) -> str:
"black==22.3.0",
"flake8==3.8.4",
"isort==5.12.0",
"mypy==0.770",
"mypy==0.981",
],
},
python_requires=">=3.8",
python_requires=">=3.10",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.10",
],
use_scm_version=True,
)
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ async def cluster_routing_allocation_enable_equals(


async def was_notification_sent(
mock_send_notification: mock.AsyncMock, call: mock.call
mock_send_notification: mock.AsyncMock, call: mock._Call
):
if mock_send_notification.call_count == 0:
return False
Expand All @@ -469,7 +469,7 @@ async def is_cronjob_schedule_matching(


async def mocked_coro_func_called_with(
mocked_coro_func: mock.AsyncMock, call: mock.call
mocked_coro_func: mock.AsyncMock, call: mock._Call
) -> bool:
if mocked_coro_func.call_count == 0:
return False
Expand Down

0 comments on commit 6212b21

Please sign in to comment.