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

remove python 3.8 support #4531

Merged
merged 9 commits into from
Sep 17, 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
4 changes: 4 additions & 0 deletions .changelog/4531.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Dropped support for Python 3.8.
type: breaking
pr_number: 4531
9 changes: 4 additions & 5 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false
defaults:
run:
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false
defaults:
run:
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false
defaults:
run:
Expand Down Expand Up @@ -330,7 +330,6 @@ jobs:
source $(poetry env info --path)/bin/activate
validate-content-path validate-all content --skip-depth-one-file --skip-depth-one-folder --skip-depth-zero-file --skip-integration-script-file-name --skip-integration-script-file-type --skip-markdown --skip-suffix


test-graph-commands:
runs-on: ubuntu-latest
name: Test Graph Commands
Expand Down Expand Up @@ -473,7 +472,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache: "pip"

- name: pip intsall current project
run: pip install .
Expand Down
2 changes: 1 addition & 1 deletion .sourcery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ rule_settings:
- refactoring
- suggestion
- comment
python_version: '3.8'
python_version: '3.9'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Demisto SDK library can be used to manage your Cortex XSOAR content with eas

Requirements:

- Python 3.8, 3.9 or 3.10.
- Python 3.9, 3.10 or 3.11.
- git installed.
- A linux, mac or WSL2 machine.

Expand Down
10 changes: 1 addition & 9 deletions demisto_sdk/commands/content_graph/objects/content_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,7 @@ def normalize_name(self) -> str:
for _ in range(2):
# we iterate twice to handle cases of doubled prefixes like `classifier-mapper-`
for prefix in server_names:
try:
name = name.removeprefix(f"{prefix}-") # type: ignore[attr-defined]
except AttributeError:
# not supported in python 3.8
name = (
name[len(prefix) + 1 :]
if name.startswith(f"{prefix}-")
else name
)
name = name.removeprefix(f"{prefix}-")
normalized = f"{self.content_type.server_name}-{name}"
logger.debug(f"Normalized file name from {name} to {normalized}")
return normalized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ def repository(mocker, repo) -> ContentDTO:
repo_pack = repo.create_pack()
in_script_yml = os.path.join(FILES_PATH, "docs_test", "script-Set.yml")
script = repo_pack.create_script(name=INPUT_SCRIPT)
with open(in_script_yml) as original_yml, open(
f"{script.path}/{INPUT_SCRIPT}.yml", "w"
) as new_script_yml:
for line in original_yml:
new_script_yml.write(line)

Path(script.path, f"{INPUT_SCRIPT}.yml").write_text(Path(in_script_yml).read_text())
pack = mock_pack()
pack.relationships = relationships
pack.content_items.script.append(
Expand Down
13 changes: 1 addition & 12 deletions demisto_sdk/commands/lint/lint_manager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# STD packages
import concurrent.futures
import os
import platform
import re
import sys
import textwrap
Expand All @@ -12,7 +11,6 @@
import git
import requests.exceptions
import urllib3.exceptions
from packaging.version import Version
from wcmatch.pathlib import Path, PosixPath

import demisto_sdk
Expand Down Expand Up @@ -566,16 +564,7 @@ def execute_all_packages(
except Exception as e:
msg = f"Stop demisto-sdk lint - {e}"
logger.debug(f"[yellow]{msg}[/yellow]", exc_info=True)

if Version(platform.python_version()) > Version("3.9"):
executor.shutdown(wait=True, cancel_futures=True) # type: ignore[call-arg]
else:
logger.info("Using Python under 3.8, we will cancel futures manually.")
executor.shutdown(
wait=True
) # Note that `cancel_futures` not supported in python 3.8
for res in results:
res.cancel()
executor.shutdown(wait=True, cancel_futures=True)
return 1, 0

def run(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys
from pathlib import Path
from unittest.mock import MagicMock, mock_open

Expand Down Expand Up @@ -80,9 +79,6 @@ def test_loader_defaults(self, mocker):
master_mock = mocker.MagicMock()
time_stamp_replacer = TimestampReplacer()
time_stamp_replacer.load(master_mock)
python_version = sys.version_info
if python_version.major == 3 and python_version.minor == 7:
pytest.skip("The current mock syntax is supported only in python 3.8+")
assert master_mock.add_option.call_count == 4
for call in master_mock.add_option.mock_calls:
assert (
Expand Down
7 changes: 4 additions & 3 deletions demisto_sdk/commands/zip_packs/packs_zipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ def dump_packs(self):
"""
reports = []
# we quiet the outputs and in case we want the output - a summery will be printed
with QuietModeController(
quiet_logger=True, quiet_output=True
), PacksDirsHandler(self):
with (
QuietModeController(quiet_logger=True, quiet_output=True),
PacksDirsHandler(self),
):
for pack_name in self.pack_names:
if pack_name not in IGNORED_PACKS:
reports.append(dump_pack(self, self.packs[pack_name]))
Expand Down
Loading