Skip to content

Commit

Permalink
Merge pull request #21 from uncle-lv/compatibility-for-python3.12
Browse files Browse the repository at this point in the history
Test the compatibility with Python 3.11 and 3.12 and add github actions
  • Loading branch information
cocolato authored Mar 17, 2024
2 parents d2ef5ae + fe0222e commit 40f0e1c
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 16 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {name: '3.12', python: '3.12', os: ubuntu-latest}
- {name: '3.11', python: '3.11', os: ubuntu-latest}
- {name: '3.10', python: '3.10', os: ubuntu-latest}
- {name: '3.9', python: '3.9', os: ubuntu-latest}
- {name: '3.8', python: '3.8', os: ubuntu-latest}
- {name: '3.7', python: '3.7', os: ubuntu-latest}
steps:
- uses: actions/checkout@v3
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python }}
cache: true
- name: Install dependencies
run: pdm install -Gtest
- name: Run tests
run: pdm run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test.py
/my
.vscode
.idea
.tox

dist/
.pdm-python
137 changes: 124 additions & 13 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pydumpling/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def validate_file_name(file_name: str) -> str:
if not file_name.endswith(DUMP_FILE_EXTENSION):
raise argparse.ArgumentTypeError("File must be .dump file")
if not os.path.exists(file_name):
raise argparse.ArgumentTypeError(f"File {file_name} not found")
raise argparse.ArgumentTypeError(f"File {file_name} not found")
return file_name


Expand Down
4 changes: 2 additions & 2 deletions pydumpling/debug_dumpling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pdb
import dill
import pickle
from distutils.version import StrictVersion
from packaging.version import parse
import inspect
import types
from .fake_types import FakeFrame, FakeTraceback, FakeCode
Expand All @@ -30,7 +30,7 @@ def mock_inspect():
def debug_dumpling(dump_file, pdb=pdb):
mock_inspect()
dumpling = load_dumpling(dump_file)
if not StrictVersion("0.0.1") <= StrictVersion(dumpling["version"]) < StrictVersion("1.0.0"):
if not parse("0.0.1") <= parse(dumpling["version"]) < parse("1.0.0"):
raise ValueError("Unsupported dumpling version: %s" %
dumpling["version"])
tb = dumpling["traceback"]
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ test = [
"pytest-order>=1.2.0",
"flake8>=5.0.4",
]
dev = [
"tox-pdm>=0.6.1",
]
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
Expand All @@ -26,6 +29,8 @@ authors = [
]
dependencies = [
"dill<1.0.0,>=0.3.2",
"six<2.0.0,>=1.16.0",
"packaging>=24.0",
]
requires-python = ">=3.7"
readme = "README.md"
Expand Down
27 changes: 27 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is @generated by PDM.
# Please do not edit it manually.

colorama==0.4.6; sys_platform == "win32" or platform_system == "Windows"
dill==0.3.7
distlib==0.3.8
exceptiongroup==1.2.0; python_version < "3.11"
filelock==3.12.2
flake8==5.0.4
importlib-metadata==4.2.0; python_version < "3.8"
iniconfig==2.0.0
mccabe==0.7.0
packaging==24.0
platformdirs==2.6.2
pluggy==1.2.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pytest==7.4.4
pytest-order==1.2.0
six==1.16.0
tomli==2.0.1; python_version < "3.11"
tox==3.28.0
tox-pdm==0.6.1
typing-extensions==4.7.1; python_version < "3.8"
virtualenv==20.16.2
zipp==3.15.0; python_version < "3.8"
13 changes: 13 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
min_version = 4.0
envlist = py3{12,11,10,9,8,7}

[testenv]
groups = test
allowlist_externals = pytest
commands = pytest -v

[testenv:lint]
groups = lint
commands =
flake8 pydumpling/ tests/

0 comments on commit 40f0e1c

Please sign in to comment.