Skip to content

Commit 40f0e1c

Browse files
authored
Merge pull request #21 from uncle-lv/compatibility-for-python3.12
Test the compatibility with Python 3.11 and 3.12 and add github actions
2 parents d2ef5ae + fe0222e commit 40f0e1c

File tree

8 files changed

+206
-16
lines changed

8 files changed

+206
-16
lines changed

.github/workflows/tests.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
tests:
11+
name: ${{ matrix.name }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- {name: '3.12', python: '3.12', os: ubuntu-latest}
18+
- {name: '3.11', python: '3.11', os: ubuntu-latest}
19+
- {name: '3.10', python: '3.10', os: ubuntu-latest}
20+
- {name: '3.9', python: '3.9', os: ubuntu-latest}
21+
- {name: '3.8', python: '3.8', os: ubuntu-latest}
22+
- {name: '3.7', python: '3.7', os: ubuntu-latest}
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Setup PDM
26+
uses: pdm-project/setup-pdm@v3
27+
with:
28+
python-version: ${{ matrix.python }}
29+
cache: true
30+
- name: Install dependencies
31+
run: pdm install -Gtest
32+
- name: Run tests
33+
run: pdm run test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ test.py
77
/my
88
.vscode
99
.idea
10+
.tox
1011

1112
dist/
1213
.pdm-python

pdm.lock

Lines changed: 124 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pydumpling/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def validate_file_name(file_name: str) -> str:
1212
if not file_name.endswith(DUMP_FILE_EXTENSION):
1313
raise argparse.ArgumentTypeError("File must be .dump file")
1414
if not os.path.exists(file_name):
15-
raise argparse.ArgumentTypeError(f"File {file_name} not found")
15+
raise argparse.ArgumentTypeError(f"File {file_name} not found")
1616
return file_name
1717

1818

pydumpling/debug_dumpling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pdb
55
import dill
66
import pickle
7-
from distutils.version import StrictVersion
7+
from packaging.version import parse
88
import inspect
99
import types
1010
from .fake_types import FakeFrame, FakeTraceback, FakeCode
@@ -30,7 +30,7 @@ def mock_inspect():
3030
def debug_dumpling(dump_file, pdb=pdb):
3131
mock_inspect()
3232
dumpling = load_dumpling(dump_file)
33-
if not StrictVersion("0.0.1") <= StrictVersion(dumpling["version"]) < StrictVersion("1.0.0"):
33+
if not parse("0.0.1") <= parse(dumpling["version"]) < parse("1.0.0"):
3434
raise ValueError("Unsupported dumpling version: %s" %
3535
dumpling["version"])
3636
tb = dumpling["traceback"]

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ test = [
1212
"pytest-order>=1.2.0",
1313
"flake8>=5.0.4",
1414
]
15+
dev = [
16+
"tox-pdm>=0.6.1",
17+
]
1518
[build-system]
1619
requires = ["pdm-backend"]
1720
build-backend = "pdm.backend"
@@ -26,6 +29,8 @@ authors = [
2629
]
2730
dependencies = [
2831
"dill<1.0.0,>=0.3.2",
32+
"six<2.0.0,>=1.16.0",
33+
"packaging>=24.0",
2934
]
3035
requires-python = ">=3.7"
3136
readme = "README.md"

requirements.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file is @generated by PDM.
2+
# Please do not edit it manually.
3+
4+
colorama==0.4.6; sys_platform == "win32" or platform_system == "Windows"
5+
dill==0.3.7
6+
distlib==0.3.8
7+
exceptiongroup==1.2.0; python_version < "3.11"
8+
filelock==3.12.2
9+
flake8==5.0.4
10+
importlib-metadata==4.2.0; python_version < "3.8"
11+
iniconfig==2.0.0
12+
mccabe==0.7.0
13+
packaging==24.0
14+
platformdirs==2.6.2
15+
pluggy==1.2.0
16+
py==1.11.0
17+
pycodestyle==2.9.1
18+
pyflakes==2.5.0
19+
pytest==7.4.4
20+
pytest-order==1.2.0
21+
six==1.16.0
22+
tomli==2.0.1; python_version < "3.11"
23+
tox==3.28.0
24+
tox-pdm==0.6.1
25+
typing-extensions==4.7.1; python_version < "3.8"
26+
virtualenv==20.16.2
27+
zipp==3.15.0; python_version < "3.8"

tox.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[tox]
2+
min_version = 4.0
3+
envlist = py3{12,11,10,9,8,7}
4+
5+
[testenv]
6+
groups = test
7+
allowlist_externals = pytest
8+
commands = pytest -v
9+
10+
[testenv:lint]
11+
groups = lint
12+
commands =
13+
flake8 pydumpling/ tests/

0 commit comments

Comments
 (0)