Skip to content

Commit

Permalink
Merge pull request #1070 from mandiant/python310
Browse files Browse the repository at this point in the history
Update to Python 3.10 as minimum
  • Loading branch information
mr-tz authored Nov 12, 2024
2 parents 4c43b00 + 5225981 commit c749f2a
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 35 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: false
# using Python 3.8 to support running across multiple operating systems including Windows 7
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: '3.8'
python-version: '3.10'
- name: Install floss [build]
run: |
pip install -r requirements.txt
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- name: Checkout FLOSS
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: '3.8'
python-version: '3.10'
- name: Install dependencies
run: |
pip install -r requirements.txt
Expand All @@ -41,13 +41,11 @@ jobs:
os: [ubuntu-20.04, windows-2019, macos-13]
# across all operating systems
# version numbers are strings, not floats
python-version: ['3.8', '3.11']
python-version: ['3.10', '3.11']
include:
# on Ubuntu run these as well
- os: ubuntu-20.04
python-version: '3.9'
- os: ubuntu-20.04
python-version: '3.10'
python-version: '3.12'
steps:
- name: Checkout FLOSS with submodule
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ lib/

# Pyenv file
.python-version
.venv

# Test executables
bin/
Expand Down
1 change: 0 additions & 1 deletion floss/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def make_parser(argv):
epilog=epilog_advanced if show_all_options else epilog,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.register("action", "extend", floss.utils.ExtendAction)
parser.add_argument("-H", action="help", help="show advanced options and exit")
parser.add_argument(
"-n",
Expand Down
2 changes: 1 addition & 1 deletion floss/render/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def get_color(color):


def render(results: floss.results.ResultDocument, verbose, disable_headers, color):
sys.__stdout__.reconfigure(encoding="utf-8")
sys.__stdout__.reconfigure(encoding="utf-8") # type: ignore [union-attr]
console = Console(file=io.StringIO(), color_system=get_color(color), highlight=False, soft_wrap=True)

if not disable_headers:
Expand Down
2 changes: 1 addition & 1 deletion floss/render/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FlossJSONEncoder(json.JSONEncoder):

def default(self, o):
if dataclasses.is_dataclass(o):
return dataclasses.asdict(o)
return dataclasses.asdict(o) # type: ignore [arg-type]
if isinstance(o, datetime.datetime):
return o.isoformat("T") + "Z"
return super().default(o)
Expand Down
10 changes: 0 additions & 10 deletions floss/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@
logger = floss.logging_.getLogger(__name__)


class ExtendAction(argparse.Action):
# stores a list, and extends each argument value to the list
# Since Python 3.8 argparse supports this
# TODO: remove this code when only supporting Python 3.8+
def __call__(self, parser, namespace, values, option_string=None):
items = getattr(namespace, self.dest, None) or []
items.extend(values)
setattr(namespace, self.dest, items)


class InstallContextMenu(argparse.Action):
def __init__(self, option_strings, dest, nargs=None, **kwargs):
super(InstallContextMenu, self).__init__(option_strings, dest, nargs=0, **kwargs)
Expand Down
12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ authors = [
{name = "Willi Ballenthin", email = "william.ballenthin@mandiant.com"},
{name = "Moritz Raabe", email = "moritz.raabe@mandiant.com"},
]
requires-python=">=3.8"
requires-python=">=3.10"
keywords = ["floss", "malware", "analysis", "obfuscation", "strings", "FLARE"]
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand Down Expand Up @@ -89,9 +89,7 @@ dependencies = [
# typically due to dropping support for python releases
# we still support.

# TODO(williballenthin): networkx 3.2 doesn't support python 3.8 while capa does.
# https://github.com/mandiant/capa/issues/1966
"networkx>=3,<3.2",
"networkx>=3",
]
dynamic = ["version", "readme"]

Expand All @@ -108,16 +106,16 @@ packages = ["floss", "floss.sigs"]
# These dependencies are not used in production environments
# and should not conflict with other libraries/tooling.
dev = [
"pre-commit==3.5.0",
"pre-commit==4.0.1",
"pyyaml==6.0.1",
"pytest==8.3.3",
"pytest-sugar==1.0.0",
"pytest-instafail==0.5.0",
"pytest-cov==5.0.0",
"pycodestyle==2.12.1",
"black==24.8.0",
"black==24.10.0",
"isort==5.13.2",
"mypy==1.10.0",
"mypy==1.13.0",
# type stubs for mypy
"types-PyYAML==6.0.10",
"types-tabulate==0.9.0.20240106",
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
annotated-types==0.7.0
binary2strings==0.1.13
black==24.8.0
black==24.10.0
cfgv==3.4.0
click==8.1.7
colorama==0.4.6
Expand All @@ -19,16 +19,16 @@ log-symbols==0.0.14
markdown-it-py==3.0.0
mdurl==0.1.2
msgpack==1.0.8
mypy==1.10.0
networkx==3.1
mypy==1.13.0
networkx==3.4.2
nodeenv==1.9.1
packaging==24.1
pathspec==0.12.1
pefile==2024.8.26
pip==24.2
platformdirs==4.3.6
pluggy==1.5.0
pre-commit==3.5.0
pre-commit==4.0.1
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycodestyle==2.12.1
Expand All @@ -51,7 +51,7 @@ six==1.16.0
sortedcontainers==2.4.0
spinners==0.0.24
tabulate==0.9.0
termcolor==2.4.0
termcolor==2.5.0
tqdm==4.66.4
types-pyyaml==6.0.10
types-tabulate==0.9.0.20240106
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def runtest(self):
def reportinfo(self):
return self.path, 0, "usecase: %s" % self.name

def repr_failure(self, excinfo):
def repr_failure(self, excinfo): # type: ignore [override]
if isinstance(excinfo.value, FLOSSStringsNotExtracted):
expected = excinfo.value.expected
got = excinfo.value.got
Expand Down

0 comments on commit c749f2a

Please sign in to comment.