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

Explicitly use Python 3.11 everywhere #218

Merged
merged 2 commits into from
Dec 11, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/cd_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.11'

- name: Install Python dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
with:
ref: main

- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.11'

- name: Install `pre-commit`
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
token: ${{ secrets.CI_RESET_TEST_BRANCHES }}
fetch-depth: 0

- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.11'

- name: Reset branches
run: |
Expand Down Expand Up @@ -289,10 +289,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.11'

- name: Install dependencies
run: |
Expand All @@ -319,10 +319,10 @@ jobs:
with:
fetch-depth: 2

- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.11'

- name: Install dependencies
run: |
Expand Down
20 changes: 13 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
default_language_version:
python: python3.8
python: python3.11

repos:
- repo: https://github.com/ambv/black
rev: 23.11.0
hooks:
- id: black
name: Blacken

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand All @@ -22,6 +16,18 @@ repos:
name: Fix requirements*.txt
files: ^requirements.*\.txt$

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py311-plus]

- repo: https://github.com/ambv/black
rev: 23.11.0
hooks:
- id: black
name: Blacken

- repo: https://github.com/PyCQA/bandit
rev: '1.7.5'
hooks:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:alpine
FROM python:3.11-alpine

COPY README.md setup.py requirements*.txt ./
COPY push_action ./push_action
Expand Down
3 changes: 2 additions & 1 deletion push_action/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING: # pragma: no cover
from typing import Any, Iterator
from typing import Any
from collections.abc import Iterator


class InMemoryCache:
Expand Down
2 changes: 1 addition & 1 deletion push_action/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def unprotect_reviews() -> None:
def protect_reviews() -> None:
"""Re-add pull request review protection for target branch"""
# Retrieve data
with open("tmp_protection_rules.json", "r", encoding="utf8") as handle:
with open("tmp_protection_rules.json", encoding="utf8") as handle:
data = json.load(handle)

# Add protection
Expand Down
3 changes: 2 additions & 1 deletion push_action/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from push_action.validate import validate_rest_api_base_url

if TYPE_CHECKING: # pragma: no cover
from typing import Callable, List, Union
from typing import List, Union
from collections.abc import Callable


LOGGER = logging.getLogger("push_action.utils")
Expand Down
2 changes: 1 addition & 1 deletion push_action/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def validate_conclusions(conclusions: list[str]) -> list[str]:
)

# Remove redundant entries and conform to lowercase
conclusions = list(set(conclusion.lower() for conclusion in conclusions))
conclusions = list({conclusion.lower() for conclusion in conclusions})

for conclusion in conclusions:
invalid_conclusions: list[str] = []
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.mypy]
python_version = "3.8"
python_version = "3.11"
ignore_missing_imports = true
scripts_are_modules = true
warn_unused_configs = true
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

TOP_DIR = Path(__file__).parent.resolve()

with open(TOP_DIR / "push_action" / "__init__.py", "r", encoding="utf8") as handle:
with open(TOP_DIR / "push_action" / "__init__.py", encoding="utf8") as handle:
for line in handle.readlines():
version = re.findall(r'__version__ = "(.*)"', line)
if version:
Expand All @@ -39,12 +39,10 @@
packages=find_packages(),
classifiers=[
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.11",
"Intended Audience :: Developers",
],
python_requires=">=3.8",
python_requires=">=3.11,<3.12",
install_requires=(TOP_DIR / "requirements.txt").read_text(),
extras_require={"dev": (TOP_DIR / "requirements_dev.txt").read_text()},
entry_points={"console_scripts": ["push-action=push_action.run:main"]},
Expand Down
Loading