Skip to content

Commit 0c89766

Browse files
authored
Update pyproject.toml license settings and minimum python version (#66)
1 parent a16a0a7 commit 0c89766

File tree

8 files changed

+45
-34
lines changed

8 files changed

+45
-34
lines changed

dissect/hypervisor/disk/c_asif.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_asif(__cs__.cstruct):
87
ASIF_HEADER_SIGNATURE: Literal[1936221303] = ...

dissect/hypervisor/disk/c_qcow2.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_qcow2(__cs__.cstruct):
87
MIN_CLUSTER_BITS: Literal[9] = ...

dissect/hypervisor/disk/vhdx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88
from functools import lru_cache
99
from pathlib import Path
10-
from typing import TYPE_CHECKING, Any, BinaryIO, Callable, Final
10+
from typing import TYPE_CHECKING, Any, BinaryIO, Final
1111
from uuid import UUID
1212

1313
from dissect.util.stream import AlignedStream
@@ -29,7 +29,7 @@
2929
from dissect.hypervisor.exceptions import InvalidSignature, InvalidVirtualDisk
3030

3131
if TYPE_CHECKING:
32-
from collections.abc import Iterator
32+
from collections.abc import Callable, Iterator
3333

3434
log = logging.getLogger(__name__)
3535
log.setLevel(os.getenv("DISSECT_LOG_VHDX", "CRITICAL"))

dissect/hypervisor/util/vmtar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ def visoropen(cls, name: str, mode: str = "r", fileobj: BinaryIO | None = None,
6262
raise tarfile.TarError("visor currently only supports read mode")
6363

6464
try:
65-
from gzip import GzipFile
65+
from gzip import GzipFile # noqa: PLC0415
6666
except ImportError:
6767
raise tarfile.CompressionError("gzip module is not available") from None
6868

6969
try:
70-
from lzma import LZMAError, LZMAFile
70+
from lzma import LZMAError, LZMAFile # noqa: PLC0415
7171
except ImportError:
7272
raise tarfile.CompressionError("lzma module is not available") from None
7373

pyproject.toml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
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.hypervisor"
77
description = "A Dissect module implementing parsers for various hypervisor disk, backup and configuration files"
88
readme = "README.md"
9-
requires-python = "~=3.9"
10-
license.text = "Affero General Public License v3"
9+
requires-python = ">=3.10"
10+
license = "AGPL-3.0-or-later"
11+
license-files = ["LICENSE", "COPYRIGHT"]
1112
authors = [
1213
{name = "Dissect Team", email = "dissect@fox-it.com"}
1314
]
@@ -16,7 +17,6 @@ classifiers = [
1617
"Environment :: Console",
1718
"Intended Audience :: Developers",
1819
"Intended Audience :: Information Technology",
19-
"License :: OSI Approved",
2020
"Operating System :: OS Independent",
2121
"Programming Language :: Python :: 3",
2222
"Topic :: Internet :: Log Analysis",
@@ -46,13 +46,33 @@ dev = [
4646
"dissect.util>=3.0.dev,<4.0.dev",
4747
]
4848

49+
[dependency-groups]
50+
test = [
51+
"pytest",
52+
]
53+
lint = [
54+
"ruff==0.13.1",
55+
"vermin",
56+
]
57+
build = [
58+
"build",
59+
]
60+
debug = [
61+
"ipdb",
62+
]
63+
dev = [
64+
{include-group = "test"},
65+
{include-group = "lint"},
66+
{include-group = "debug"},
67+
]
68+
4969
[project.scripts]
5070
envelope-decrypt = "dissect.hypervisor.tools.envelope:main"
5171
vmtar = "dissect.hypervisor.tools.vmtar:main"
5272

5373
[tool.ruff]
5474
line-length = 120
55-
required-version = ">=0.11.0"
75+
required-version = ">=0.13.1"
5676

5777
[tool.ruff.format]
5878
docstring-code-format = true
@@ -102,9 +122,6 @@ ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM1
102122
known-first-party = ["dissect.hypervisor"]
103123
known-third-party = ["dissect"]
104124

105-
[tool.setuptools]
106-
license-files = ["LICENSE", "COPYRIGHT"]
107-
108125
[tool.setuptools.packages.find]
109126
include = ["dissect.*"]
110127

tests/disk/test_hdd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_split_hdd(split_hdd: Path) -> None:
6161

6262
start = 0
6363

64-
for storage, split_size in zip(storages, split_sizes):
64+
for storage, split_size in zip(storages, split_sizes, strict=False):
6565
assert storage.start == start
6666
assert storage.end == start + split_size
6767
assert len(storage.images) == 1

tests/disk/test_qcow2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_basic(basic_qcow2: BinaryIO) -> None:
3131
def test_data_file(data_file_qcow2: Path) -> None:
3232
# Test with file handle
3333
with gzip.open(data_file_qcow2, "rb") as fh:
34-
with pytest.raises(Error, match="data-file required but not provided \\(image_data_file = 'data-file.bin'\\)"):
34+
with pytest.raises(Error, match=r"data-file required but not provided \(image_data_file = 'data-file.bin'\)"):
3535
QCow2(fh)
3636

3737
with gzip.open(data_file_qcow2.with_name("data-file.bin.gz"), "rb") as fh_bin:
@@ -47,7 +47,7 @@ def test_data_file(data_file_qcow2: Path) -> None:
4747
# Test with allow_no_data_file
4848
qcow2 = QCow2(fh, allow_no_data_file=True)
4949
assert qcow2.data_file is None
50-
with pytest.raises(Error, match="data-file required but not provided \\(image_data_file = 'data-file.bin'\\)"):
50+
with pytest.raises(Error, match=r"data-file required but not provided \(image_data_file = 'data-file.bin'\)"):
5151
qcow2.open()
5252

5353
# Test with Path
@@ -68,12 +68,12 @@ def test_backing_file(backing_chain_qcow2: tuple[Path, Path, Path]) -> None:
6868
# Test with file handle
6969
with gzip.open(file1, "rb") as fh1, gzip.open(file2, "rb") as fh2, gzip.open(file3, "rb") as fh3:
7070
with pytest.raises(
71-
Error, match="backing-file required but not provided \\(auto_backing_file = 'backing-chain-2.qcow2'\\)"
71+
Error, match=r"backing-file required but not provided \(auto_backing_file = 'backing-chain-2.qcow2'\)"
7272
):
7373
QCow2(fh1)
7474

7575
with pytest.raises(
76-
Error, match="backing-file required but not provided \\(auto_backing_file = 'backing-chain-3.qcow2'\\)"
76+
Error, match=r"backing-file required but not provided \(auto_backing_file = 'backing-chain-3.qcow2'\)"
7777
):
7878
QCow2(fh1, backing_file=fh2)
7979

@@ -87,7 +87,7 @@ def test_backing_file(backing_chain_qcow2: tuple[Path, Path, Path]) -> None:
8787
qcow2 = QCow2(fh1, allow_no_backing_file=True)
8888
assert qcow2.backing_file is None
8989
with pytest.raises(
90-
Error, match="backing-file required but not provided \\(auto_backing_file = 'backing-chain-2.qcow2'\\)"
90+
Error, match=r"backing-file required but not provided \(auto_backing_file = 'backing-chain-2.qcow2'\)"
9191
):
9292
qcow2.open()
9393

tox.ini

Lines changed: 8 additions & 12 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,38 +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.11.10
33+
dependency_groups = lint
3634
commands =
37-
ruff format dissect tests
3835
ruff check --fix dissect tests
36+
ruff format dissect tests
3937

4038
[testenv:lint]
4139
package = skip
42-
deps =
43-
ruff==0.11.10
44-
vermin
40+
dependency_groups = lint
4541
commands =
46-
ruff format --check dissect tests
4742
ruff check dissect tests
48-
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
4945

5046
[testenv:docs-build]
5147
allowlist_externals = make

0 commit comments

Comments
 (0)