Skip to content

Commit 01df4c2

Browse files
authored
Update pyproject.toml license settings and minimum python version (#33)
1 parent aed839b commit 01df4c2

8 files changed

Lines changed: 40 additions & 31 deletions

File tree

dissect/executable/elf/elf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import io
44
from functools import cached_property, lru_cache
55
from operator import itemgetter
6-
from typing import TYPE_CHECKING, BinaryIO, Callable, Generic, TypeVar
6+
from typing import TYPE_CHECKING, BinaryIO, Generic, TypeVar
77

88
from dissect.executable.elf.c_elf import (
99
SHN,
@@ -19,7 +19,7 @@
1919
from dissect.executable.exception import InvalidSignatureError
2020

2121
if TYPE_CHECKING:
22-
from collections.abc import Iterator
22+
from collections.abc import Callable, Iterator
2323

2424
from dissect.cstruct import cstruct
2525

dissect/executable/pe/c_pe.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Generated by cstruct-stubgen
2-
from typing import BinaryIO, Literal, overload
2+
from typing import BinaryIO, Literal, TypeAlias, overload
33

44
import dissect.cstruct as __cs__
5-
from typing_extensions import TypeAlias
65

76
class _c_pe(__cs__.cstruct):
87
IMAGE_DOS_SIGNATURE: Literal[23117] = ...

dissect/executable/pe/directory/delay_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def functions(self) -> list[DelayImportFunction]:
126126
return [
127127
DelayImportFunction(self, name_thunk, address_thunk, bound_thunk, unload_thunk)
128128
for name_thunk, address_thunk, bound_thunk, unload_thunk in zip(
129-
name_table, address_table, bound_table, unload_table
129+
name_table, address_table, bound_table, unload_table, strict=False
130130
)
131131
]
132132

dissect/executable/pe/directory/export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def functions(self) -> list[ExportFunction]:
7979
self.pe.vfh.seek(self.header.AddressOfNameOrdinals)
8080
ordinals = c_pe.USHORT[self.header.NumberOfNames](self.pe.vfh)
8181

82-
for name_ptr, ordinal in zip(names, ordinals):
82+
for name_ptr, ordinal in zip(names, ordinals, strict=False):
8383
self.pe.vfh.seek(name_ptr)
8484
name = c_pe.CHAR[None](self.pe.vfh).decode()
8585

dissect/executable/pe/directory/imports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def functions(self) -> list[ImportFunction]:
108108

109109
return [
110110
ImportFunction(self, lookup_thunk, address_thunk)
111-
for lookup_thunk, address_thunk in zip(lookup_table, address_table)
111+
for lookup_thunk, address_thunk in zip(lookup_table, address_table, strict=False)
112112
]
113113

114114
@cached_property

dissect/executable/pe/directory/resource.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22

33
from functools import cached_property
44
from io import BytesIO
5-
from typing import TYPE_CHECKING, Any, BinaryIO, Union
6-
7-
from dissect.util.ts import from_unix, wintimestamp
8-
9-
try:
10-
from typing import TypeAlias # novermin
11-
except ImportError:
12-
# COMPAT: Remove this when we drop Python 3.9
13-
TypeAlias = Any
14-
5+
from typing import TYPE_CHECKING, Any, BinaryIO, TypeAlias
156

167
from dissect.util.stream import RangeStream
8+
from dissect.util.ts import from_unix, wintimestamp
179

1810
from dissect.executable.pe.c_pe import c_pe
1911
from dissect.executable.pe.directory.base import DataDirectory
@@ -268,7 +260,7 @@ def vs_version_info(self, language: str | int | None = None) -> dict | None:
268260
if len(version) != 1:
269261
raise ValueError(f"Expected exactly one version resource, found {len(version)}")
270262

271-
_Node: TypeAlias = tuple[str, Union[str, bytes, None], list["_Node"]]
263+
_Node: TypeAlias = tuple[str, str | bytes | None, list["_Node"]]
272264

273265
def _parse_lvt(fh: BinaryIO) -> _Node | None:
274266
start = fh.tell()

pyproject.toml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[build-system]
2-
requires = ["setuptools>=65.5.0", "setuptools_scm[toml]>=6.4.0"]
2+
requires = ["setuptools>=77.0.0", "setuptools_scm[toml]>=6.4.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "dissect.executable"
77
description = "A Dissect module implementing a parsers for various executable formats such as PE, ELF and Macho-O"
88
readme = "README.md"
9-
requires-python = "~=3.9"
9+
requires-python = ">=3.10"
1010
license = "AGPL-3.0-or-later"
1111
license-files = ["LICENSE", "COPYRIGHT"]
1212
authors = [
@@ -41,9 +41,29 @@ dev = [
4141
"dissect.util>=3.0.dev,<4.0.dev",
4242
]
4343

44+
[dependency-groups]
45+
test = [
46+
"pytest",
47+
]
48+
lint = [
49+
"ruff==0.13.1",
50+
"vermin",
51+
]
52+
build = [
53+
"build",
54+
]
55+
debug = [
56+
"ipdb",
57+
]
58+
dev = [
59+
{include-group = "test"},
60+
{include-group = "lint"},
61+
{include-group = "debug"},
62+
]
63+
4464
[tool.ruff]
4565
line-length = 120
46-
required-version = ">=0.12.0"
66+
required-version = ">=0.13.1"
4767

4868
[tool.ruff.format]
4969
docstring-code-format = true

tox.ini

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ envlist = lint, py3, pypy3
44
# requires if they are not available on the host system. This requires the
55
# locally installed tox to have a minimum version 3.3.0. This means the names
66
# of the configuration options are still according to the tox 3.x syntax.
7-
minversion = 4.4.3
7+
minversion = 4.27.0
88
# This version of virtualenv will install setuptools version 68.2.2 and pip
99
# 23.3.1. These versions fully support python projects defined only through a
1010
# pyproject.toml file (PEP-517/PEP-518/PEP-621). This pip version also support
@@ -14,36 +14,34 @@ requires = virtualenv>=20.24.6
1414
[testenv]
1515
extras = dev
1616
deps =
17-
pytest
1817
pytest-cov
1918
coverage
19+
dependency_groups = test
2020
commands =
2121
pytest --basetemp="{envtmpdir}" {posargs:--color=yes --cov=dissect --cov-report=term-missing -v tests}
2222
coverage report
2323
coverage xml
2424

2525
[testenv:build]
2626
package = skip
27-
deps =
28-
build
27+
dependency_groups = build
2928
commands =
3029
pyproject-build
3130

3231
[testenv:fix]
3332
package = skip
34-
deps =
35-
ruff==0.12.3
33+
dependency_groups = lint
3634
commands =
35+
ruff check --fix dissect tests
3736
ruff format dissect tests
3837

3938
[testenv:lint]
4039
package = skip
41-
deps =
42-
ruff==0.12.3
43-
vermin
40+
dependency_groups = lint
4441
commands =
4542
ruff check dissect tests
46-
vermin -t=3.9- --no-tips --lint dissect tests
43+
ruff format --check dissect tests
44+
vermin -t=3.10- --no-tips --lint dissect tests
4745

4846
[flake8]
4947
max-line-length = 120

0 commit comments

Comments
 (0)