diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 0e6bd52b..ba1a6de3 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -39,7 +39,7 @@ jobs: - name: Setup Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: - python-version: "3.14" + python-version: "3.12" - name: Upgrade pip run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a41158dc..2fcbdceb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: - python-version: "3.14" + python-version: "3.12" - name: Upgrade pip run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a937b22e..4a626356 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,17 +23,18 @@ jobs: fail-fast: false matrix: include: - - { python: "3.9", os: "ubuntu-latest", session: "tests" } - { python: "3.10", os: "ubuntu-latest", session: "tests" } - - { python: "3.11", os: "ubuntu-latest", session: "pre-commit" } - - { python: "3.11", os: "ubuntu-latest", session: "xdoctest" } - - { python: "3.11", os: "ubuntu-latest", session: "docs-build" } - { python: "3.11", os: "ubuntu-latest", session: "tests" } - - { python: "3.11", os: "windows-latest", session: "tests" } - - { python: "3.11", os: "ubuntu-latest", session: "pip-audit" } + - { python: "3.12", os: "ubuntu-latest", session: "pre-commit" } + - { python: "3.12", os: "ubuntu-latest", session: "xdoctest" } + - { python: "3.12", os: "ubuntu-latest", session: "docs-build" } + - { python: "3.12", os: "ubuntu-latest", session: "tests" } + - { python: "3.12", os: "windows-latest", session: "tests" } + - { python: "3.12", os: "ubuntu-latest", session: "pip-audit" } + - { python: "3.13", os: "ubuntu-latest", session: "tests" } # - { python: "3.10", os: "ubuntu-latest", session: "mypy" } - # - { python: "3.9", os: "ubuntu-latest", session: "mypy" } + # - { python: "3.12", os: "ubuntu-latest", session: "mypy" } # - { python: "3.10", os: "ubuntu-latest", session: "typeguard" } env: @@ -141,7 +142,7 @@ jobs: - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: - python-version: "3.14" + python-version: "3.12" - name: Upgrade pip run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1f39fcc..23680c8e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: - id: pyupgrade description: Automatically upgrade syntax for newer versions. types: [python] - args: [--py37-plus] + args: [--py310-plus] # Prettier is failing in CI for Markdown files, so we disable it for now. It does not do much for us anyway. # - repo: https://github.com/pre-commit/mirrors-prettier diff --git a/.readthedocs.yml b/.readthedocs.yml index 66f2a214..1121f1eb 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -2,7 +2,7 @@ version: 2 build: os: ubuntu-20.04 tools: - python: "3.10" + python: "3.12" sphinx: configuration: docs/conf.py formats: all diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f6f1a0c..ed030b80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ Indicate you are working on a task by adding your GitHub @name after the task in Definition of Done items are often a great starting point for contributing in a meaningful way while getting integrated into team practices. Using SSH keys to check out the repository is ideal, as we require contributors to sign their commits. -You need Python 3.9+ and the following tools: +You need Python 3.10, 3.11, 3.12, or 3.13 and the following tools: - [uv] - [Nox] diff --git a/README.md b/README.md index 0be07a40..3b3e0d80 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ metric is reported in hours. ## Requirements -- Python 3.9+ +- Python 3.10, 3.11, 3.12, or 3.13 - uv (installation instructions provided [here](https://github.com/astral-sh/uv?tab=readme-ov-file#installation)) - Supported OS: Windows 10, Windows 11, Linux, MacOS diff --git a/docs/architectural_decision_records/007-python-for-app-fuctionality.md b/docs/architectural_decision_records/007-python-for-app-fuctionality.md index 9386e7b1..a37c3097 100644 --- a/docs/architectural_decision_records/007-python-for-app-fuctionality.md +++ b/docs/architectural_decision_records/007-python-for-app-fuctionality.md @@ -15,7 +15,7 @@ Our project includes data analysis. ## Decision We will use Python for the main application functionality, Python for tests, and Poetry for build and dependency automation. -We are supporting Python 3.9 and 3.10 in order to use modern type hinting. +We are supporting Python 3.10, 3.11, 3.12, and 3.13 in order to use modern type hinting. ## Rationale diff --git a/noxfile.py b/noxfile.py index c52b9a32..4e399fc1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -15,7 +15,7 @@ PYPROJECT = nox.project.load_toml("pyproject.toml") package = "devops_deployment_metrics" -python_versions = ["3.11", "3.9", "3.10"] +python_versions = ["3.12", "3.10", "3.11", "3.13"] nox.needs_version = ">= 2024.4.15" nox.options.sessions = ( "pre-commit", diff --git a/pyproject.toml b/pyproject.toml index 3c36128c..3d56c9b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,10 +3,17 @@ name = "devops-deployment-metrics" version = "0.0.1" description = "DevOps Deployment Metrics" authors = [{ name = "Flexion, Inc.", email = "noreply@flexion.us" }] -requires-python = "~=3.9" +requires-python = ">=3.10" readme = "README.md" license = "MIT" -classifiers = ["Development Status :: 1 - Planning"] +classifiers = [ + "Development Status :: 1 - Planning", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] dependencies = [ "click>=8.0.1", "pandas>=2.0.0,<3", @@ -110,8 +117,8 @@ exclude = [ line-length = 88 indent-width = 4 -# Assume Python 3.8 -target-version = "py38" +# Assume Python 3.12 +target-version = "py312" [tool.ruff.lint] # Enable Pyflakes (`F`) diff --git a/src/devops_deployment_metrics/config.py b/src/devops_deployment_metrics/config.py index 4c2f7dbf..ec0f1b8f 100644 --- a/src/devops_deployment_metrics/config.py +++ b/src/devops_deployment_metrics/config.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from datetime import datetime from pathlib import Path +from zoneinfo import ZoneInfo import toml -from zoneinfo import ZoneInfo from devops_deployment_metrics.workflow import Workflow diff --git a/src/devops_deployment_metrics/metrics.py b/src/devops_deployment_metrics/metrics.py index faeb667a..67fa1bcc 100644 --- a/src/devops_deployment_metrics/metrics.py +++ b/src/devops_deployment_metrics/metrics.py @@ -1,8 +1,9 @@ """This module contains classes for calculating deployment metrics.""" +from collections.abc import Iterable from dataclasses import asdict from datetime import datetime, timedelta, timezone -from typing import Any, Iterable, Optional +from typing import Any import pandas as pd @@ -45,7 +46,7 @@ def get_deployments_in_period( deployments: list[WorkflowRun], days_slice: int, start_date: datetime, - end_period: Optional[datetime] = None, + end_period: datetime | None = None, ) -> Iterable[tuple[datetime, list[WorkflowRun]]]: """Get the deployments for each period.""" # Using this workaround to get the current datetime with the local timezone